System Design: Coffee Ordering System
Design a system for a coffee shop (or chain) that supports ordering drinks.
Core use cases
-
Customer browses menu and places an order (pickup or in-store).
-
Customer customizes items (size, milk type, add-ons) and sets quantity.
-
System calculates total price (including tax/discounts).
-
Payment can be processed (or order marked as pay-at-store).
-
Baristas see a
queue
of incoming orders and update status:
PLACED → PAID (optional) → IN_PROGRESS → READY → COMPLETED/CANCELLED
.
-
Customer can see order status updates.
Constraints / scale (assume)
-
Start with one store, then extend to many stores.
-
Peak: thousands of orders/min across all stores.
-
Status updates should feel near-real-time to customers.
What to cover
-
APIs (or events) for placing orders and status updates.
-
Data model for menu, orders, payments.
-
High-level architecture and major services.
-
Consistency, idempotency, and failure handling (e.g., retries, duplicate submits).
-
How you would scale to many stores.