Offline first: mobile apps that survive a bad network
Bad networks are the normal case
Apps are usually built and tested on fast office Wi-Fi. They are used in lifts, basements, trains and rural areas, on connections that drop and recover several times a minute. An app that shows a spinner every time the signal fades feels broken, even if the backend is perfectly healthy.
Offline first means designing for that reality from the start: the app reads and writes local data, and the network is used to keep that data in sync.
Read from the device
Every screen should render from a local database first and refresh in the background. The user sees their orders, tasks or messages immediately, along with a quiet note of when the data was last updated. When the network returns, the screen updates in place without a full reload.
Write to a queue
When the user creates or changes something, save it locally and add it to an outgoing queue. The interface treats the change as done. A background worker sends queued changes when the connection allows, retries with backoff when it fails, and keeps going after the app restarts.
- Give every change a client-generated ID so retries never create duplicates
- Make server endpoints idempotent for the same reason
- Keep the queue ordered where order matters
- Show pending changes subtly, and errors clearly
Decide how conflicts resolve
If two people edit the same record offline, someone has to win. For most fields, the latest change is fine. For some, like stock counts or balances, you need to send the operation (add three) rather than the new value (now twelve), so that both changes apply. For a few, a person has to choose. Make this decision per field during design. Discovering it in production is painful.
Be honest in the interface
Users cope well with being offline when the app is honest about it. A small banner that says changes will sync later is reassuring. A form that silently fails is not. Payments and other actions that genuinely need the server should say so and be disabled offline, rather than appearing to work.
Test the bad cases
We test every release with network throttling, airplane mode toggled mid-request and the app killed while the queue is full. These tests find more real bugs than any other part of our mobile QA, because they reproduce what users actually live with.
