Online Bookseller Platform
Design a single-retailer bookstore that serves catalog discovery and converts carts into correctly reserved physical-book orders.
Problem statement
For this exercise, assume a single online bookseller owns a catalog of physical books and inventory; third-party sellers are outside scope. Customers can search and browse books, inspect current availability, maintain a cart, and place an order using an external payment processor.
Checkout must reserve inventory before confirming the order, client and processor retries must converge on one outcome, and confirmed items must not be oversold. Search and browse availability may lag authoritative inventory, but checkout must validate current stock.
Orders expose placed, payment-pending, confirmed, cancelled, and shipped states. Assume 10 million titles, one million daily active customers, peaks of 5,000 searches and 500 checkout attempts per second, 300 ms p95 search latency, and 1 second p95 checkout-command latency excluding asynchronous processor completion.
Design catalog ingestion, search, cart, inventory, ordering, payment coordination, and recovery. Recommendations, ebooks, third-party marketplace sellers, returns, warehouse routing, and carrier optimization are outside scope.
What to build
- Customers can search and browse physical books and inspect descriptive metadata plus approximate availability.
- Customers can add, update, and remove catalog items in a persistent cart without reserving inventory.
- Customers can idempotently submit a cart for checkout, reserve available inventory, and observe one authoritative order and payment outcome.
- Customers can retrieve an order's durable state through confirmation, cancellation, and shipment.
At scale
- For this exercise, assume 10 million physical-book titles and one million daily active customers.
- For this exercise, support peaks of 5,000 catalog searches and 500 checkout attempts per second.
- For this exercise, target 300 milliseconds p95 for search and one second p95 for an accepted checkout command, excluding asynchronous processor completion.
- For this exercise, search availability may lag authoritative inventory by up to one minute, but confirmed orders must never oversell stock.