Cafe / Restaurant Scenario
A scenario exploring frontend (FOH) and backend (BOH) workflows using DDD, CQRS, and Event Sourcing.
Context
Customer visits cafe, sits at a table, orders drinks and food, kitchen/back-of-house fulfills the order, and payment is processed. The model tracks tabs, orders, kitchen tickets, and payments.
Building Blocks
- Aggregates: Tab, Order
- Entities: Customer, Server, Table, MenuItem, Dish, Drink, KitchenTicket, Payment
- Domain Events: TabOpened, TableSeated, OrderPlaced, ItemAddedToOrder, OrderPrepared, DishReady, DishServed, PaymentProcessed, TabClosed
- Commands: OpenTab, SeatCustomer, PlaceOrder, AddItemToOrder, StartPreparation, EndPreparation, ServeItem, CloseTab, ProcessPayment
Lifecycle
- Open a tab for a table.
- Place drinks and meals on the order.
- BOH starts preparation; orders progress to ready.
- FOH serves dishes; customer finishes tabs and pays.
- Tab closes; revenue recorded.
Policy Examples
- Wait-time SLA: if ETA > 15 minutes, trigger table offer for refills or alternative items.
- Over-queue policy for kitchen: cap concurrent orders per station.