System design is the craft of deciding how a software system is put together: which components exist, how they talk to each other, where data lives and how the whole thing behaves when traffic grows or machines fail. Writing code answers how do I implement this feature? System design answers how do I build something that keeps working for millions of people, within budget, when parts of it break? It is also the interview round that most separates mid-level from senior engineers.
Think of it like
Designing a restaurant kitchen
A home cook can feed four people with one stove. A restaurant serving 500 covers a night needs stations (grill, fry, pastry), a pass where tickets queue, prep done hours in advance, a spare oven for when one dies, and a head chef who decides what to trade off when it gets busy: perfect plating or fast service? System design is planning that kitchen before the dinner rush, not during it.
What system design actually is
Every non-trivial system is assembled from a small set of recurring building blocks: clients, DNS, load balancers, stateless application servers, caches, databases, message queues, object storage and CDNs. System design is choosing which blocks you need, sizing them, wiring them together and justifying every choice against the requirements.
The diagram below is the map of the territory: a typical web application. Almost every design you will study in this track is a variation on it. Press play on a flow to follow a request through it.
Functional vs non-functional requirements
Requirements come in two flavors. Functional requirements describe what the system does: the features a user can see. Non-functional requirements describe how well it does them: speed, scale, uptime, correctness under failure. Non-functional requirements drive almost every architectural decision, so they deserve most of your attention.
Functional: what it does
- Users can post a photo with a caption
- Users can follow other users
- Users see a feed of posts from people they follow
- Users can like and comment on posts
- Phrased as verbs a user performs
Non-functional: how well it does it
- Feed loads in under 200 ms at p99
- 99.99% availability for reads
- Uploaded photos are never lost (durability)
- Handles 500 million daily active users
- Phrased as measurable qualities
| Quality | Question to ask | Example target |
|---|---|---|
| Scalability | How many users, requests and bytes, now and in 3 to 5 years? | 100M DAU, 50k QPS peak |
| Availability | How much downtime is acceptable? See Availability & Reliability. | 99.99% (about 53 min/year) |
| Latency | How fast must the critical path be, at which percentile? See Latency, Throughput & Percentiles. | p99 < 200 ms |
| Consistency | Must every reader see the latest write immediately? | Eventual for likes, strong for payments |
| Durability | Can we ever lose acknowledged data? | Zero loss of committed writes |
| Security and privacy | Who can see what? Any regulatory constraints? | GDPR deletion within 30 days |
| Cost | What is the budget per user or per request? | Under $0.001 per 1,000 reads |
| Maintainability | How many teams? How often do we deploy? | Independent deploys per team |
functional:
- upload a photo with a caption
- follow / unfollow users
- view a home feed of followed users' posts, newest first
out_of_scope:
- direct messages, stories, ads
scale:
daily_active_users: 100_000_000
photos_uploaded_per_day: 10_000_000
feed_reads_per_user_per_day: 20
read_write_ratio: "about 200:1"
non_functional:
feed_latency_p99_ms: 200
availability: "99.99% reads, 99.9% uploads"
consistency: "eventual for the feed, read-your-own-writes for your own posts"
durability: "never lose an uploaded photo"The core trade-offs
Every design decision buys something by paying for it somewhere else. Recognizing which trade-off you are making, and saying it out loud, is the single most important skill in system design.
| Trade-off | Lean left when | Lean right when |
|---|---|---|
| Consistency vs availability | Money, inventory, bookings: a wrong answer is worse than no answer | Feeds, likes, view counts: a slightly stale answer beats an error page |
| Latency vs throughput | Interactive requests where every millisecond is felt | Batch jobs, log ingestion, analytics: total work per second matters most |
| Cost vs complexity | Early product, small team: a boring monolith on one big database | Proven scale problems that justify sharding, queues and more services |
| Read vs write optimization | Write-heavy (logs, metrics): append-only stores, LSM trees | Read-heavy (feeds, catalogs): caches, replicas, denormalized data |
| Build vs buy | It is your core differentiator | It is undifferentiated plumbing (auth, queues, search) |
Consistency vs availability
When data is copied across machines and the network between them breaks, you must choose: refuse requests until the copies agree (consistent), or keep answering with possibly stale data (available). This is the heart of the CAP Theorem & PACELC. A bank balance should be consistent; a like counter can be eventually consistent.
Latency vs throughput
Latency is how long one request takes; throughput is how many requests finish per second. They often pull in opposite directions: batching 100 writes into one disk flush multiplies throughput but makes the first write in the batch wait for the other 99. Running servers hotter raises throughput but, as Latency, Throughput & Percentiles shows, queueing delay explodes near 100% utilization.
Cost vs complexity
Every new component (a cache, a queue, a second region) adds operational cost, new failure modes and cognitive load. A single well-tuned PostgreSQL instance handles far more than most people expect. Add complexity only when a requirement or a measured bottleneck demands it.
A framework for design interviews
Open-ended prompts like design Instagram are deliberately vague. A repeatable framework keeps you from freezing or diving into details too early, and it shows the interviewer a structured thought process. Use these seven steps in order, and say which step you are on.
- 1
Clarify requirements
List 3 to 5 core functional requirements and agree on what is out of scope. Pin down non-functional targets: scale, latency, availability, consistency. Write them where the interviewer can see them.
- 2
Estimate the scale
Back-of-the-envelope numbers for QPS (average and peak), storage growth and bandwidth. Only compute what will change a decision. See Back-of-the-Envelope Estimation.
- 3
Define the API
The contract between client and system: endpoints or RPCs, inputs, outputs and status codes. It forces precision about what each feature really does. See API Design: REST, GraphQL & gRPC.
- 4
Sketch the data model
Core entities, their key fields and relationships, and the access patterns. Access patterns ("get the latest 20 posts by user") drive the choice between relational and NoSQL. See SQL vs NoSQL Databases.
- 5
Draw the high-level design
Boxes and arrows covering every functional requirement end to end: clients, load balancer, services, storage. Walk one request through it. Keep it simple and correct before making it clever.
- 6
Deep dive
Pick the 1 to 3 hardest parts (often chosen by the interviewer) and go deep: the fan-out strategy for a feed, ID generation for a shortener, concurrency control for bookings.
- 7
Address bottlenecks and wrap up
Find single points of failure, hot spots and scaling limits. Discuss monitoring, failure handling and what you would do next with more time.
| Phase | Minutes | Clock | What you should have at the end |
|---|---|---|---|
| 1. Requirements | 5 | 0 to 5 | Agreed feature list, out-of-scope list, numeric targets |
| 2. Estimation | 4 | 5 to 9 | Peak QPS, storage per year, read/write ratio |
| 3. API | 4 | 9 to 13 | 3 to 6 endpoints with request/response shapes |
| 4. Data model | 4 | 13 to 17 | Entities, keys, chosen database type |
| 5. High-level design | 10 | 17 to 27 | A complete, working diagram for all core features |
| 6. Deep dives | 13 | 27 to 40 | Detailed solutions to the hardest 1 to 3 problems |
| 7. Bottlenecks and wrap-up | 5 | 40 to 45 | SPOFs fixed, scaling plan, monitoring, open questions |
Worked mini-example: a photo-sharing app
| Step | What you might say |
|---|---|
| Requirements | Upload, follow, home feed. No DMs or stories. 100M DAU, feed p99 under 200 ms, never lose a photo. |
| Estimation | 10M uploads/day ≈ 115/s average, ~350/s peak. 2 MB per photo ≈ 20 TB/day of new storage, so photos go to object storage, not the database. |
| API | POST /photos, POST /users/{id}/follow, GET /feed?cursor=... |
| Data model | users, follows(follower, followee), posts(id, author, photo_url, created_at); photos as blobs in Blob & Object Storage. |
| High-level | LB → stateless API → DB for metadata, S3 for bytes, CDN for delivery, queue + workers for thumbnails. |
| Deep dive | Feed generation: fan-out on write for most users, fan-out on read for celebrities. See Design a News Feed. |
| Bottlenecks | Hot celebrity posts (cache them), DB write load (shard by user ID), regional outages (multi-region read replicas). |
Common mistakes
- Jumping straight to boxes. Drawing Kafka and Cassandra before knowing the scale or features. The design should follow the requirements, not the other way round.
- Over-engineering. Microservices, sharding and multi-region for a product with 10,000 users. Start with the simplest design that works, then scale the parts that need it.
- Ignoring non-functional requirements. A design that implements every feature but cannot survive a single server failure misses the point of the exercise.
- Buzzword bingo. Naming technologies without explaining why. "Redis, because the feed is read 200 times per write and a cache hit is 100× faster than a DB query" beats "add Redis".
- Silent thinking. The interviewer can only grade what they hear. Narrate assumptions, alternatives and trade-offs.
- Running out of time in estimation or the API and never reaching the high-level design. Watch the clock.
How this track is organized
The system design track builds from first principles to complete designs. Each module assumes the ones before it, but every topic links back to what it depends on, so you can also jump around.
| Module | What you learn | Start with |
|---|---|---|
| Fundamentals | How the internet works, protocols, APIs, estimation, and the core qualities: scalability, availability, performance | How the Web Works, HTTP, HTTPS & TLS, Back-of-the-Envelope Estimation, Scalability |
| Building blocks | The components you compose into architectures | Load Balancing, Caching, SQL vs NoSQL Databases, Message Queues & Pub/Sub, Sharding & Partitioning |
| Distributed systems | The theory that keeps many machines correct | CAP Theorem & PACELC, Consistency Models, Consensus: Raft & Paxos, Idempotency & Delivery Guarantees |
| Architecture patterns | How production systems are organized and kept healthy | Monoliths vs Microservices, Event-Driven Architecture, CQRS & Event Sourcing, Resilience Patterns, Observability |
| Case studies | Interview-style end-to-end designs that combine everything | Design a URL Shortener, Design a News Feed, Design a Chat System, Design a Payment System |
Key takeaways
- System design is choosing, sizing and connecting building blocks to meet functional (what) and non-functional (how well) requirements.
- Non-functional requirements (scale, latency, availability, consistency, durability, cost) drive the architecture, so attach numbers to them early.
- Every decision is a trade-off: consistency vs availability, latency vs throughput, cost vs complexity. Name what you give up.
- Use a repeatable framework: requirements, estimation, API, data model, high-level design, deep dives, bottlenecks.
- In a 45-minute interview, protect the high-level design and deep dives; they carry most of the signal.
Common pitfalls
- Designing before clarifying requirements and scale, then solving the wrong problem.
- Adding microservices, queues and sharding without a requirement or bottleneck that justifies them.
- Listing technologies without explaining the trade-off each one makes.
- Spending 15 minutes on estimation and never finishing a working high-level design.
Interview tips
- Write the functional and non-functional requirements down and refer back to them when justifying decisions.
- Narrate the framework: "I've got the API; next I'll sketch the data model." It shows structure and lets the interviewer redirect you.
- Start simple and correct, then evolve the design under load. Showing the evolution is more impressive than a complex first draft.
- End with failure modes and monitoring: what breaks first, how you would detect it and how the system degrades.
Real-world applications
- System design interviews at most mid-level and senior engineering levels.
- Design docs and RFCs written before building a new service.
- Capacity planning and architecture reviews for existing systems.
- Evaluating build-vs-buy decisions for infrastructure.
Test yourself
Which of these is a non-functional requirement?
Related topics
Finished this lesson? Track it to see your progress on the roadmap.