Most apps assume connectivity and degrade badly without it. For a consumer app in a city that is mostly acceptable. For field workers, drivers, inspectors and anyone operating in a basement, a warehouse or a rural area, it makes the app unusable at exactly the moment it is needed.
Offline-first inverts the assumption: the app works locally and syncs opportunistically.
The core idea
In a conventional app, the server is the source of truth. The user taps save, the app sends a request, waits, and shows a result. No connection means no save.
In an offline-first app, the local database is the source of truth for the user. A save writes locally and returns immediately. A background process syncs to the server when it can.
The user experience consequence is immediate: the app feels instant, because nothing waits on a round trip. That benefit applies even on a good connection, which is why offline-first apps often feel faster than online ones.
Local storage
You need a real database on the device, not key-value storage.
SQLite is the foundation on both platforms — mature, fast, queryable. In React Native, libraries such as WatermelonDB or op-sqlite give you a workable interface. In Flutter, Drift or Isar.
Realm and PowerSync offer sync as part of the package, which removes a large amount of the hardest work if the model fits your needs.
Avoid building on plain async storage for anything with structure. You will reimplement a database badly.
Sync strategy
Three decisions, and they should be made before writing code.
What syncs
Not everything. Syncing an entire dataset to every device is slow and often a data-protection problem. Sync what this user needs: their jobs, their customers, their region, with a sensible time window.
When it syncs
- On change, when a connection is available
- On app foreground, to pick up server changes
- Periodically in the background where the platform allows
- On explicit user action, because people want a pull-to-refresh they can trust
How changes are represented
Two broad approaches:
Change log. Every local modification is recorded as an operation and queued. On sync, the queue is replayed against the server. Robust, handles ordering, more work to build.
Last-write-wins on records. Each record carries a timestamp; the most recent version wins. Much simpler, loses data in genuine conflicts.
For most business apps a change log on the records that matter and last-write-wins on the rest is a reasonable compromise.
Conflict resolution
The part that cannot be avoided and is frequently deferred until it causes a bug.
A conflict happens when the same record changed on the device and on the server since the last sync. You need a rule, and the right rule differs by data type:
- Last write wins — fine for a status field or a preference
- Server wins — for anything authoritative, like pricing or assignment
- Client wins — for data only this user owns, like their own notes
- Merge by field — where changes to different fields can both be kept
- Ask the user — for genuinely ambiguous cases, used sparingly
Decide per entity, write it down, and test it deliberately. Conflict bugs are extremely hard to reproduce after the fact because they depend on timing.
Append-only beats mutable wherever you can arrange it. A log of events conflicts far less than a record being edited in two places. Where the domain allows it, model data as events rather than as state.
UI patterns
Technical correctness is not enough. The interface has to make the state legible, or users will not trust it.
Show sync status honestly. A small, persistent indicator: synced, syncing, pending, failed. Not a modal, not an alarm — just an honest signal.
Mark unsynced items. A subtle badge on records that exist only locally. Users can then decide whether to wait before leaving the site.
Never block on sync. The user should be able to keep working regardless.
Make failures visible and recoverable. A sync that fails should surface, explain and offer retry — not silently drop.
Show the last-updated time on data pulled from the server, so a user viewing stale data knows it.
The underlying principle: users tolerate delay; they do not tolerate uncertainty. An app that says "3 items waiting to sync" is trusted. One that says nothing and silently loses a form is not.
Authentication offline
An awkward detail people hit late.
Tokens expire. If a user is offline when theirs does, they must not be locked out of data already on the device. Keep a longer-lived local session separate from the API token, and let the app function in a read-and-queue mode until it can re-authenticate.
Consider what happens on logout too: do you wipe local data? For shared devices, yes. For personal ones, that may lose unsynced work. Decide deliberately.
Testing
The most common testing failure is only testing with the network fully off. That is the easy case.
Test the hard ones:
- Slow connection — 2G speeds, where requests succeed eventually
- Flaky connection — dropping in and out mid-request
- Request started, connection lost before response — did it succeed on the server?
- Long offline period — days, with many queued changes
- Same record edited on two devices while both offline
- Server data changed while the device was offline
Network throttling tools in the platform simulators cover most of this. The second and fourth cases are where real bugs live.
When not to do it
Offline-first adds genuine complexity. It is not free, and it is wrong for:
- Apps whose entire value is live data — live prices, live chat, live tracking
- Apps used only in reliable-connectivity settings
- Simple consumer apps where a loading state is perfectly acceptable
The decision point: would the user ever be somewhere without a signal while needing this app? If yes, build offline-first from the start. Retrofitting it is close to a rewrite, because it changes where the source of truth lives — which touches everything.
If you are planning a field or operations app and want the architecture reviewed before build, get in touch.
