Learn how to build, test, deploy, and maintain robust software systems.
System architecture is the high-level design of a system: what the major components are, what each is responsible for, how they communicate, and how they are deployed. Good architecture is not about drawing impressive boxes — it is about making deliberate trade-offs that satisfy the system’s requirements for availability, latency, scalability, and reliability. This lesson introduces monoliths and microservices, load balancing, caching, queues, database scaling, and the CAP theorem. It ends with a worked example — designing a URL shortener — so you can see the design process end to end. The most important skill is asking "what are the requirements and what are the trade-offs?", not memorizing architecture names.
| Functional | Non-functional | |
|---|---|---|
| Question | What must it do? | How well must it do it? |
| Examples | Create a short URL | Availability, latency, scale, security |
| Monolith | Microservices | |
|---|---|---|
| Deployment | One unit | Many independent units |
| Scaling | Whole app | Per service |
| Complexity | In the codebase | In the network |
| Best for | Small teams, early stage | Large teams, independent domains |
A load balancer distributes requests across servers, spreading load and improving availability.
A cache stores frequently read data so most requests are answered quickly without hitting the database. The hard part is keeping the cache from serving stale data (invalidation).
| Synchronous | Asynchronous | |
|---|---|---|
| Flow | Caller waits for the result | Caller continues; result arrives later |
| Latency | Tied to the slowest step | Decouples slow work |
| Example | A normal API call | A queued email job |
CAP states that a distributed system cannot simultaneously guarantee Consistency (all nodes see the same data), Availability (every request gets a response), and Partition tolerance (the system keeps working even when the network between nodes fails).
| Term | Meaning |
|---|---|
| Availability | The system is up and responding |
| Latency | How long one operation takes |
| Scalability | How well it handles growth |
A URL shortener turns a long URL into a short code, stores the mapping, and redirects when the code is requested.
Trace one redirect end to end.
(a cache miss falls through to the database)