Personal product · Early partner

CravingsPH: correctness under concurrent restaurant work

CravingsPH connects public restaurant discovery with table sessions, linked orders, staff operations, and kiosk workflows. I designed and built the product end to end, with explicit lifecycle, payment, and fulfillment state regions; command deduplication and row locking for concurrent writes; deterministic multi-order settlement; realtime reconciliation; and scoped device trust.

An early-partner personal product whose implemented restaurant workflows and correctness boundaries are reviewed here without implying broad adoption or measured production volume.

Visit CravingsPHLast reviewed

Project snapshot

Classification
Personal product
Status
Early partner
Period
Ongoing
Role
Product owner and engineer
Platforms
Next.js web product, restaurant operations, realtime floor, and kiosk

Evidence at a glance

Constraints

  • Guests and multiple staff members can act on the same table session and related orders at nearly the same time.
  • Lifecycle, payment, and fulfillment progress independently but must never combine into an invalid business state.
  • Realtime screens are projections of committed state and must recover after missed or repeated events.
  • Shared kiosk devices need bounded trust rather than reusable full-user credentials.

Attributable ownership

Designed and built the discovery, restaurant, table-session, order, realtime floor, persistence, and kiosk boundaries as one product system.

Consequential decisions

  • Modeled lifecycle, payment, and fulfillment as three named state regions with cross-region guards.
  • Required command IDs, deterministic row-lock ordering, and deduplication around concurrent session and order mutations.
  • Reconciled committed realtime events into query caches instead of treating an event as the source of truth.
  • Used short-lived pairing and restaurant-scoped device trust for kiosk access.

Reliability and correctness

  • Transactional commands lock affected rows in deterministic order and can return benign conflicts when another actor already applied the intended result.
  • Multi-order settlement validates the whole set before committing one consistent result.
  • Realtime floor events trigger cache reconciliation against persisted state so missed or repeated events do not define correctness.
  • Kiosk sessions are scoped to a paired restaurant device rather than inheriting unrestricted account authority.

Observable evidence

The reviewed implementation covers the end-to-end restaurant and user workflows, state model, transactional command boundary, realtime floor behavior, and secure kiosk pairing used in the early-partner product.

01

Why is restaurant work a concurrency problem?

A table session can connect guests, several staff members, multiple orders, payment progress, kitchen work, and a shared floor view. Those actors do not wait politely for one another, so a superficially simple status change can race with settlement, cancellation, or fulfillment work.

CravingsPH joins public restaurant and menu discovery to the operational path after a guest arrives: opening a table session, creating linked orders, moving work through preparation and service, settling one or several orders, and keeping the floor view current.

02

What did I own?

I designed and built the product across public discovery, restaurant administration, table sessions, orders, transactional persistence, realtime floor behavior, and kiosk access. That end-to-end boundary made product states and correctness rules part of the same design rather than separate frontend and backend concerns.

03

Why use three coordinated state regions?

Lifecycle, payment, and fulfillment answer different questions. A session can remain open while one order is served and another is preparing; payment can be partial without rewriting fulfillment history. Modeling those concerns as named regions preserves their independence while cross-region guards reject combinations the restaurant should never see.

  • Lifecycle records whether the session or order remains actionable
  • Payment records unpaid, partial, settled, or reversed progress
  • Fulfillment records queued, preparing, ready, and served work
  • Guards validate the combined state before a command commits
04

How do simultaneous commands remain safe?

Every mutation carries a command identifier, validates current state, and locks affected rows in deterministic order inside a transaction. Repeated commands can be recognized, while competing actions either produce one consistent result or a benign conflict that tells the caller the intended transition was already resolved elsewhere.

Multi-order settlement validates the complete set before changing any member. This avoids a half-settled table when one linked order fails a rule and makes the user-facing result explainable: the operation commits together, retries safely, or returns a conflict without silently losing work.

Concurrent work resolves to one trusted state

A guarded command commits coordinated restaurant state before realtime screens reconcile.

  1. 01Scoped command
  2. 02Concurrency gate
  3. 03Coordinated state regions
  4. 04Post-commit reconciliation
Inspect stage details
Scoped command
A staff, guest, or kiosk action includes a command ID.
Concurrency gate
Deduplication, validation, and deterministic row locking.
Coordinated state regions
Lifecycle, payment, and fulfillment commit with cross-region guards.
Post-commit reconciliation
Committed events refresh floor and query-cache views.
05

What role does realtime play?

Realtime events make committed restaurant changes visible quickly, but they are not the authority for correctness. Floor and order screens reconcile their caches against persisted state after relevant events, so a missed, delayed, or repeated message does not become the business record.

06

How is a shared kiosk bounded?

A kiosk is paired through a short-lived flow and receives restaurant-scoped device trust. The device can perform the narrow guest-facing work it needs without storing or inheriting an unrestricted staff account session.

07

What does the reviewed product demonstrate?

The early-partner implementation demonstrates transaction and workflow design across the restaurant journey: explicit state, deterministic mutation boundaries, recoverable realtime projections, and scoped kiosk authority.

It does not yet establish broad adoption, production transaction scale, active payment settlement, universal POS replacement, or commercial success. Those outcomes require separate operational evidence and remain outside this case study.

Limitations and next steps

Honest limitations

  • Early-partner status does not establish broad adoption, verified production transaction volume, active payment settlement, or commercial outcome.
  • CravingsPH is not presented as a universal replacement for every restaurant POS or operating process.
  • Architecture depth describes implemented behavior; scale and outcome claims remain withheld until measured from reviewable production evidence.

Next evidence to establish

  • Instrument command conflict, retry, settlement, and reconciliation behavior before publishing operational metrics.
  • Validate partner workflows and kiosk recovery under representative staff concurrency.
  • Publish payment or commercial claims only after the relevant integrations and measurements are active and independently reviewable.

Verified technology

Next.js 16 · React 19 · TypeScript · XState · tRPC · PostgreSQL · Supabase Realtime · Zod