Design a URL Shortener: A System Design Walkthrough
A URL shortener system design: requirements, capacity estimates, API, short-code generation, database choice, caching, analytics and scaling trade-offs.
A step-by-step framework for system design interviews: clarifying requirements, estimates, APIs, data models, high-level design, deep dives and trade-offs.

A system design interview isn’t a test of whether you’ve memorised the architecture of a famous app. It’s a conversation that shows how you think: how you clarify a vague problem, make reasonable assumptions, choose trade-offs and communicate. A repeatable framework keeps you on track under pressure.
| Step | Time (45-minute interview) | Goal |
|---|---|---|
| 1. Clarify requirements | 5 minutes | Agree what you’re building |
| 2. Estimate scale | 3–5 minutes | Size the problem |
| 3. Define the API | 3–5 minutes | Pin down the interface |
| 4. Data model | 5 minutes | Decide what you store and how |
| 5. High-level design | 10 minutes | Draw the main components |
| 6. Deep dives | 10–15 minutes | Solve the hardest parts |
| 7. Wrap up | 2–3 minutes | Bottlenecks, trade-offs, next steps |
Split requirements into two lists.
Functional: what the system does. For a URL shortener: create a short link, redirect to the original URL, optionally set expiry.
Non-functional: how well it does it. Latency targets, availability, consistency needs, durability, security and expected scale.
Ask questions: Who are the users? What matters most: speed, correctness or cost? What’s out of scope? Write the answers down; you’ll use them to justify decisions later.
Rough numbers guide every later choice. Estimate (our guide to back-of-the-envelope estimation has the handy numbers):
For example: 100 million new links a month is roughly 40 writes per second on average. If reads are 100 times writes, that’s about 4,000 reads per second, so this is a read-heavy system where caching will matter.
Sketch the key endpoints:
POST /links { "url": "https://example.com/long", "expiresAt": null }
-> 201 { "code": "a8Xk2", "shortUrl": "https://sho.rt/a8Xk2" }
GET /{code} -> 301 redirect to the original URL
Mention authentication, rate limits and idempotency where they matter.
Choose what you store and where. For the URL shortener: a table mapping short codes to URLs, with created time, expiry and owner. Discuss the choice of database: a key-value lookup by code suits many NoSQL stores, but a relational database also works well at moderate scale. Explain the access pattern that drives your choice.
Draw the main path: clients, load balancer, stateless application servers, a cache, the database, and any queues or background workers. Walk through one request end to end: “A redirect request hits the load balancer, an app server checks the cache, falls back to the database on a miss, then returns a redirect.”
Pick the parts that are hardest or riskiest, or follow the interviewer’s lead. Common deep dives:
Summarise the design, name the bottlenecks and single points of failure, and say what you’d do next with more time: monitoring, multi-region deployment or cost optimisation.
Work through classic problems out loud: a URL shortener, a chat app, a news feed, a rate limiter, a file storage service. You can even rehearse with an AI assistant acting as interviewer; AIEmulate has prompt templates for interview practice.
Typically 45 to 60 minutes. Adjust the time spent on each step, but keep the order.
Understand categories (relational vs NoSQL databases, caches, queues, CDNs) and their trade-offs. Naming a specific product is fine if you can justify it.
Say what you know, reason from first principles and state assumptions. Honest reasoning scores better than bluffing.
Every article is edited by a human and checked against our editorial policy. Spotted a mistake? Tell us.
A URL shortener system design: requirements, capacity estimates, API, short-code generation, database choice, caching, analytics and scaling trade-offs.
Microservices or a monolith? The real costs and benefits of each, the modular monolith middle ground, and a practical framework for deciding and migrating.
How to design a notification system for push, email and SMS at scale: requirements, architecture, queues, templates, preferences, retries and deduplication.