Insights · Software engineering

Offline-first: software that keeps working when the power doesn't

In a Lagos shop or warehouse, the internet drops and the power cuts out, often at the busiest moment. A cloud-only app stops exactly when it's needed.

We've built two systems around that fact: Ònkà, a stock and money app for traders of any goods, and an offline-first inventory app for a Lagos distribution warehouse. Here's what offline-first means in practice.

1. Write locally, always

Every sale or stock movement is saved on the device first, then synced when the network is back. The app never waits for the server to confirm a sale; the server catches up.

2. Make sync safe to repeat

A batch of queued movements can be sent twice: the connection drops after the server received it but before the phone heard back. Each movement carries a client-generated ID, so the server applies a repeated batch exactly once.

3. Reject the one bad movement, not the whole batch

If two phones draw down the same item while offline, the second movement may take stock below zero. That movement is rejected on its own and flagged; the rest of the batch still applies. One conflict shouldn't block a day's work.

4. Turn conflicts into alerts, not silent merges

In Ònkà, two PCs can each sell the same phone while both are offline. When they sync, that raises one alert for the owner, because a phone sold twice is exactly the kind of leak the shop needs to see.

5. Tie every action to a person

Staff often share one PC. Each person logs in with a short PIN, so every sale, void and price change is recorded against someone. A price below cost needs a manager's PIN on the spot, and the approver is recorded too.

6. Check licences without phoning home

A licence check that needs the internet fails offline. Ònkà's licences are signed with Ed25519, so the app verifies the signature locally with a public key: no network needed, and not easy to forge.

7. Validate input from the real world

Scanners read whatever QR code is in front of them. The warehouse app only accepts its own payload format, such as INV:ITEM:CEM-50; anything else is refused instead of crashing the scan screen.

Test the rules, not just the screens

Most offline bugs are business-rule bugs: double application, negative stock, an unapproved discount. Ònkà has more than 300 automated tests on those rules.

Need software that works where the network doesn't? Talk to our custom software team, or book a demo of Ònkà.