Cafe / Restaurant Management System (FOH + BOH)

Deep modeling of a cafe/restaurant domain using Domain-Driven Design, Event Storming, CQRS, and Event Sourcing. Focus on Front-of-House (FOH) and Back-of-House (BOH) workflows: orders, tabs, kitchen, bar, service, and payments. No JavaScript; semantic HTML only.

Overview

This example models a cafe/restaurant where customers sit at tables, browse a menu, and receive food and drinks. FOH handles orders, service, and payments; BOH handles kitchen and bar preparation, inventory, and reporting. The system uses commands, events, and projections to coordinate complex workflows.

Domain Model (Key Building Blocks)

  • Aggregates: Tab, Order
  • Entities: Customer, Server, Table, MenuItem, Dish, Drink, KitchenTicket, Payment
  • Value Objects: Location, TimeSlot, Price, Currency
  • Domain Events: TabOpened, TableSeated, OrderPlaced, ItemAddedToOrder, OrderPrepared, DishReady, DishServed, PaymentProcessed, TabClosed

Commands

  • OpenTab
  • SeatCustomer
  • PlaceOrder
  • AddItemToOrder
  • StartPreparation
  • CompletePreparation
  • ServeItem
  • CloseTab
  • ProcessPayment

Domain Events

  • TabOpened
  • TableSeated
  • OrderPlaced
  • ItemAddedToOrder
  • OrderPrepared
  • DishReady
  • DishServed
  • PaymentProcessed
  • TabClosed

Read Models & Projections

  • CurrentTabView
  • OpenOrders
  • KitchenQueue
  • TableStatus
  • RevenueByDay

Lifecycle Walkthrough

  1. Guest is seated and opens a tab (OpenTab, SeatCustomer).
  2. Server places initial drink/appetizer orders (PlaceOrder, AddItemToOrder).
  3. BOH starts preparation; KitchenTicket and DishReady events drive status updates.
  4. Food arrives; server serves items (DishServed) and updates tab/bill.
  5. Guest pays; TabClosed and PaymentProcessed events finalize the lifecycle.

Examples & Data Payloads

Conceptual payloads for orders and payments:


// OpenTab
{
  "tabId": "tab_001",
  "tableId": 12,
  "customerId": "cust_745",
  "openedAt": "2026-04-30T12:00:00Z"
}
// PlaceOrder
{
  "tabId": "tab_001",
  "orderId": "order_1001",
  "items": [ {"menuItemId": "m_espresso", "quantity": 2}, {"menuItemId": "m_bagel", "quantity": 1} ],
  "placedAt": "2026-04-30T12:02:00Z"
}
// PaymentProcessed
{
  "tabId": "tab_001",
  "amount": 15.75,
  "currency": "USD",
  "method": "CreditCard",
  "paidAt": "2026-04-30T12:35:00Z"
}

Diagram & Illustration

Cafe/Restaurant operations flow diagram
FOH vs BOH flow: seating, ordering, kitchen, bar, service, and payment.