Someone asks you to “build a Twitter-like app.”
If you are like most engineers, your brain answers before you finish reading: Spring Boot, MySQL, Redis, done.
But wait. For how many users? A hundred, or a hundred million? What’s the budget? Do new tweets need to show up instantly, or is a few seconds late fine? If a server dies, is it OK to lose a tweet? What is the one thing that must never break?
Until you know those answers, any design you draw is a guess. Asking them is where system design starts.
This guide explains what system design really is, in plain words: what it is not, how the thinking works step by step, and the two ideas behind every good design: failure first, and trade-offs always.
What is system design?
System design is deciding what to build and why, before and while you build it, so that software works for real users at real scale, survives failures, and can change later.
Coding teaches you how to write the parts. System design decides which parts you need, how they talk to each other, where the data lives, and what happens when one of them breaks.
At its heart, it is four questions:
- What problem are we really solving?
- For whom, and at what scale?
- What can we sacrifice?
- What absolutely must not fail?
Skip those questions and you usually end up with one of two bad systems:
- Over-engineered: microservices, Kubernetes and Kafka for an app with 100 users. Expensive, slow to change, and solving problems nobody has.
- Under-engineered: one small database for 10 million users. Cheap and simple, right up until launch day.
What system design is not
A lot of beginners think system design means knowing the names of the right tools. It doesn’t.
| System design is not | System design is |
|---|---|
| Memorising technology names | Understanding the problem before the solution |
| Drawing boxes and arrows | Giving a reason for every box and arrow |
| Copying what big tech companies use | Choosing what fits your users, team and budget |
| Picking the “most scalable” option | Picking the simplest thing that works, for now |
| A one-time plan made up front | A design that changes as you learn |
| Only about millions of users | Useful even for a small feature |
How system design works: a loop, not a recipe
There is no fixed recipe. But good designers go through the same loop, again and again:
The fourth step is where most of the real work happens. For every part of the system, ask three questions:
- What is the simplest thing that could work here?
- What breaks when traffic grows 10 or 100 times?
- What happens to the user when this part fails?
That last question is the heart of failure-first thinking. You don’t wait for production to tell you what breaks. You ask first.
Constraints are your best friend
Beginners often see constraints as annoying limits. Architects see them as the thing that makes the decision for you.
Without constraints, every problem seems to need microservices, Kubernetes, Kafka, NoSQL and three data centres. With constraints, the answer often becomes obvious:
Ten thousand users? PostgreSQL is fine. A team of three? One application ships faster than ten services. A budget of $100 a month? Managed services beat running your own servers.
The constraints that matter most, almost every time: number of users, budget, team size, how fast it must respond (latency), and how much data you will store. Write them down before you draw anything.
Trade-offs: every choice closes a door
There is no perfect architecture. Every decision gives you something and takes something away:
- Simple vs feature-rich: a single application is easy to run, but harder to split up for many teams.
- Fast vs fresh: a cache answers in a millisecond, but it may show slightly old data.
- Cheap vs powerful: one database server is cheap; a cluster of them handles more but costs more.
- Flexible vs efficient: a general-purpose database fits many jobs, but a specialised one is faster at its one job.
- Now vs later: build for today’s traffic and ship fast, or for future traffic and ship slowly.
And every choice closes a door behind you. Choose a relational database, and spreading data across many machines gets harder later. Choose microservices, and you now pay for network calls and harder debugging. Add a cache, and you now own the problem of keeping it fresh.
“Complexity is a cost. Only pay it when it buys you something.”
That is why the honest answer to “what’s the best database for this?” is always: “It depends on…” and then the constraints.
Components vs systems
Here is a difference that separates beginners from designers.
A component is one piece of technology: a database, a cache, a queue. A system is how those pieces work together to solve the problem, including what happens when each one fails.
Component thinking says: “I’ll use PostgreSQL.”
System thinking says: “PostgreSQL for orders and payments, Redis for login sessions, S3 for uploaded files, a queue for background jobs. Here is how they connect, and here is what the user sees when each one fails.”
Failure first, even in a small feature
You don’t need millions of users to think this way. Take a small task: add notifications to an app.
The quick version: “I’ll add a notifications table and check it every second.”
The system design version asks first: How many notifications per second? Must they arrive instantly, or is a few seconds fine? What happens if the notification service is down? What if a big sale sends a million at once?
Those answers lead to a queue, plus a plan for when the queue itself fails:
// Java · NotificationService.java
public void send(Notification notification) {
try {
// Normal path: a queue absorbs spikes and delivers reliably
kafka.send("notifications", notification);
} catch (Exception e) {
// Failure path: never lose it, save it and send it later in a batch
fallbackRepository.save(notification);
metrics.increment("notifications.fallback");
}
}
Ten lines, but the design question changed from “how do I send this?” to “how do I make sure it’s never lost?”
A real example: from vague idea to decisions
Here is the whole loop on a real brief: “Build a food delivery app.”
| Question | Answer | What it decides |
|---|---|---|
| How many users? | One city (100K), planning for the whole country (10M) | Start simple, but leave a clean way to split data by city later |
| What’s critical? | Placing orders, payment, live delivery tracking | These parts get the most care and testing |
| What can be a bit stale? | Menus, reviews, order history | Serve menus from read replicas; a few seconds old is fine |
| What must never fail? | Payment | Make payment a separate service from day one, for reliability and regulations |
The result is not microservices everywhere. It is one well-organised application, with payments split out, read replicas for menus, and a plan for growth. Every piece has a reason you can say out loud.
Four thinking mistakes to avoid
Most bad designs don’t fail because of the wrong tool. They fail because of the wrong thinking:
- Solution before problem. “Let’s use microservices!” Instead, start from the pain: “Five teams keep blocking each other’s releases. Splitting the app might help.”
- Designing for imaginary scale. “We need Cassandra for billions of writes”, with 1,000 users. Instead: “PostgreSQL handles millions of writes a day. We’ll revisit at 10 million users, based on real bottlenecks.”
- Ignoring your real constraints. “Let’s add machine learning recommendations”, with no one on the team who knows ML. Instead: start with simple rules, and invest in ML once you have the data and the people.
- Treating the design as final. “This is the perfect architecture.” Instead: “This fits our current constraints. We’ll review it every six months, or when traffic grows 10 times.”
Evolve, don’t predict
You cannot design the perfect system up front, because you don’t yet know your real traffic, your users’ habits, or how your team will grow. So good designs don’t try to predict the future. They leave room to change.
- Up to 10,000 users: one simple application and one database. Ship fast and learn.
- 10,000 to 100,000 users: add a cache where real queries are slow.
- 100,000 to a million users, with several teams: split out a service (say, orders) only when teams start getting in each other’s way.
Each step happens because of real numbers, not fear. Scaling too early is just as costly as scaling too late.
Puzzle: “but it worked in staging”
What broke: database queries that were instant on 10,000 rows crawl on 10 million, because indexes were missing. The connection pool ran out, because staging never had more than a handful of users at once. Memory filled up, and writes started waiting on each other.
What was missed: testing at a realistic size, planning capacity, checking slow queries on production-sized data, and setting up monitoring before launch.
The lesson: staging is not production. Scale reveals problems that small tests can’t.
Key takeaways
- System design is thinking, not memorising. Understand the problem before choosing tools.
- Constraints are your friend. Users, budget, team, latency and data size make most decisions for you.
- Trade-offs are unavoidable. Every choice gives you something and costs you something. Say both out loud.
- Design for failure from day one. For every part, ask what the user sees when it breaks.
- Start simple, and evolve on purpose. Add complexity only when it pays for itself.
- It’s never done. Requirements, scale and technology change, and your design should too.
If you haven’t yet, read how to think like a software architect. It is the mindset this whole notebook is built on. Next up: how to turn vague requirements into hard numbers you can design against.
Comments