System design · The method: framework, arithmetic, APIs, data, storage, caching

The delivery framework, from entities to deep dives

Once the requirements and numbers are on the board, the rest of the round has a shape an interviewer can follow. This is that shape, step by step: the core entities, the interface, an optional data flow, a high-level design built one requirement at a time, and deep dives chosen from the non-functional targets rather than from whatever you know best.

18 min read Free to read Patterns: requirement-traceability, entities-before-tables, announced-deep-dive

What you'll be able to do

Before this: what-the-round-measures

The first lesson covered the opening five to eight minutes: agree the features, get the scale, turn adjectives into numbers. This lesson is about everything after that, because the point where most rounds go wrong is not the requirements. It is the moment a candidate stops talking about the problem and starts drawing boxes, with no visible link between the two.

An interviewer watching that happen has a specific worry. A diagram with a load balancer, a cache, a queue and three databases might be exactly right, but if nothing on the board says why each piece is there, they cannot tell a design from a memory of one. The framework below exists to make the link visible. Each step produces an artefact on the board, and each artefact is built from the one before it.

The shape of the round, after requirements

StepMinutes (of 45)What is on the board afterwards
Core entities2Four to six nouns, each with its identifier
Interface4 to 5One call per functional requirement, with inputs and outputs
Data flow (pipeline prompts only)3 to 5The stages data passes through, in order
High-level design10 to 15A diagram that satisfies every functional requirement, simply
Deep dives10 to 15Two or three non-functional requirements met with numbers
Wrap-up2 to 3What fails first, and what you would watch

The minutes are a guide, not a contract. What matters is the order, and the fact that the high-level design is finished, in a deliberately simple form, before any deep dive starts. A candidate who is still adding features to the diagram at minute 35 has spent the time that pays best on the work that pays least.

Core entities: nouns, not tables

Look at the functional requirements and pull out the things the system has to remember. That is the whole step. For a food delivery prompt it might be Restaurant, MenuItem, Order, Courier and Delivery. Write them as a list, give each one the identifier you expect to look it up by, and move on.

Two things to resist. The first is designing columns. You will learn which fields matter only when you write the interface, and you will learn the indexes only when you know the queries, so a full schema at this point is guesswork you will have to revise in front of the interviewer. The second is skipping the step because it feels obvious. It takes ninety seconds, and it is where you discover that "a delivery" and "an order" are two different things with two different lifetimes, which shapes half the design.

The interface: one call per requirement

Now write the calls the client makes. For most product prompts this is a handful of HTTP endpoints; for an infrastructure prompt it might be a library interface (put(key, value, ttl), acquire(lock_id, lease_ms)). The rule is one call per functional requirement, so the interviewer can tick them off.

For each call, write the method, the path, what goes in and what comes back. Use the entities from the last step as the nouns in your paths. Three habits make this step read as senior:

  • Take identity from the auth token, never from the body. POST /orders with the user id in the request body invites a client to place orders as someone else. Saying "the user comes from the session" costs four words.
  • Mark the calls that must be idempotent. Anything that creates or charges should accept an idempotency key, because the client will retry it on a timeout. The API design lesson later in this part covers this properly.
  • Paginate every list. A list endpoint without a cursor is an unbounded response waiting for the one account with forty thousand items.

The interface is also where you notice requirements you missed. If you cannot write a call that satisfies "users see their order status change live", the call you need is a push channel, not a GET, and you have just found your first deep dive.

Data flow, for prompts that are pipelines

Some prompts are not request and response at all. A web crawler, a metrics pipeline or a click aggregator is a sequence of stages that data moves through: fetch, parse, deduplicate, store; or ingest, aggregate, query. For those, a numbered list of stages is more useful than an endpoint list, because the interesting decisions are between the stages (what buffers them, what happens when one stage is slower than the one before it).

If the prompt has a user clicking things, skip this step. If it has data arriving and being transformed, do it, and write the stages left to right so the high-level design can follow the same order.

The high-level design, one requirement at a time

This is where candidates most often lose the thread, and the fix is mechanical. Take the interface, start with the first call, and draw only what that call needs. Then the second call, reusing what is already there and adding only what is missing. When every call is satisfied, stop.

Built this way, the first pass is usually small: a client, an API service, one database, maybe object storage. That is correct. You have not yet earned the cache, the queue or the shards, because nothing on the board says you need them. They arrive in the deep dives, attached to a number.

While you draw, say the data path out loud for each call: "The client sends the request, the service checks the token, reads the order row by id, and returns it." Narration does two jobs. It lets the interviewer follow without asking, and it exposes gaps, because you cannot narrate a read from a table you never wrote to.

A check you can run on your own diagram

The cell below is the traceability rule as a few lines of code. Each functional requirement lists the components it touches; each component should appear in at least one list, and each requirement should name at least one component. A box nobody uses and a requirement nothing serves are the two failures it catches, and both are easy to make at speed.

