Offline-first POS, part 2: never store a stock level
The schema decision that makes offline sync work: store append-only stock movements and derive the level, so two tills syncing in either order reach the same answer.
Engineering, backend APIs, full-stack apps, and applied AI.
Multi-part build-alongs — complete systems, start to finish.
The schema decision that makes offline sync work: store append-only stock movements and derive the level, so two tills syncing in either order reach the same answer.
Accepting a batch that contains sales you already have, per-sale transactions so one bad record cannot poison a batch, and what to do when two tills sold the same last item.
Most POS demos assume a working connection. Real shops do not have one. The architecture that keeps a till selling through an outage — and why offline-first is an ordering decision, not a feature.
Writing a sale to IndexedDB, printing a receipt with no server, and an outbox that survives a browser crash mid-sale — plus why the stock number should say '~12'.