Design its core: API, data model, and short codes
Continues from the last build: a sized problem with no design.
Rung 1 left you with numbers on a page and nothing that runs: 200 writes/sec average, 100,000 redirects/sec at peak, and a 5-year storage target of 31.5 billion URLs, but not one endpoint, table, or short code exists yet.
What you'll build
A working paper design: a versioned REST contract for create and redirect, a single-table schema with justified columns and indexes, ADR-001 choosing counter+base62 over hash or random codes with the keyspace math to defend it, a collision-safe short-code prototype, and ADR-002 choosing 302 over 301 and naming the deliberate MVP boundary that the next ten rungs will each chip away at.
See how we teach, before you sign up
You don't just get code dumped on you. Every starter file and every solution is explained line-by-line, in plain English. Here's one real file from this project:
# ADR-000: <Decision Title> ## Status Proposed ## Context What problem are we solving. What numbers from rung 1 apply here. ## Options Considered 1. Option A - tradeoffs 2. Option B - tradeoffs 3. Option C - tradeoffs ## Decision The chosen option, one paragraph. ## Consequences Positive and negative outcomes, what this makes easier, what it makes harder or defers to a later rung.
Reading this file
## StatusEvery ADR starts life as Proposed and becomes Accepted once the team commits.## Options ConsideredList at least two real alternatives, not just the one you picked, or the ADR can't be defended later.## DecisionOne paragraph, no hedging: this is the sentence an interviewer will ask you to justify.## ConsequencesName what gets harder, not just what gets easier; every decision defers some cost to a later rung.Positive and negative outcomes, what this makes easier, what it makes harder or defers to a later rung.This is the line that keeps the ladder honest: nothing is free, it's just deferred.
Copy this for both ADR-001 (code strategy) and ADR-002 (redirect semantics + MVP boundary).
That's 1 of 7 explained code blocks in this single project.
The build, milestone by milestone
- 1
Define the API contract: create and redirect
4 guided stepsA URL shortener that can't state its own API in one page can't be scaled, rate-limited, or cached with any precision, because nobody agrees what a 'request' even is yet.
- 2
Design the data model: one table, the right columns
4 guided stepsA schema designed before the API tends to grow columns nobody asked for; a schema designed after tends to be missing the one column the redirect path actually needs. Doing it in this order keeps the table minimal on purpose.
- 3
Choose the short-code generation strategy
4 guided stepsThis is the decision an interviewer is actually listening for in a URL-shortener question. Get the keyspace math wrong and the system either runs out of codes early or collides constantly; get it right and you can explain, in one paragraph, why collisions are structurally impossible for the common path.
- 4
Handle collisions on the paths that can still have them
4 guided stepsInterviewers probe this because 'my ID can't collide' is only true for the generated path; the moment a product adds custom aliases (a very common real feature), collision handling becomes mandatory again, and a design that forgot this looks unfinished.
- 5
Decide the redirect status code and write the closing ADR
4 guided steps301 vs 302 looks like trivia but it decides whether clicks are observable at all: a cached 301 means the browser stops calling your API, which silently breaks click counting (rung 8) and any future long_url edit.
What's inside when you start
You'll walk away with
This is portfolio-grade. Build it free.
Sign up to unlock every milestone step-by-step, the code skeletons, full reference solutions, and checkable tasks, with your progress saved as you build.
Start building