Possier is a restaurant POS/ERP vendor serving 200+ Indian clients. I architected the ground-up rebuild of its POS as a multi-tenant system: a pnpm + Turborepo monorepo, a NestJS API, and a Drizzle + PostgreSQL schema modeling org → brand → store across 26 tables spanning tenancy, RBAC, catalog, inventory, sales, and CRM.
Offline-first couldn't be an afterthought, so I baked sync into the schema layer — UUID primary keys so disconnected registers mint IDs without collision, timezone-aware timestamps for conflict resolution, and organization_id scoping on every business row. Checkout runs as one transaction that re-validates tenant ownership, prices in integer minor units to kill float drift, and writes order, lines, and payments atomically. Earlier, inside the company's legacy ERP, I shipped B2B invoice-editing, payment-terms, and top-selling-report features in a 4,336-line controller.
The hard part
Offline-first multi-tenancy, modeled into the schema
A POS for many brands and stores can't bolt on tenancy — or offline support — later. I modeled both into the schema from the first migration: org → brand → store scoping on every row, UUID primary keys so a disconnected register can mint IDs without collision, and timezone-aware timestamps for conflict resolution. Checkout runs as one atomic transaction that re-validates tenant ownership and prices in integer minor units, and desktop sync is specced as a SQLite outbox that push/pulls over the same ts-rest/Zod contract the cloud client uses.
Highlights
- Architected the multi-tenant POS rebuild: pnpm + Turborepo, NestJS, Drizzle + PostgreSQL (org → brand → store), 26 tables across 6 domains.
- Baked offline sync into the schema — UUID keys, timezone-aware timestamps, org-scoped rows — with a Tauri 2 + SQLite outbox push/pull plan over a shared ts-rest/Zod contract.
- Built checkout as one atomic transaction: re-validates tenant ownership, prices in integer minor units, computes multi-tender sufficiency, writes order/lines/payments together.
- Shipped B2B invoice-editing, payment-terms, and top-selling-report features inside a 4,336-line controller in the legacy production ERP.
- Served a vendor with 200+ restaurant clients across its POS and ERP products.
Stack