Home/Modules/Offline & Sync Engine
🛡️

Offline & Sync Engine

The reason nothing is ever lost. A sale vault, a critical journal, a smart sync queue, a LAN host lease, delta inventory sync and real conflict resolution — the machinery that makes offline-first true.

Local-first is the default, not a fallback

Most cloud POS systems treat offline as a degraded mode. QuickPOS inverts that: the device is the source of truth in the moment, and the cloud is a place things catch up to. That single decision is why a dropped connection is a non-event instead of a disaster.

The four things that protect a sale

Sale vault

Every sale is written to a dedicated durable store before anything else, indexed by idempotency key and status — independent of the sync queue.

Critical journal

An append-only black box for stock-critical operations, so nothing is lost even if a sync attempt is interrupted mid-flight.

Idempotency keys

Each queued operation carries a key so retries can never double-charge or double-count.

Cashier-order replay

Stock events (restock, sale, refund, resale) replay one-by-one in the exact order they happened.

Three tiers of sync

When a path opens, the queue drains intelligently. On a shared network, one device can hold a host lease so branches sync locally over Wi-Fi, then that host forwards to the cloud. Inventory comes back as deltas — only changed rows, by row-version and watermark — so even a very large shop stays responsive.

  • Tier 1 — device queue: everything is safe locally first.
  • Tier 2 — LAN host: a lease-holding device syncs the branch over local Wi-Fi.
  • Tier 3 — cloud: the durable record of truth across all locations.

Conflicts, surfaced not swallowed

If two devices touch the same stock, QuickPOS doesn't silently pick a winner — it records the conflict on the Sync screen for a human to resolve. Duplicate sales that already reached the server are recognised and quietly closed, so a flaky connection doesn't create phantom transactions.

Grounded in the app: the sale vault, critical journal, idempotency keys, cashier-order replay, three-tier sync with a LAN host lease, inventory delta sync and conflict resolution are all implemented in the core sync engine and database layer.

Offline & Sync FAQ

What actually happens when the internet drops mid-sale?

The sale is already written to the local vault and queue before the receipt prints, so it completes normally. When a network path returns, it syncs automatically in order.

Can I run multiple tills without cloud internet?

Yes. On a shared Wi-Fi network one device can act as a LAN host, so tills sync to each other locally and the host forwards to the cloud when it can.

How does it avoid duplicate sales on retry?

Every operation carries an idempotency key. If a sale already reached the server, the retry is recognised as a duplicate and closed rather than re-inserted.

What if two devices edit the same product?

The conflict is surfaced on the Sync screen instead of being silently overwritten, so a person decides the correct result.