The delivery framework: five phases and a clock

Requirements, entities, API, a working design, deep dives. Time budgets per level, a whiteboard that fills in, and how to pick deep dives.

Related chapters

Keep learning

Overview

1 Requirements 2 Core entities 3 API 4 High-level design 5 Deep dives Deep dives Your Qs = acc && t Two or more phases behind. Say so, cut scope (“I will skip the API details and come back if there is time”) and jump to the design. Ahead of schedule. Good, as long as you did not skip a phase: check the earlier ones are on the board. Set your level and the slot length, drag the clock, then say where you really are. 45 min 60 min Where are you actually? Turn the prompt into three features and a handful of numbers. “Users can shorten links, see analytics, manage campaigns, log in… and it should be scalable, available and fast.” , strong: ( A full schema with 14 columns, types and indexes, written before anything else. , strong: “Link, keyed by its short code. Campaign, which owns many links. User owns campaigns. I will add fields when the design needs them.” One endpoint per feature, with inputs and outputs. It is the contract the boxes must keep. “There will be a REST API for links.” POST /links, POST /campaigns/:id/links (batch), GET /:code → 302. “302, not 301: a 301 is cached by browsers forever, so we could never change or expire the target.” Twelve boxes including Kafka, Elasticsearch and a service mesh, with no request traced through them. “Two paths. Create: API → link service → Postgres, code as primary key. Redirect: load balancer → redirect service → Redis → Postgres on a miss. Separate services because redirects are 1,000× the traffic.” Go after the requirement the simple design does not yet meet. Pick, explain, compare, decide. Waiting for the interviewer to ask, or spending ten minutes on autoscaling settings. “Two risks. Unique codes without a single counter as a bottleneck: each server leases a block of 1,000 ids and base62-encodes them. And the 10:00 spike: we know the links the night before, so we warm Redis from the batch instead of waiting for misses.” Fill the whiteboard: a link shortener for SMS campaigns A bank sends 50 million SMS at 10:00, each with a short link. Step through the phases and watch what goes on the board, and what a weak answer would have said instead. ← back next phase →

Functional

Create a short link for a long URL Redirect a short link to its URL Bulk-create links for a campaign Out of scope: analytics, accounts, custom domains

Non-functional, with numbers

Redirect p99 < 100 ms, 99.99% available A code never maps to two URLs (strong on create) 50M links created overnight ≈ 7k writes/s for 2 h 10:00 burst: 10M clicks in 15 min ≈ 11k/s average, ~50k/s peak

Entities

Link(code PK, long_url, campaign_id, expires_at) · Campaign(id, owner_id) · User(id)

High-level design

Client → LB → Link service → Postgres Phone → LB → Redirect service → Redis miss → Postgres replica

Deep dives

ID range lease → base62(id), 7 chars ≈ 3.5 trillion codes Batch job → warm Redis at 09:50 + pre-scale redirect fleet Generating unique short codes without one counter becoming the bottleneck Ties to the “never two URLs per code” requirement and to 7k writes/s. Surviving the 10:00 spike: cache warming, pre-scaling, replicas The hardest number on the board. Autoscaling reacts minutes late to a spike you can see coming. 301 vs 302, and where a redirect can be cached Real, but small. Worth a sentence in the API phase rather than a deep dive. Scanning long URLs for phishing before shortening Good staff-level instinct (a bank’s domain is at stake), but not the scaling risk. Expiring links and cleaning up old rows Useful, and an easy TTL index or partition drop. Low risk, so low signal. Kubernetes autoscaling settings for the link service Generic operations detail. And the create path is not the hot one. Splitting the system into eight microservices Over-engineering. Two services already match the two traffic shapes. Which cloud provider to choose Not a design decision the interviewer can grade. Pick your three deep dives You have about 12 minutes. Which three topics earn the most signal for the link shortener? (Picking a fourth drops the oldest.) ▲▲ High signal ▲ Some signal ▼ Costs you Strong set. Both are aimed at requirements you wrote on the board, so the interviewer can see why they matter. Fine, but you left a high-risk requirement untouched. Ask: which number on the board is the design not meeting yet? These spend your best minutes on things the rubric does not reward. Go back to the non-functional list. Tick up to three. 1 Requirements What must it do, and how well? 2 Core entities What are the nouns? Entity names and keys Writing a full schema now 3 API What is the contract? One endpoint per feature, with inputs and outputs Debating REST vs gRPC for five minutes 4 High-level design Does every feature work end to end? 5 Deep dives Does it meet the hard numbers, and how does it fail? Two or three fixes, each tied to a requirement system design · start here The delivery framework: five phases and a clock A fixed path through any product or infrastructure question: requirements, entities, API, a working design, then deep dives. With time budgets per level, a whiteboard that fills in as you go, and a lab for choosing deep dives. Forty-five minutes is not much. Without a plan you will either talk about requirements for twenty minutes or jump straight to boxes and forget what they are for. The framework is a route: first make something that works, then make it good. The interviewer can follow you because they know the route too.

1. The route, and why this order

Each phase produces something the next one needs. Requirements tell you which numbers to hit. Entities and the API are the contract. The design serves the API. Deep dives fix the requirements the simple design misses. Each phase in one row Question it answers On the board when done For data-heavy questions (“design the database for Airbnb”), use the seven-step version in the database design framework. It goes further on estimation, access patterns and partitioning. For phase 3, the API design section covers picking REST, GraphQL or gRPC, naming endpoints, pagination, idempotency keys and API security.

2. Lab: the clock

The usual slot is 45 minutes: about 5 for introductions, 35 for design, and 5 for your questions. The split inside those 35 minutes depends on your level. Higher levels spend less time on the basics and more on depth.

3. Requirements: features, then numbers

Functional requirements are sentences that start with “users can”. Pick three to five and say the rest are out of scope. Out loud, so the interviewer can object. “It should be highly available, low-latency, consistent and scalable.” “Redirect p99 under 100 ms. A code never points at two URLs. 50 million clicks can arrive in 15 minutes. Creating a link may take a second.” Consistency, per feature Which reads must see the latest write? Bookings and money: yes. Feeds and counts: a few seconds behind is fine. Latency, as a percentile “p99 under 200 ms” means 99 of 100 requests finish within 200 ms. Averages hide the slow ones. Scale and shape Users, requests per second at peak, read/write ratio, data size. And spikes: when, and how big? Can we lose the last second of writes? Chat messages: no. Typing indicators: who cares. Mobile on bad networks? Multiple regions? Regulation on where data lives? Security and abuse Who can call what? What will people try to abuse?

4. Lab: fill the whiteboard

Here is the whole route on one problem. Notice how little is written in phases 2 and 3, and how every deep dive points back at a number from phase 1.

5. High-level design: make it work, then make it good

Trace a request Read the arrows aloud: “the phone hits the load balancer, which sends it to a redirect server, which checks Redis…” Put data where it is read Add the columns you need now, next to the database box, and nothing more. Flag, do not fix When you see a bottleneck, write it down and keep going. Fixing it now leaves other paths unbuilt. No box without a reason If you cannot say what a box does for this design, it should not be there.

6. Lab: deep dives that earn points

A deep dive is a requirement the simple design does not meet yet, fixed properly. For each one: state the problem with its number, give two options, compare them, pick one. At senior and above, choose them yourself before the interviewer does. The usual sources of deep dives: the highest-traffic path (cache, replicas, CDN), the strictest correctness rule (locks, transactions, idempotency), the biggest dataset (sharding and keys), and what happens when a box dies (retries, failover, queues).

7. How to practise

Reading a solution teaches less than you think. The skill is saying it in order, under time, while someone interrupts. Pick a prompt you have not studied. Try one of the case studies before you read it: flash sale, group chat, Tatkal, ChatGPT. Set a 35-minute timer and talk out loud the whole time. Record it, or do it with a friend who interrupts. Grade yourself on the five axes from the introduction, then read the case study and note what you missed. Repeat a week later. The second run is where it sticks. Which is a useful non-functional requirement for a chat app? The system should be scalable Messages are delivered in order within a chat, and none is lost after the sender sees a tick Use WebSockets It is specific to chat and it drives decisions (per-chat ordering, durable write before ack). “Use WebSockets” is a solution, not a requirement. Minute 18 of 45, you are still listing entities. Best move? Finish the schema properly first Say you are behind, name the API in one line, and go to the design Ask the interviewer for more time During the high-level design you notice the database will not handle peak reads. What now? Add caching and replicas immediately Write it down as a deep-dive item and finish the other endpoints first Ignore it unless asked Make it work, then make it good. Flag it so the interviewer knows you saw it, finish the design, then fix it with full attention. Why 302 rather than 301 for the short-link redirect? 302 is faster Browsers cache a 301 permanently, so you could not change, expire or count the redirect They are the same A 301 is “moved permanently”: the browser stops asking you. A 302 keeps every click coming back to your server. Requirements → entities → API → design → deep dives. Say each phase change out loud. Non-functional requirements are numbers and rules specific to this system, never “scalable”. Each deep dive fixes a number from phase 1: problem, two options, pick one.

Next

→ Numbers to know · Database design framework · First case study: the flash sale

More courses

  • Jobs, linked to lessons — Browse jobs where every requirement links to the chapter that teaches it. See how ready you are, how long the gap takes to close, and which listings look stale.
  • Match a job post to courses — Paste a job post. Each skill is matched to a track here and put in learning order, foundations first.
  • React patterns from open source — Patterns extracted from Material UI, Radix, React Aria, React Hook Form, Redux Toolkit, TanStack, and Next.js — not slides about hooks.
  • Databases in depth — How a query becomes work. Indexes, isolation, locks, and the plans that explain why a page is slow — not an ORM tour.
  • NestJS: build a real API — One ticket-booking API, built in order: a plain Node server first, then NestJS modules, validation, a real database, and the features real clients lean on.
  • Microservices — Microservice patterns one diagram at a time: how to split a monolith, how services talk, and how data stays consistent without distributed transactions.
  • Kafka — A beginner-to-senior path through event logs, reliable delivery, production operations, and disaster recovery.
  • AI engineering for software engineers — Eight free reads, in order, for software engineers moving into AI: when to build an agent, how to build one, how to test it, and how the model works underneath.
  • Frontend system design — How a UI is sliced when it is a product, not a page: ownership of state, cache, routes, and what happens when the network lies.
  • TypeScript in depth — The type system as a design tool. Inference, narrowing, generics, and the errors that mean the model is wrong — not a catalog of utility types.
  • CSS in depth — See the box, then the page. Visual chapters from the box model through Flexbox surprises, Grid, selectors, and units, then backgrounds, shapes, and visual effects, each with a playground.
  • Accessibility — Foundations first (WCAG in plain words, semantic HTML, lists, alt text), then hands-on HTML labs, a full pass of WAI-ARIA 1.3, and a final fix-the-page challenge.
  • Docker — What an image is, why layers cache, and how containers find each other on a network.
  • Redis — Fifteen Redis patterns, one picture each: cache, session, lock, counter, rate limiter, queue, and when Redis is the wrong tool.
  • Kubernetes — Kubernetes from zero to operators: why it exists, Pods, Deployments and Services, then configuration, networking, storage, scheduling, scaling and security.
  • AWS — AWS networking in plain English. A VPC is a gated housing society: streets are subnets, the Internet Gateway is the main gate, and a route table is the signboard.
  • Networking: the NetRoute game — NetRoute is a packet logistics game. You wire up computers, switches, routers, firewalls and gateways, set each device, and watch glowing packets travel. If a packet gets dropped, the game shows you which header field was wrong.