Upgrade to Pro — share decks privately, control downloads, hide ads and more …

IBM Code Tech Talk: Building Offline First Apps for Exceptional User Experiences

IBM Code Tech Talk: Building Offline First Apps for Exceptional User Experiences

Offline First is an approach to app development in which you design your app for the most resource-constrained environment first. An Offline First approach provides a consistent user experience whether a device has no connectivity, limited connectivity, or great connectivity. One of the biggest benefits of Offline First apps is that they can be very fast, as they provide zero-latency access to content and data stored directly on the device. Learn how to build an Offline First data layer for Progressive Web Apps, hybrid mobile apps, native mobile apps, and even desktop apps using open source components including Apache CouchDB, Hoodie, and PouchDB.

Bradley Holt

March 06, 2018
Tweet

More Decks by Bradley Holt

Other Decks in Programming

Transcript

  1. IBM Cloud / March 6, 2018 / © 2018 IBM

    Corporation Building Offline First Apps for Exceptional User Experiences — Bradley Holt Developer Advocate Senior Software Engineer
  2. Offline Camp IBM Cloud / March 6, 2018 / ©

    2018 IBM Corporation We are building an Offline First community, one campfire at a time. Offline Camp has visited the Catskills of New York, the Central Coast of California, Berlin, and Oregon.
  3. Not just offline… IBM Cloud / March 6, 2018 /

    © 2018 IBM Corporation Accès wi-fi à Gorakshep (5140m) by Jerome Bon, on Flickr <https://flic.kr/p/bDzjj5> (CC BY 2.0).
  4. Reliable, fast, and engaging user experience— regardless of network connectivity

    IBM Cloud / March 6, 2018 / © 2018 IBM Corporation Static Wallpaper by James Spinks, on Flickr <https://flic.kr/p/2b1JP> (CC BY-SA 2.0).
  5. Zero-latency access to content & data IBM Cloud / March

    6, 2018 / © 2018 IBM Corporation speed 3 by Monkieyes, on Flickr <https://flic.kr/p/PXPwK> (CC BY 2.0).
  6. IBM Cloud / March 6, 2018 / © 2018 IBM

    Corporation Offline, Online & ¯\_(ツ)_/¯ underground by weckgeschnappt_, on Flickr <https://flic.kr/p/8bkWFK> (CC BY 2.0).
  7. Shopping List IBM Cloud / March 6, 2018 / ©

    2018 IBM Corporation A series of demo Progressive Web Apps, hybrid mobile apps, native mobile apps, and a desktop app— each built using a different stack https://ibm-watson-data-lab.github.io/shopping-list-demo
  8. Progressive Web Apps IBM Cloud / March 6, 2018 /

    © 2018 IBM Corporation Provides both the discoverability of a web app and the reliable, fast, and engaging user experience of a native mobile app
  9. The next billion people on the internet IBM Cloud /

    March 6, 2018 / © 2018 IBM Corporation the galaxy by tommy@chau, on Flickr <https://flic.kr/p/sbEHMt> (CC BY 2.0).
  10. Geolocation API Network Information API IndexedDB WebRTC API Push API

    Notifications API Device Orientation API Screen Orientation API Permissions API Proximity API Pointer Lock API Vibration API Payment Request API Battery Status API Ambient Light Sensor API Service Worker API IBM Design Icons by International Business Machines Corporation <https://www.ibm.com/design/language/resources/icon-library/> (CC BY 4.0).
  11. Service Workers IBM Cloud / March 6, 2018 / ©

    2018 IBM Corporation Service Workers allow for fine- grained control over caching of content and assets, enabling cache-first web apps Service Workers fetch diagram by Mozilla Contributors <https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers> (CC-BY-SA 2.5).
  12. Install and activate a service worker example by Mozilla Contributors

    <https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers> (CC-BY-SA 2.5).
  13. IndexedDB IBM Cloud / March 6, 2018 / © 2018

    IBM Corporation IndexedDB enables app data to be stored locally within a browser IBM Design Icons by International Business Machines Corporation <https://www.ibm.com/design/language/resources/icon-library/> (CC BY 4.0).
  14. localForage IBM Cloud / March 6, 2018 / © 2018

    IBM Corporation localForage is a polyfill that wraps IndexedDB, WebSQL, or localStorage, providing a consistent API regardless of which storage mechanism is supported by the end user’s browser IBM Design Icons by International Business Machines Corporation <https://www.ibm.com/design/language/resources/icon-library/> (CC BY 4.0).
  15. Sync is Hard Technological devices designed by D3Images / Freepik

    <http://www.freepik.com/>. IBM Cloud / March 6, 2018 / © 2018 IBM Corporation
  16. “CouchDB’s superpower is sync. Sometimes I even try to explain

    it to people by saying, ‘CouchDB isn’t a database; it’s a sync engine.’ It’s a way of efficiently transferring data from one place to another, while intelligently managing conflicts and revisions. It’s very similar to Git. When I make that analogy, the light bulb often goes off.” Nolan Lawson PouchDB & CouchDB: An interview with Nolan Lawson IBM Cloud / March 6, 2018 / © 2018 IBM Corporation https://blog.couchdb.org/2017/04/04/pouchdb-couchdb-an-interview-with-nolan-lawson/
  17. Offline Sync for Progressive Web Apps Apache CouchDB PouchDB Devices

    by Darwin Laganzon, on Pixabay <https://pixabay.com/photo-1917227/> (CC0 Public Domain). | Cloud by Raphael Silva, on Pixabay <https://pixabay.com/photo-2109664/> (CC0 Public Domain).
  18. Pokedex.org IBM Cloud / March 6, 2018 / © 2018

    IBM Corporation An offline-capable Progressive Web App built with Service Worker and PouchDB https://www.pokedex.org/
  19. Hybrid Mobile Apps IBM Cloud / March 6, 2018 /

    © 2018 IBM Corporation Tools such as Cordova and Ionic can be used to build native mobile apps using web platform tooling (HTML, CSS, and JavaScript), enabling you to target multiple platforms with one codebase
  20. Offline Sync for Hybrid Mobile Apps Apache CouchDB PouchDB (SQLite

    adapter) IBM Design Icons by International Business Machines Corporation <https://www.ibm.com/design/language/resources/icon-library/> (CC BY 4.0). | Cloud by Raphael Silva, on Pixabay <https://pixabay.com/photo-2109664/> (CC0 Public Domain).
  21. Offline Sync for Hybrid Mobile Apps Apache CouchDB IBM Design

    Icons by International Business Machines Corporation <https://www.ibm.com/design/language/resources/icon-library/> (CC BY 4.0). | Cloud by Raphael Silva, on Pixabay <https://pixabay.com/photo-2109664/> (CC0 Public Domain). Cloudant Sync – Cordova Plugin
  22. Native Mobile Apps IBM Cloud / March 6, 2018 /

    © 2018 IBM Corporation Native mobile apps provide a user experience tailored to the end user’s platform of choice
  23. Offline Sync for Native Mobile Apps Apache CouchDB IBM Design

    Icons by International Business Machines Corporation <https://www.ibm.com/design/language/resources/icon-library/> (CC BY 4.0). | Cloud by Raphael Silva, on Pixabay <https://pixabay.com/photo-2109664/> (CC0 Public Domain). Cloudant Sync for iOS or Android
  24. Desktop Apps IBM Cloud / March 6, 2018 / ©

    2018 IBM Corporation Tools such as Electron can be used to build cross- platform desktop apps using web platform tooling (HTML, CSS, and JavaScript)
  25. Offline Sync for Desktop Electron Apps Apache CouchDB Technological devices

    designed by D3Images / Freepik <http://www.freepik.com/>. | Cloud by Raphael Silva, on Pixabay <https://pixabay.com/photo-2109664/> (CC0 Public Domain). PouchDB (LevelDB or SQLite adapter)
  26. IBM Cloud / March 6, 2018 / © 2018 IBM

    Corporation Multi-User Apps with Hoodie http://hood.ie/
  27. Apache CouchDB Devices by Darwin Laganzon, on Pixabay <https://pixabay.com/photo-1917227/> (CC0

    Public Domain). | Cloud by Raphael Silva, on Pixabay <https://pixabay.com/photo-2109664/> (CC0 Public Domain).
  28. IBM Cloud / March 6, 2018 / © 2018 IBM

    Corporation offlinefirst.org/chat
  29. Thank you IBM Cloud / March 6, 2018 / ©

    2018 IBM Corporation Bradley Holt Developer Advocate Senior Software Engineer — ibm.com