Point of sale

Offline till (in progress)

An Electron desktop till that sells through network outages. It's on unmerged branches, with a matching API PR. Nothing on this page is on master yet.


Unmerged

POS branches: origin/electron-offline-pos-app (2026-09-24) and origin/feat/offline-first-till (2026-09-30, about 10k lines) built on top of it. API: PR #82 feat/offline-first-till and PR #78 feat/pos-catalogue-sync. Both need a newer contracts-pos.

Shape

  • Electron 44 app Totlob POS (com.totlob.pos), packaged with electron-builder as .dmg, .exe and .AppImage. It serves itself from totlob://till.
  • SQLite (better-sqlite3) file till.db holds a catalogue snapshot.
  • Local-first reads, even online: the grid, search, categories, sections and scanner all read locally. Only live stock and today's automatic discounts are fetched (syncCatalog, getLiveFigures).

One policy table

src/offline/policy.ts decides every endpoint's behaviour without the network:

PolicyEndpoints
cacheEvery read
queueExactly two writes: create-order and open-shift
refuseEverything else

The branch's ADR is docs/adr/0002-the-till-sells-offline-and-refuses-the-rest.md.

Offline sales

  1. The till gives the server 2.5 s.
  2. With no answer, it completes the sale locally and prints a local number (e.g. K7Q-000184).
  3. The sale is queued in the outbox with an offline block.

Outbox rules

  • Entries are drained in order, with retry backoff.
  • Each entry belongs to the user who made it.
  • Sign-out waits for the outbox to empty, and cashing up waits for an empty queue.

UI

  • LinkBadge.tsx: the connection status on the nav rail
  • SyncDialog.tsx: the Sync queue screen, with Sync now and progress

Offline controls

  • Discount approval offline: approver PIN hashes are stored in the OS keystore and checked locally, with the server's lockout mirrored.
  • Discount caps per sale and per drawer limit exposure while offline.
  • A local customer directory allows lookups offline.
  • feat/browse-pos-without-drawer: abandoned in favour of always requiring a drawer.
  • feat/pos-category-tree-lines: connector lines in the category pane.
Previous
Selling & drawer flows