Skip to content

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
3 min readComputing America
A rugged handheld computer on a utility truck dashboard, parked on a remote gravel road.

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.

Fig. 1
  1. Interface

    Reads and writes locally, always

    • To Device database · always local
  2. Device database

    Marks an entry saved only on acknowledgment

    • To Outbound queue · each edit
  3. Outbound queue

    One entry per operation, each with an idempotency key

    • To Background sync
  4. Background sync

    Retries are normal; duplicates are not

    • To Server · when signal allows
  5. 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. 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.

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.

Billing