Skip to content

Offline sync

Mobile is offline-first. The server remains the source of truth. Clients keep a local SQLite/Drift cache for reads and a write outbox for offline work, then converge with pull and push.

Goals

  • Keep working through long disconnects without silently losing data.
  • Detect conflicts with row versions and server timestamps.
  • Propagate soft deletes as tombstones.
  • Keep posted financial/stock documents immutable — corrections use amend, cancel, reverse, or adjustment flows.

Endpoints

MethodPathPurpose
GET/v1/sync/manifestEntity sync capabilities
GET/v1/sync/pull?since=<cursor>Paginated changes since cursor
POST/v1/sync/pushUpload buffered local mutations
POST/v1/sync/resetRebuild local cache from server

Business-scoped variants exist under /v1/businesses/:business_id/sync/....

How it works

  1. Every business resource has a sync_version bumped on every update (including soft delete).
  2. Pull uses a stable opaque cursor (base64url JSON over (updated_at, id)).
  3. Push applies a batch of local mutations; conflicts surface deterministically.
  4. POS sales use an idempotent client_sale_id so retries after reconnect are safe.

Operator tips

  • Leave the Windows cashier tray process running so background sync can drain the outbox.
  • After a device reset, run sync pull before taking payments.
  • Never “edit” a posted invoice in place — use credit notes / reverse / adjust.

Documentation for Tadbeer operators, developers, and implementation partners.