End-to-End White-Label Restaurant Platform with FastAPI & React
Self-hosted restaurant platform with transactional menu, reservations, live KDS board, payments, and ARCA e-invoicing in FastAPI, React 18, and MySQL 8: 678 tests, 76.72 KB gzip, and 0 WCAG 2.2 AA violations.

Problem
Independent restaurants (bistros, steakhouses, and neighborhood eateries with distinct identities) often rely on fragmented workflows that erode margins and brand consistency:
- Static PDF or Instagram menus that cannot be filtered by diet or allergens and drift out of sync whenever the kitchen runs out of stock.
- WhatsApp or phone reservations and orders lacking real shift-capacity tracking or automatic overnight service window support (e.g., 19:30 to 01:30).
- Marketplace dependency, charging steep commissions while owning the diner relationship and customer data.
- Disconnected operations: kitchens without live order boards, manual payments, and ARCA electronic tax invoicing handled outside the checkout flow.
Product North Star: enable an independent restaurant to move from a static PDF menu to operating its own transactional digital menu—complete with reservations, pickup orders, live kitchen KDS, online payments, and electronic invoicing—in under a day of onboarding, under its own brand and with zero order commissions.
Architecture and decisions
Rather than over-engineering with microservices or mandatory message brokers, the backend was architected as a Modular Monolith in Python 3.13, FastAPI, SQLAlchemy 2.0, Alembic, and MySQL 8 (InnoDB) enforcing four strict layers (domain, application, infrastructure, interfaces) verified automatically via architectural tests under Spec-Anchored SDD (8 living specs with blocking gates). The client is a React 18, strict TypeScript, Vite 6, and Tailwind CSS SPA featuring a custom white-label Design System with 3 live-switchable themes.
Monetary integrity, ARCA e-invoicing & domain security
- Exact cent-integer accounting & Ley 27.743: every monetary amount is persisted as exact integer cents (
BIGINT). Argentine VAT breakdowns (Invoice A vs. Invoice B/C tax transparency) are computed exclusively withDecimal (ROUND_HALF_UP)without altering customer-facing menu totals. Orders and invoices preserve immutable snapshots, use soft archiving (archived_at), and feed an append-only ledger with a deterministic financial reconciliation engine. - Frictionless guest access & hardened staff controls: guests track or cancel bookings/orders via a 256-bit opaque
access_tokenstored strictly as a SHA-256 (CHAR(64)) hash in MySQL, captured in memory and stripped immediately viahistory.replaceStatewhile API responses mask PII. Staff and management use opaque server sessions with Argon2id,HttpOnlycookies, session-derived CSRF tokens, branch-scoped RBAC, and mandatory TOTP 2FA formanagerandownerroles. - Native MySQL 8 Transactional Outbox: domain events (
order.created,order.status_changed, notifications, reconciliation) commit inside the same ACID transaction and are processed by workers usingSELECT ... FOR UPDATE SKIP LOCKED, eliminating Redis and Celery overhead for single-tenant deployments. - Food safety as a domain invariant: the system never infers allergens from free-text dish names; dietary tags come from a controlled vocabulary and declaring a dish allergen-free requires an explicit
confirmed_freecheck across UI and backend.
-- Lock-free concurrent event claiming on the MySQL 8 InnoDB Transactional Outbox
SELECT id, event_type, payload
FROM outbox_events
WHERE processed_at IS NULL
ORDER BY id ASC
LIMIT 50
FOR UPDATE SKIP LOCKED;
3-Wave UX/UI redesign & strict web budget (< 80 KB gzip)
- Wave 1 — Diner Storefront (
/): warm hospitality Editorial Porteño aesthetic (>= 4.5:1 contrast) across 3 live white-label themes, diet/allergen filters, inline- N +cart steppers,localStoragecart persistence, inline-validated checkout, and 4-stage live order tracking refreshing every 15 seconds. - Wave 2 — Live Kitchen & Floor Console (
/operacion): full-screen 3-column KDS board with visibility-aware polling, SLA indicators, high-contrast Dark Kitchen Mode, and a PII-free Offline Degraded Mode (15-minute TTL), paired with 1-click “86” Quick Stock toggles and shift reservation table assignment. - Wave 3 — Owner & Manager Backoffice (
/operacion): dish editor with optimistic concurrency (expected_version), overnight-aware promotions, rush-hour pickup pauses, CSV menu exports, and a Cash & Finance workspace with ARCA credit notes, CAE/QR fiscal receipts, and owner-only deterministic reconciliation. - Strict performance budget: isolating
/from/operacionwithReact.lazykept the initial public payload at 76.72 KB gzipped (3.28 KBunder the80.00 KBceiling), loading backoffice modules on demand at2.15 KB–10.11 KBgzip.
Challenges
Running unmocked E2E suites against real Chromium and MySQL 8 surfaced subtle regressions invisible to isolated unit tests:
- Transient WCAG contrast dip on toggle buttons: switching button states between
outlineandprimary(#FFFFFF/#7C1D2E) over a 150 ms CSS transition briefly crossed a ~1.2:1 intermediate color, trippingaxe-coreimmediately after clicks. Applyingtransition-noneon toggle tabs and filters resolved the accessibility failure and made interactions feel instant. - Domain-to-UI enum mismatch: running full-stack financial reconciliation E2E tests against real MySQL 8 revealed that the domain serialized
status: "matched"andentry_type: "payment_received"(instead of"BALANCED"/"payment"), enabling alignment of reconciliation indicators and ledger KPIs prior to release. - Icon code-splitting leak: forcing
lucide-reactinto a shared manual chunk pulled admin and finance icons into the public storefront bundle; letting Rollup split icons per lazy chunk recovered over 3 KB gzip on/.
Outcomes
Every milestone passed blocking CI gates against real MySQL 8 and headless Chromium:
- 678 automated tests passing (100%): 477 backend
pytestspecs (architecture, unit, integration, HTTP contracts), 192 frontendVitestspecs (22 suites with Testing Library andaxe-core), and 9 full-stackPlaywrightChromium E2E flows. - Certified accessibility & responsive stability: 0 WCAG 2.2 AA violations across the public menu, light/dark/offline KDS, and backoffice; 0 px horizontal overflow verified at
320px,768px, and1280px. - Verified code & supply-chain rigor: 76.72 KB gzipped public load (
check_frontend_budget.py),0errors acrossmypy --strict(318 files),ruff,tsc --noEmit, andeslint, plus automated supply-chain auditing with a frozenuv.lock.
A full walkthrough of all three roles (Diner, Kitchen KDS, and Owner 2FA backoffice) is available via the Video demo link in the header and sidebar. Proprietary codebase reserved for commercial white-label licensing.