Offline web apps aren't that hard.

In the course of my career, I've had to work with teams who had a functional software and wanted to make it offline-capable, other teams have engineers who have built very complex systems and just wanted to brute-force their software to work offline, either way... I'm taking out a bit of time today to explain why offline first isn't that complex.

Some five years ago on my first job, my lead engineer taught me to be resilient and learn the core of things, I have him to thank for how much time I invested in learning continuously, but something more important I had to learn on my own was to prioritize deploying quick rather than picking a challenge. We had projects delayed 3 weeks because some engineer wanted the adreline rush of writing a sorting function himself rather than use third-party libraries, or repetitively write basic SQL statements rather than use ORM. That engineer was mostly me ๐Ÿ™ˆ.

Well, after trying out ORM and see how it significantly improved my delivery speed, I'd rather write code quicker and use my extra time to learn new stuff that can continuously help me to save more time and help the whole team ship quicker than expected and get kudos ๐Ÿ˜, hopefully I can save enough to buy a Ferrari; you know... time is money ๐Ÿ˜‰.

Two of the advice I've heard and always take to heart are "Never implement a database from scratch" and "There is always the right tool for everything". Most people approach offline apps in a similar way to trying to get a car to fly, you can eventually do it... but you'd spend more time and probably money than outright getting an aircraft. And also, you might never really incorporate all the security components that ships with an aircraft out of the box.

An offline web app, is either built to work offline or hacked to do so. An offline first typically requires only 2 main considerations.

  1. Persistence: What is available offline and how would you make it available
  2. Sync: How do you reconcile your offline app with your live instance.

When I'm talking about offline-first, I'm not talking about websites ๐Ÿ™„. I mean actual applications that actually are a bit complex and logical, e.g data collection tools or collaboration software. For example, we built an accounting software that works completely offline but reconciles records from different users when they eventually connect to the internet.

Both are easy if only one person uses the software from a single device, but complexity begins to add up when many people have to interact with the same software at thesame time. Even more complex if they all have to work on the same document at the same time. It becomes difficult to not overwrite data unknowingly and to know just what to sync.

Over the next couple of weeks, I'd walk you through building a "not so complex" offline first application.

2
Subscribe to my newsletter

Read articles from Abdulhakeem Mustapha directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Abdulhakeem Mustapha
Abdulhakeem Mustapha