System design foundationsStart with a user need. Build the system around it.
System design foundations. Learn the concepts, explore a model and defend your design.
01SYSTEM DESIGN
DEFINITION
System design is the process of deciding how software components, data and communication work together to satisfy a user need under stated constraints. It includes normal behavior, heavy demand, security, failure and recovery. A design is successful when its decisions support the required outcome, not when its diagram contains many technologies.
The three responsibilities of a basic system
STEP 1ClientCollects a request
STEP 2ApplicationChecks business rules
STEP 3DatabaseRemembers accepted state
The screen, decision-making code and durable record have different jobs.
CONCEPT 1
A simple app is already a system
Start with something you know
Imagine a college canteen app. A student sees the menu, places an order and receives an order number. The screen is only one part of the system. Something must receive the order, check the price, remember it and tell the kitchen. System design means deciding how these parts work together, especially when many people use the app or one part stops working.
The basic building blocks
The client is the part asking for work: usually a browser or mobile app. The server is a program that receives requests and produces responses. It usually runs on a computer in a data centre, but you can also run one on your laptop. The database remembers information beyond the life of one request, such as orders and student accounts. The network carries messages between these parts.
Where computer resources fit
The CPU performs computation. RAM is fast working memory, but a process losing its memory should not erase accepted orders. Durable storage keeps data under the storage system's stated guarantees. Network links move bytes and can be slow or unavailable. A design often becomes slow because one of these resources has more work than it can handle.
CONCEPT 2
Follow one order through the system
Request and response
A request is a message asking for an action or information. When Riya taps Place order, the app sends the selected items and an operation identifier to the server. The server checks the request, determines the price using its own trusted data, records the order and returns an order number. The response tells the app what happened. A request may fail before reaching the server, while being processed, or while its response travels back.
Stateless does not mean forgetful
A stateless application instance does not depend on private memory from a previous request to understand the next one. It can read durable information from a database or another shared store. This makes it easier to send a later request to another healthy server. A stateful connection or session is sometimes useful, but its recovery and routing need a deliberate plan.
One app can serve many students
A server can have several requests in progress. Concurrency means making progress on overlapping tasks; it does not necessarily mean all instructions run at the exact same instant. Waiting for a database can leave time for another request. The number of requests a server can handle depends on work per request, hardware, software and dependencies. There is no universal requests-per-server number.
One order has a request and a reply
STEP 11. StudentSend order + operation key
STEP 22. ApplicationValidate and commit
STEP 33. StudentReceive order number
The reply follows the commit. A missing reply does not prove that the order was rejected.
CONCEPT 3
Decide what the app must do
Functional requirements
These describe actions the system must support. For the canteen, students can browse a menu, place an order and check its status. Staff can mark an order ready. Ask what is in scope before choosing tools. Payments, delivery tracking and recommendations are separate features unless the problem includes them.
Quality requirements and constraints
A quality requirement describes how well an action should work. For example: most menu reads should finish within an agreed time under a stated workload; accepted orders must survive a specified failure. A constraint is a limit such as a monthly budget, an existing database or a two-person team. Words such as fast and scalable need a measurable definition before they can guide a design.
An invariant is a rule that must stay true
For example, one payment must not create two orders, and one student must not read another student's private receipt. These rules matter during normal use and during failures. Write them before drawing infrastructure. If an interviewer says the system has to handle many users, ask how many, which actions are frequent and what can be delayed.
Requirements become design decisions
CONCEPTActionPlace an order
CONCEPTQualityResponse target at stated load
CONCEPTInvariantOne operation, one order
A feature says what happens; a quality target says how well; an invariant says what must stay true.
CONCEPT 4
From requirements to a first design
High-level design
High-level design, often shortened to HLD, shows major parts and their responsibilities. Start with a client, an application server and a database. Explain the read and write paths in words. Add a cache, queue or second service only when you can name the problem it solves. A small complete design is easier to check than a large drawing full of unexplained boxes.
Low-level design
Low-level design, or LLD, explains how one part works inside. For an order module, this could include the Order data model, allowed status changes and the reserveStock function. HLD asks where responsibilities live. LLD asks how those responsibilities are implemented safely. Both levels matter, and interviews may emphasize one more than the other.
Why begin with a modular monolith
A monolith is one main application deployment. Modular means its code still has clear areas such as accounts, menu and orders. This can be a practical starting point for a small team. Microservices split selected responsibilities into separately deployed services. That may help independent teams or scaling, but introduces network failures, deployment work and harder coordination between data owners.
Zoom from HLD to LLD
STEP 1HLDClient, API and store
STEP 2API contractInputs, results and errors
STEP 3LLDState transitions and rules
Zooming in adds detail without changing the user outcome the design must support.
Key learning points
Identify the user and the operation before selecting a database or framework.
A client asks for work; an application handles it; an authoritative store keeps the accepted records.
An invariant is a rule that must remain true during concurrency and failures.
HLD explains the major parts. LLD explains interfaces, internal rules and state transitions.
Compare the important ideas
System design foundations: concepts and trade-offs
Term
Plain meaning
Canteen example
Functional requirement
An action the user can perform
Place an order and see its status
Quality requirement
How well an action must work
A stated fraction of valid orders meets a response target
Constraint
A limit the design must respect
Two developers and an existing database
Invariant
A rule that must remain true
A paid operation must not create two orders
Non-goal
An explicitly excluded feature
No delivery tracking in version one
WORKED EXAMPLE
Build the smallest complete design
The app sends item identifiers and a stable operation ID to an order API. The API derives the student identity from authentication, reads trusted prices and records an order. It returns the durable order number after the stated acceptance condition is met. A later staff request changes status using an allowed transition. For a small first release, one modular application and one relational database can meet these needs without a queue or several separately deployed services.
Further reading
Original teaching explanations by Buildfest Learn. Check these primary references for the underlying concepts and implementation details.
Classify: one accepted checkout operation must never create two orders. Pick a category and explain what the rule protects.
1One checkout identity
2Reconsider the category
3Never create two orders
This statement is an invariant.
It describes a rule that must remain true even during retries and failures. A feature says what a user does; a quality target states measurable performance.
Chapter review: two questions
Attempt both questions before opening the model answers.
Question 1
A college canteen app lets students order lunch. Write two functional requirements, two measurable quality requirements, one constraint and one invariant.
Reveal model answer
Functional examples are placing an order and checking its status. Quality targets must state a workload and measurement window, such as a chosen success fraction or response-time boundary. A fixed team size or monthly budget is a constraint. An invariant is that one accepted checkout operation cannot create two orders. Different targets are valid when explicit and justified.
Question 2
Draw the client, application and database flow. A reply is lost after the database commits. Explain why the student should not create a new checkout identity automatically.
Reveal model answer
The client sends a stable operation key to the application, which stores the order and associated result consistently in the database. A lost reply leaves the result uncertain, not definitely failed. Reusing the same operation identity lets the server return the existing outcome; a new identity can be interpreted as a second purchase.
Answers stay in this tab. Download before leaving. This practice is not graded or saved to your account.