Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Pizza Chain Ordering and Delivery System

Let customers order pizza online from the store that serves their address, pay once, and follow the order until a store driver delivers it.

Problem statement

Design the online ordering and delivery system for a pizza chain.

For this exercise, assume one chain runs about 2,000 stores in a single country. Each store has its own kitchen and its own delivery drivers, and every delivery address belongs to exactly one store's delivery area.

Customers create an account and sign in, enter a delivery address, see that store's menu and prices, place and pay for an order, and follow it while the store prepares and bakes it and a driver delivers it. Store staff and drivers update the order's status from the store screen and a phone app.

For this exercise, also assume a sign-in session ends after 30 minutes without activity and never lasts longer than 7 days. Card payments go through an external payment provider that returns a payment token, so the system never stores card numbers. A retried order request must not create or charge a second order.

Start with a basic working design. Then be ready to discuss how the order database grows, how caching keeps reads fast, how sessions expire, and how the system copes with a burst of orders. Route planning for drivers, driver hiring and pay, coupons, loyalty points, and store inventory are out of scope.

What to build

  1. Customers create an account and sign in; a session ends after 30 minutes without activity and after at most 7 days.
  2. Given a delivery address, the customer sees the menu and prices of the one store that delivers there.
  3. The customer places and pays for an order and gets one order number, even if the request is retried.
  4. Store staff and the driver move the order through received, preparing, baking, out for delivery, and delivered, and the customer sees the current status.

At scale

  • For this exercise, assume about 1 million orders a day, about 100 orders per second at the evening peak, and short bursts of about 500 per second during big events.
  • For this exercise, assume menu reads are about 20 times order writes, about 2,000 per second at the evening peak, and menu pages load within 300 ms at p95.
  • For this exercise, assume a status change reaches the customer's screen within about 10 seconds while the order page is open.
  • For this exercise, assume orders are kept for 2 years: about 730 million orders, roughly 1.5 TB with indexes.