Offline-first
Also called offline first, local-first.
A way of building apps so they work fully without a network connection, saving changes on the device and syncing them when a connection returns.
Last updated
What it is.
In an offline-first app, the device has its own local database. Reads and writes go there first, so the app is fast and keeps working in a basement, on a plane or in a field. A sync process sends local changes to the server and pulls down others' changes when it can.
The hard part is conflicts: two people edit the same record while offline. The app needs clear rules, such as last write wins per field, merge, or ask the user.
Why it matters
For field workers, drivers, inspectors and health workers in low-signal areas, an app that stops without signal is an app that does not get used. Offline-first costs more to build, so it should be chosen for the flows that really need it.
In a product build
We decide early which data lives on the device and which flows must work offline, give each record a client-generated ID so sync is idempotent, store a change log for sync, and design conflict rules per data type with the client. Sync state is always visible to the user.
Common mistakes.
- 01
Adding offline support late to an app that assumed a live connection everywhere.
- 02
No conflict rules, so edits are silently lost.
- 03
Storing sensitive data on devices without encryption or a remote wipe plan.
Related terms.
- PWA (progressive web app)A web app built with standard web technology that can be installed on a device and work offline, giving an experience close to a native app.
- IdempotencyThe property of an operation that has the same effect whether it runs once or several times, so it is safe to retry.
- Object storageA way of storing files as objects in buckets, each with an ID and metadata, reached over HTTP and built to scale to huge amounts of data cheaply.
- Event-driven architectureA way of designing software where parts of the system publish events about what happened, and other parts react to them on their own.
- Message queueA buffer that holds messages, such as tasks or events, until a worker is ready to process them, so the sender does not have to wait.