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.

8896271ee9d6f46d4b1783c9566cb645?s=128

Bradley Holt

March 06, 2018
Tweet

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. None
  3. 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.
  4. https://youtu.be/bWXAZboHZN8

  5. None
  6. 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).
  7. 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).
  8. 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).
  9. IBM Cloud / March 6, 2018 / © 2018 IBM

    Corporation Offline, Online & ¯\_(ツ)_/¯ underground by weckgeschnappt_, on Flickr <https://flic.kr/p/8bkWFK> (CC BY 2.0).
  10. None
  11. 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
  12. https://github.com/ibm-watson-data-lab/shopping-list

  13. https://developer.ibm.com/code/patterns/create-an-offline-first-shopping-list-with-polymer-and-pouchdb/

  14. 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
  15. https://www.pwastats.com/

  16. https://developers.google.com/web/showcase/2017/twitter

  17. 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).
  18. 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).
  19. 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).
  20. https://caniuse.com/#feat=serviceworkers

  21. Registering 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).
  22. 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).
  23. Custom service worker response example by Mozilla Contributors <https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers> (CC-BY-SA

    2.5).
  24. 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).
  25. https://caniuse.com/#search=indexdb

  26. 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).
  27. https://github.com/localForage/localForage

  28. Sync is Hard Technological devices designed by D3Images / Freepik

    <http://www.freepik.com/>. IBM Cloud / March 6, 2018 / © 2018 IBM Corporation
  29. None
  30. Apache CouchDB PouchDB IBM Cloudant

  31. “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/
  32. 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).
  33. https://pouchdb.com/

  34. 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/
  35. 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
  36. 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).
  37. 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
  38. 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
  39. 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
  40. 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)
  41. 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)
  42. IBM Cloud / March 6, 2018 / © 2018 IBM

    Corporation Multi-User Apps with Hoodie http://hood.ie/
  43. None
  44. 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).
  45. Cloudant Envoy

  46. Join the Offline First community IBM Cloud / March 6,

    2018 / © 2018 IBM Corporation
  47. IBM Cloud / March 6, 2018 / © 2018 IBM

    Corporation offlinefirst.org/chat
  48. None
  49. https://medium.com/offline-camp

  50. Thank you IBM Cloud / March 6, 2018 / ©

    2018 IBM Corporation Bradley Holt Developer Advocate Senior Software Engineer — ibm.com
  51. IBM Cloud / March 6, 2018 / © 2018 IBM

    Corporation