"Offline-first" doesn't mean "works when the Wi-Fi drops." It means designing your application as if the network doesn't exist, then adding connectivity as an enhancement.
That's a fundamental shift in how you think about data flow, state management, and user experience. It took me a few failed projects to understand the difference.
What Offline-First Actually Means
The traditional approach: fetch data from the server, display it, let the user modify it, send changes back. If any step fails, show an error.
The offline-first approach: store data locally first, display from local storage, let the user modify it, sync when possible. The network is just a synchronisation mechanism, not a requirement for the app to function.
This changes everything:
- Data lives locally. IndexedDB, localStorage, or SQLite become your primary data store. The server is a backup and sync target.
- Reads are instant. No loading spinners for data you already have. The UI renders immediately from local state.
- Writes are optimistic. User actions succeed immediately in the local store. Sync happens in the background.
- Conflicts are expected. When you have multiple data sources, conflicts will happen. You need a strategy before they occur.