Engineering
Offline-first apps: the product decision to make in week one
A field app that treats offline as an error state fails where the work happens. Three questions settled in week one decide whether yours will.
Computing America. Applications, integrations, data analysis and AI/ML engineering.
Describe the field
In short
- Competently built field apps still fail when connectivity is treated as a given and offline as an error state.
- A crew that can't tell whether an inspection saved may photograph the screen and keep using paper as well. Show what is on the device, what has reached the server, and what failed.
- Generate identifiers on the client at creation time, preferably UUIDv7, so there are no temporary IDs to reconcile later and the database index keeps its locality.
- Only the server's acknowledgment should move an entry from "on this device" to "saved". That one rule keeps the sync indicator honest.
- The failure mode that matters is intermittent signal with high latency and partial loss. Emulate it with a network tool first, then drive the real route.
Offline-first is a product decision, because three questions need answers before the first screen exists. Where does an identifier come from? What happens when two people change the same thing? How does a user know their work is safe?
Three questions to settle in week one¶
Where does an identifier come from?¶
If the server assigns IDs, a device can't create a record offline without inventing a temporary one and reconciling it later. That temporary ID leaks into every relationship, URL and log line. Generate identifiers on the client at creation time. RFC 9562 (opens in a new tab) describes the property you want: no central authority is needed to administer UUIDs, and generation can be fully automated on demand. Prefer UUIDv7 to v4, because the RFC is explicit that non-time-ordered versions have poor database-index locality. An app writing many rows per shift will feel that.
What happens when two people change the same thing?¶
Last-write-wins silently discards someone's work. Sometimes that's acceptable. Usually the business has a real answer. Reject or flag an edit whose base version is stale (the editor started from a version the server has since changed). Replay operations such as "add a part" or "increment a count" so they combine. Flag two edits that set the same field, and let a human decide.
Don't settle it by device timestamp: that is last-write-wins again, and clocks drift offline. Ask the business. It's a business rule, not a technical default.
How does a user know their work is safe?¶
A crew that isn't sure whether their inspection saved may photograph the screen as a backup, then keep using paper as well. Show what is on the device, what has reached the server, what failed and what to do about it.
The architecture that follows¶
For the duration of the shift, the interface reads and writes only the device's database; the server stays the authority. Queue each operation, not just the final value, each with an idempotency key. A retry after a dropped connection then applies once, and edits replay in order with the intent behind each one intact.
Interface
Reads and writes locally, always
- To Device database · always local
Device database
Marks an entry saved only on acknowledgment
- To Outbound queue · each edit
Outbound queue
One entry per operation, each with an idempotency key
- To Background sync
Background sync
Retries are normal; duplicates are not
- To Server · when signal allows
Server
Applies operations in order, resolving conflicts by the business rule
- To Device database · acknowledgment
The interface doesn't wait on the network: edits go to the device database and reach the server through a retrying queue, and only the server's acknowledgment marks them saved.
SourcePattern described in this article, not a measurement.
- Bounded local storage with an explicit eviction policy, or devices fill up.
- Offline map tiles and reference data pre-staged on the morning connection.
- A visible, honest sync indicator with a manual retry that works.
Test it the way it will be used¶
A clean “no signal” is the easy case. The hard one in the field is intermittent signal with high latency and partial packet loss, where naive retry logic creates duplicates and optimistic interfaces misreport what saved. A lab simulation is a start: tc netem (opens in a new tab) on a Linux test network can add delay and drop packets, for example: tc qdisc add dev eth0 root netem delay 300ms 100ms loss 10%. It needs root and shapes traffic leaving the machine it runs on, so it reaches the tablet only if that machine is the tablet's gateway; undo it with tc qdisc del dev eth0 root. Only the real route shows how your app behaves in the field.
Put the device in the truck. Drive the territory. Walk into the basement. Then ask the vendor the three week-one questions, and have them answer the third on a device in airplane mode.
Sources
- 1.Universally Unique IDentifiers (UUIDs) (opens in a new tab), IETF RFC 9562,
Next step
Tell us where the signal drops.
Where your people work and what they have to finish while they are there. We will say which parts have to survive no network at all, and which are fine to fail loudly and retry.
- Phone
- (214) 723-2510
- Reply
- A person replies, not a sequence: within one business day, from someone who would be on the engagement.
Packages
Start with a package
Four packages, each with its price on the page. Pick one and buy it online.
$199/month
Billed monthly
$182.42/month
Billed yearly
$499/month
Billed monthly
$457.42/month
Billed yearly
- Scammers stopped from sending email as you
- Your website and systems scanned every week
- Your email settings checked every week
- Everything in the 1 to 10 plan
- Covers up to 50 people
$199/month
after a one-time setup fee
- A site planned, designed and built for you
- Hosting and updates every month
$499/month
Billed monthly
$457.42/month
Billed yearly
$999/month
Billed monthly
$915.75/month
Billed yearly
- Your Google profile, fully set up
- A Google post every week
- 2 social posts a week
- Everything in Get found
- 4 social posts a week
- Your top 10 Google searches tracked
from$500/month
after a one-time setup fee
- Your data gathered from the tools you use
- A first analysis that answers your questions
- New findings every month
Related reading
Systems5 min readEDI 214 status messages: four reasons ETAs go wrong
Four failures between a carrier's system and your screen, and what to show beside every ETA.
Delivery4 min readSoftware estimates: why a single number is a bid, not an estimate
Early on, an honest software estimate is a wide range with its assumptions written down. Here is where the range hides and what to ask a vendor.
