Sign in to keep reading
“Online Bookstore” is free with an account. Your progress and bookmarks follow you across devices.
Sign in to continueDesign a Online Bookstore - This system design covers fan-out architecture, seller API integration, request deduplication, and cost-efficient distributed lookups at scale.
Written by a Staff+ Engineer and an Engineering Manager
10+ years of experience in e-commerce infrastructure and distributed aggregation systems. Tech lead for fan-out architectures serving millions of product queries. Over 12 years of industry experience with 6 years in engineering leadership, building and scaling tech infrastructure teams that deliver end-to-end large-scale distributed systems.
“Online Bookstore” is free with an account. Your progress and bookmarks follow you across devices.
Sign in to continueWhat to Design?
Design a web service that helps customers purchase the cheapest available copy of a book from a network of online booksellers.
A customer submits a request including the book title, their shipping and payment details, and a maximum price they're willing to pay.
The service then queries multiple booksellers:
Use Case Assumptions
FR1 – Users should be able to submit a book purchase request with a maximum price limit
"As a user, I want to request a book by providing its name, my shipping and payment information, and a maximum price I'm willing to pay."
FR2 – Users should be able to retrieve a price resolution result (either success or lowest available price)
"As a user, I want to know whether the system found a seller within my budget — or at least what the lowest price available is."
FR3 – Users should be able to trigger an automatic purchase when the offer is acceptable
"As a user, I want the system to automatically purchase the book if the price is acceptable — without additional confirmation."
We rank this list of NFRs based on priorities tied to this specific design.
NFR1 – Efficiency – avoid unnecessary work and reduce cost per request
Think about:
Without adapters, we must embed seller-specific call logic directly into workers — making efficiency even more important.
NFR2 – Latency – p90 < 5 seconds
NFR3 – Idempotency – avoid duplicate charges or purchases
NFR4 – Scalability – up to 200 QPS, 20K seller calls/sec
Let's just suppose the scale assumptions below:
NFR5 – Reliability – tolerate partial failures and degraded seller availability
NFR6 – Observability – end-to-end traceability and real-time metrics
We rank Efficiency highest because the system's core value is to help users find a cheap price fast — and that means minimizing unnecessary work: exiting early, prioritizing high-value sellers, batching calls, and de-duplicating in-flight lookups. Latency is next, as timely responses drive user trust and satisfaction. Idempotency comes third because this system involves real purchases — without safeguards, retries could trigger double charges or duplicate orders. Scalability is essential to handle peak traffic and fan-out volume. Reliability ensures users still get useful results even when sellers fail. Observability, while operationally critical, has the least direct impact on the user experience and can be layered in post-MVP.
Requirement Summary
| Functional Requirements (FRs) | |
|---|---|
| Name | Description |
| 1. Submit Purchase Request | Users submit a book purchase request with a maximum price limit. |
| 2. Retrieve Price Resolution | Users retrieve a price resolution result (either success or lowest available price). |
| 3. Automatic Purchase | System automatically triggers purchase when the offer is acceptable. |
| Non-Functional Requirements (NFRs) | |
|---|---|
| Name | Description |
| 1. Efficiency | Avoid unnecessary work and reduce cost per request. |
| 2. Latency | p90 < 5 seconds response time. |
| 3. Idempotency | Avoid duplicate charges or purchases. |
| 4. Scalability | Up to 200 QPS, 20K seller calls/sec. |
| 5. Reliability | Tolerate partial failures and degraded seller availability. |
How to structure your High Level Design?
When presenting your High-Level Design, a clear and effective strategy is to go vertically, one Functional Requirement at a time — and walk through a working, end-to-end solution for each.
For every FR, answer:
This vertical approach keeps each requirement self-contained and actionable, making it easier to read, review, and debug. For documentation, you can co-locate entity and API definitions within each FR, or collect them in a single section at the beginning — both are valid depending on interview style or presentation format.
| 6. Observability |
| End-to-end traceability and real-time metrics. |