Design a backend system for a food ordering + delivery platform (like a marketplace that connects customers, restaurants, and delivery couriers).
Core user flows
-
Customer:
-
Browse/search restaurants and menus
-
Add items to cart, place an order, pay
-
Track order status (prep, picked up, arriving)
-
Restaurant:
-
Receive order, accept/reject, update prep status
-
Courier:
-
Receive delivery offers, accept, pickup, deliver
Requirements
Functional
-
Restaurant/menu discovery (basic search/filter is enough)
-
Order creation and payment intent
-
Reliable order state machine (created → accepted → preparing → ready → picked_up → delivered/cancelled)
-
Dispatch: assign courier to an order
-
Real-time-ish tracking and status updates to customer
Non-functional
-
High availability (avoid single points of failure)
-
Consistent order state (no double-deliver, no lost orders)
-
Handle peak traffic (lunch/dinner bursts)
-
Observability: metrics, logs, tracing
Deliverables
-
APIs (high level)
-
Data model (high level)
-
Architecture and major components
-
Approach to scaling, reliability, and failure handling (explicitly call out single points of failure)
-
Consistency model choices and trade-offs