Modern browser technologies now make it possible to ship completely offline web applications with native-like performance; actually building such an application is a different story.
At Superhuman we’ve built an offline-first email client in the browser, using open source libraries to help us manage the problems we’ve faced.
This talk is aimed at experienced or intermediate web-developers who’d like to make their app work offline too. We’ll cover the basics of how to load code offline using service workers, and how to store data locally using IndexedDB and CacheStorage (even the venerable localStorage gets a mention).
With the tools in our toolbox we’ll dig into the “syncing” problem, which is the achilles heel in offline apps. How do you make sure that we don’t lose any of the user’s work, and that the world ends up in an expected state on reconnection? How do you deal with partial connectivity in a world where more and more people are using laptops tethered to mobile networks?
There are a few existing solutions, like PouchDB and Firebase that can help, but in order to use these tools effectively, I’ll teach you how to model updates as streams that can be played forward or backward. I’ll show you the techniques we use to ensure that offline code always knows “which changes haven’t been applied yet” and what the previous state of the world on the server was.