TL;DR
The UI reads and writes only the local database. A single sync engine owns the network.
Every write saves the record and an outbox entry in one transaction, using a client-generated UUID and an idempotency key.
A sync cycle pushes the outbox first, then pulls everything that changed since a server-side cursor.
Conflicts are detected with a server-assigned version and merged field by field, with an explicit policy for fields both sides edited.
Why offline-first
Most mobile apps are built as if the network is always there. Then a user opens the app in an elevator, on a rural road, in a basement warehouse or at a border crossing, and every tap turns into a spinner or an error.
Offline-first flips the assumption: the app works fully without a connection, and the network is just a way to share changes with the server when it happens to be available.…