Fault-Tolerant Multi-Tenant POS, Kitchen Display System & Cryptographic Financial Ledger Architecture
A mission-critical, enterprise gastronomic transaction kernel engineered with zero-float integer monetary invariants, offline-first deterministic queue synchronization, First-Expired First-Out (FEFO) inventory matrices, and cryptographically auditable blind cash register closures.
Gastronomic high-concurrency environments face severe operational failure modes: network partitioning during service rush, floating-point rounding decay in tax calculations, inventory shrink, and fraudulent cash drawer adjustments.
RESTOai (orchestrated on the Kobe Gastronomic Engine) solves these challenges through a mathematically rigorous transactional architecture:
-
Zero-Float Financial Arithmetic: All currency and tax calculations are strictly represented as 64-bit integer cents (
$\mathbb{Z}$ ), mathematically eliminating IEEE 754 precision anomalies. - Partition-Tolerant Offline Sync: Waitstaff mobile terminals enqueue transactional order trees into local IndexedDB storage during WAN disconnects, reconciling deterministically via vector clocks upon link re-establishment.
- Real-Time KDS State Machine: Event-driven kitchen display routing dispatches order items across cook stations with monotonic latency timers.
┌────────────────────────────────────────────────────────────────────────┐
│ FLOOR & POS TERMINAL INGESTION │
│ [Mobile POS / Tablet] ──► [Optimistic Local Queue] ──► [WAN Gateway] │
└──────────────────────────────────┬─────────────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────────────────────┐
│ KOBE CORE TRANSACTIONAL KERNEL │
│ • Integer Financial Arithmetic: `AmountCents = round(p * 100)` │
│ • Inventory Matrix: FEFO Batch Allocation & Dynamic Shrink Telemetry│
│ • Blind "Z" Drawer Reconciliation: Audit log with Supervisor Hash │
└──────────────────────────────────┬─────────────────────────────────────┘
│
┌─────────────────────────┴─────────────────────────┐
▼ ▼
┌──────────────────────────────────┐ ┌──────────────────────────────────┐
│ KITCHEN DISPLAY (KDS) │ │ LEDGER & FISCAL RECONCILIATION│
│ Station Partitioned Work queues│ │ Double-Entry Transaction Trail │
│ Monotonic Sauté/Grill Timers │ │ Auditable Cryptographic Proofs │
└──────────────────────────────────┘ └──────────────────────────────────┘
To prevent compounding rounding inaccuracies in compound sales tax and multi-item discounts, float primitives (number) are forbidden within the domain layer:
vitest unit invariants verifying parity down to the individual cent.
Inventory consumption is governed by batch-level decay schedules:
Cashiers perform register closures under zero-information conditions:
- The operator inputs physical cash counts without system-prompted expected totals.
- Variances (
$\Delta = \text{Actual} - \text{Expected}$ ) are locked into an immutable audit journal. - Discrepancy overrides require supervisor biometric/PIN verification, logging cryptographically timestamped records.
| Layer | Technology | Specification / Architectural Utility |
|---|---|---|
| Monorepo Engine | NPM Workspaces | Encapsulated packages (@kobe/domain, @kobe/db, @kobe/api) |
| Backend Runtime | Node.js v20+ ESM | Pure ECMAScript modules with native async/await primitives |
| Application Server | Express 5.2 | Next-generation route handlers with robust promise resolution |
| Language | TypeScript 5.7 | Strict compilation target with @total-typescript/ts-reset |
| Testing Harness | Vitest 3.0 | 67 comprehensive unit & transactional integration test suites |
RESTOia/
├── packages/
│ ├── domain/ # Core business rules, entities & monetary invariants
│ ├── db/ # Relational schemas, migrations & repository models
│ └── api/ # HTTP route controllers, middlewares & schemas
├── server/
│ └── index.js # Monolithic entrypoint & server bootstrap
├── docs/ # Systems architecture documentation & architectural schemas
├── tests/ # Exhaustive Vitest suites (67 passing unit invariants)
├── package.json # Multi-workspace monorepo root manifest
└── tsconfig.json # Base TypeScript configuration
-
Node.js:
$\ge 20.0.0$ LTS -
NPM:
$\ge 10.x$
# Clone the repository
git clone https://github.com/ExeDevCentral/RESTOai.git
cd RESTOai
# Install dependencies across all workspace packages
npm install
# Build internal packages
npm run build# Execute full Vitest suite (67 unit tests covering invariants, KDS, & finance)
npm test
# Run static typecheck across all workspaces
npm run typechecknpm startThe transactional gateway initializes at http://localhost:3000.
- Health Endpoint:
GET /api/healthreturns service status,uptimeSeconds, and UTC timestamp. - Verification Commands:
npm run typecheck
npm testLatest verified suite: 42 test files passed (108 tests passed).
- Minimalist Mobile Bottom Dock: Thumb-zone 5-action dock (
Salón,Cocina,+ Comanda,Caja,IA) dynamically synchronized with the 10-level RBAC matrix, compact header bar, and104pxsafe bottom clearance so no floating controls ever overlap active table cards or tickets.
Distributed under the MIT License. Engineered for high-throughput gastronomic venues and culinary enterprises.