JavaScript
// Which requirement put each box on the board? A component nobody needs, or a
// requirement nothing serves, is a gap you want to find before the interviewer does.
const requirements = {
  "create shipment":      ["api", "shipments_db"],
  "carrier scan updates": ["ingest", "events_queue", "tracker", "shipments_db"],
  "customer views status":["api", "shipments_db", "status_cache"],
  "notify on delivery":   [],
};
const components = ["api", "shipments_db", "ingest", "events_queue",
                    "tracker", "status_cache", "search_index"];

const used = new Set(Object.values(requirements).flat());
const unjustified = components.filter((c) => !used.has(c));
const unserved = Object.keys(requirements).filter((r) => requirements[r].length === 0);

console.log("components with no requirement:", unjustified);
console.log("requirements with no component:", unserved);

Both findings are real. Nobody asked for search, so the search index goes. Notification was agreed and nothing delivers it, so the design is incomplete. You will not run code in the round, but you can run this check in your head in fifteen seconds by pointing at each box and naming its requirement.

Deep dives: chosen from the targets, announced by you

With the simple design on the board, look back at the non-functional requirements you wrote in the first eight minutes. Each one is a question the simple design probably does not yet answer: "p99 read under 100 ms at 40,000 reads a second", "no double booking", "survive the loss of a region". Pick the two or three that are hardest for this design and say which ones you are going to take, in what order.

How to choose:

  1. Start with the requirement the simple design visibly breaks. If your arithmetic says the write rate is ten times what one database can take, that is first, because everything else depends on where the data lives.
  2. Then the correctness requirement. Double charges, overselling, lost messages. These are where interviewers probe hardest, because a wrong answer is a production incident.
  3. Then the latency or availability requirement, usually a cache, a replica, a CDN or a precomputed view, each justified by a number.

The expected level shifts with seniority. A mid-level candidate who builds a sound simple design and handles one deep dive well when prompted is doing fine. A senior candidate is expected to pick the deep dives without prompting. A staff candidate is expected to say which one matters most to the business and to bring up an operational concern (migration, cost, on-call burden) that nobody asked about.

Worked example: a package-tracking service

The prompt: "Design a service that lets a retailer create shipments and lets customers track them, with updates from several carriers." Assume the requirements pass from the first lesson is done: customers see status within a minute of a carrier scan, 2 million shipments a day, each scanned about eight times, reads around 20 per shipment over its life, p99 read under 150 ms.

1Entities▾

Shipment (by shipment id, also by retailer order id), ScanEvent (by shipment id and time), Carrier (by carrier code), Subscription (who to notify, by shipment id). Status is not an entity: it is the latest scan, which tells you the read path will want it precomputed.

2Interface▾
  • POST /shipments with retailer order id, carrier code, carrier tracking number, and an idempotency key; returns a shipment id.
  • POST /carriers/{code}/events for carrier webhooks, authenticated per carrier, batched.
  • GET /shipments/{id} returning current status and the event timeline, paginated.
  • POST /shipments/{id}/subscriptions for email or push on delivery.

Writing the second call surfaced a fact worth saying: carriers send updates in batches and retry them, so the event endpoint must tolerate duplicates. That is a deep dive in waiting.

3High-level design, call by call▾

Call one needs an API service and a shipments table. Call two needs an ingest service that accepts carrier batches, writes events, and updates the shipment's current status; put a queue between ingest and the writer so a carrier's burst does not hit the database directly. Call three reads the shipment row and its recent events. Call four adds a subscriptions table and a notifier that consumes the same event stream and sends a message when status becomes "delivered". Four calls, six boxes, every one traceable.

4Pick and announce the deep dives▾

The numbers say 16 million scan events a day, about 185 a second on average and perhaps 1,500 at the evening peak when carriers flush their batches. Reads are roughly 460 a second on average. Neither is large, so this is not a scaling problem first. The announcement:

"Three things I'd like to go deeper on. First, duplicate and out-of-order carrier events, since carriers retry and a late 'in transit' must not overwrite 'delivered'. Second, the read path for the status page, which I'd serve from a precomputed status row rather than sorting events. Third, what happens when a carrier's webhook goes quiet, because customers will notice before we do."

Each one names a requirement, and none of them is "add Kafka". That is the shape the interviewer is listening for.

The checklist

  1. Entities listed with their identifiers, and no columns yet.
  2. One interface call per functional requirement, with identity from the token, idempotency keys on creates, and a cursor on every list.
  3. Data flow written as ordered stages, only if the prompt is a pipeline.
  4. A high-level design built call by call, narrated as data paths, with no box you cannot trace to a requirement.
  5. Two or three deep dives picked from the non-functional requirements, announced in order, each tied to a number.
  6. Two minutes kept for what fails first and what you would alert on.