One stock position across outlets that each kept their own books
A multi-outlet retailer, Sri Lanka
ENGAGEMENT
- PARTNER
- A multi-outlet retailer, Sri Lanka
- SECTOR
- Retail
- TYPE
- Product build
- STATUS
- In progress
- DURATION
- In progress
SEC.01 — PROBLEM
Where they were
Each outlet ran its till as an island. Stock counts drifted between locations, price changes had to be repeated by hand at every site, and tax treatment was worked out per invoice. Producing a consolidated position at month end meant reassembling numbers by hand from several sources, and any disagreement between them had to be settled by argument.
SEC.02 — APPROACH
What we are doing
We are building a single domain model covering outlets, terminals, stock movements and tax, with the integrity rules held in the database so no client can write an inconsistent state. Stock is an append-only ledger of movements rather than a mutable quantity, making every position derivable and explainable. Tax is modelled as effective-dated rules applied at line-item level, so a rate change becomes a data change rather than a release.
SEC.03 — ARCHITECTURE
The decisions carrying it
NOTE.01
Append-only stock ledger, so a position can always be reconstructed and explained
NOTE.02
Effective-dated tax rules covering VAT and SSCL treatment, leaving historical invoices computing as issued
NOTE.03
Idempotency keys on offline sales, letting a till retry aggressively without double-posting
NOTE.04
Reporting served from a separate projection so month-end queries cannot slow a queue at the till
Stack
- TypeScript
- Next.js
- PostgreSQL
- Prisma
SEC.04 — OUTCOMES
What it is being built to do
This build is still in progress. These are the outcomes it is being built to deliver, not results we are claiming.
A consolidated stock position derivable without manual reassembly
Price changes applied once and propagated to every outlet
Tax rate changes handled as data, without a code release
Have a problem shaped like this?
Tell us where you are now and what has to be true when it works.