System Design Β· Chapter 01

The Tiers of Software Architecture

Every application is a set of components β€” a UI, some logic, a database, maybe a cache or a queue. A tier is a decision about where each of those components physically lives. This chapter walks from the simplest arrangement (everything on one machine) to the sprawling distributed systems behind Instagram and Uber, and shows why each step up the ladder exists.

🧭
How to read this

Each tier type is its own section, but they build on each other as a story: every new tier is the fix for a limitation of the one before it. Anything marked [+] is context I've added beyond the source lesson β€” usually a definition, an example, or a "why." Diagrams are color-coded by component role: UI, app/logic server, database, cache/queue, NoSQL/async.

01

A tier is a decision about where a component runs

Think of a tier as the physical and logical separation of the components that make up an application. The key word is components β€” not code. A tier boundary is not "this function versus that function"; it's "this whole component runs on a separate machine from that one."

The components a web service is built from include:

The number in "single-tier," "two-tier," "three-tier," and "n-tier" simply counts how many separate machines those components are spread across. That's the whole idea. The sections below make it concrete.

THE COMPONENTS OF A WEB SERVICE User Interface what the user sees Business Logic the app server Database Cache Messaging …and more
Figure 1 β€” The reusable building blocks. A "tier" question is only ever: which of these live on the same machine, and which get their own?
02

Single-tier: everything on one machine

UI, business logic, and database all live on the same machine. There is no network between them β€” the app talks to its data by reaching across memory and disk on the same computer. Classic examples are desktop software: MS Office, PC games, image editors like Photoshop or GIMP.

ONE MACHINE β€” NO NETWORK User Interface Business Logic Database
Figure 2 β€” One boundary, three components, zero network hops. Data is always local.

Upsides

[+] The catch on performance: it's only as good as the user's hardware. A heavy app on a weak machine still feels slow, because there's no server to offload work to.

Downsides

⚠️
The limitation that drives the next step

Two problems dominate: the publisher can't update or secure the software, because they don't own the machine it runs on. The obvious fix β€” move something you do control onto a machine you own. That's a two-tier app.

03

Two-tier: pull the database onto a server you own

The client holds the UI and the business logic together; the database runs on a separate server the business controls. So there are two machines β€” client and database server β€” and one network hop between them.

CLIENT MACHINE User Interface Business Logic DATABASE SERVER (business-owned) Database 1 persist only
Figure 3 β€” Client-server architecture. The only network call happens when data needs to be saved.

Why keep logic on the client?

A fair objection: the code still lives on the client, so it's still vulnerable to being read or copied β€” and it is. Two-tier is the right call when that exposure doesn't hurt the business much, and the tradeoff buys real advantages:

πŸ’‘
Where two-tier shines

A to-do or planner app only hits the database when you finish a list and want to save it. Browser and mobile games download their heavy files once on first use, then contact the backend only to persist game state. In both, exposing the code causes little harm, and the latency win is worth it.

Whether to keep logic on the client or move it to its own server is a business-requirements call. Move the logic to a dedicated backend, and you've built a three-tier app.

04

Three-tier: give the logic its own machine too

UI, business logic, and database each run on their own separate machine. All three are physically separated into distinct tiers. This is the workhorse of the web β€” nearly every simple site (blogs, news sites) is a three-tier app.

Presentation HTML Β· CSS Β· JS 1 Application e.g. Apache server 2 Data e.g. MySQL 3
Figure 4 β€” Three tiers, three machines. The blog example: browser β†’ Apache β†’ MySQL.

Concretely, a simple blog: the UI is HTML, JavaScript, and CSS; the logic runs on a server like Apache; the data lives in MySQL. Three machines, three responsibilities. This works best for straightforward use cases β€” and when the app grows past "straightforward," you start adding components beyond these three. That's n-tier.

05

N-tier: more than three components in play

An n-tier application involves more than the three core components. Beyond UI, application server, and database, it pulls in specialized pieces, each on its own tier:

DISTRIBUTED SYSTEM (a.k.a. n-tier) Clients Load Balancer SERVICE CLUSTER Service A Service B Search svc Cache SQL DB NoSQL Message Queue (async)
Figure 5 β€” Many specialized tiers. Edge color shows what flows: reads, writes, async messages.

Almost every large-scale product is n-tier: social apps like Instagram, Facebook, and TikTok; consumer services like Uber and Airbnb; massively multiplayer games like PokΓ©mon Go and Roblox. N-tier applications are more commonly known as distributed systems.

06

Why break a system into so many tiers?

Two design principles explain the whole progression. Both push in the same direction: give each component one job, and keep it loosely coupled to the rest.

Single responsibility principle

Give a component one dedicated responsibility and let it do that flawlessly β€” persist data, or run application logic, or guarantee message delivery, but not several at once. The payoffs:

πŸ—„οΈ
Why not stored procedures

Stored procedures put business logic inside the database β€” a violation of single responsibility. Swap in a different database later and the logic has nowhere clean to go: you either drag it to the new database or awkwardly refactor it into the app. A database should only persist data. Keeping logic out of it is exactly why logic gets its own tier.

Separation of concerns

Loosely, the same idea: each part minds its own work and stops worrying about the rest. It applies at every level β€” across tiers and inside code. Keeping components separate makes them reusable: different services can share the same database or messaging server, as long as they aren't tightly coupled. Loose coupling is the goal, because it's what lets you scale the system when it grows past a certain size.

πŸ”‘
The single idea underneath it all

You add tiers to give each component one job and to keep them loosely coupled. That's what makes a system manageable, resilient, reusable, and β€” above all β€” scalable.

07

Layers are not tiers

These get used interchangeably, but in the industry they mean different things. Tiers are physical; layers are logical.

Layers live at the code level, independent of how many machines are involved. The same set of layers can appear inside any tiered app β€” single, two, three, or n-tier.

CODE-LEVEL LAYERS β€” LOGICAL, NOT PHYSICAL User Interface layer Business layer Service layer Data-access layer
Figure 6 β€” Layers organize code; tiers organize machines. A three-layer app can still run on a single tier.
Tier Layer
Separates Components across machines Code by responsibility
Nature Physical Logical / conceptual
Example Browser Β· Apache Β· MySQL UI Β· business Β· service Β· data-access
Counting Single, two, three, n-tier Any number, inside any tier
08

Recap

Tier = physical placementHow many machines your components are spread across.
Single-tierAll on one machine. Fastest, most private, but unupdatable and insecure.
Two-tierUI + logic on client, DB on a server you own. Low latency, cheap, code still exposed.
Three-tierUI, logic, DB each on their own machine. The web's default for simple sites.
N-tierAdds cache, queues, load balancers, search, microservices. A distributed system.
Layers β‰  tiersLayers are logical code structure; tiers are physical machine structure.
🎯
The single idea underneath it all

Each rung up the tier ladder exists to fix a limitation of the one below β€” trading local speed for control, security, and the ability to scale. You climb only as far as your requirements demand: give every component one job, keep them loosely coupled, and add a tier only when a real constraint pushes you to.

09

Further reading [+]

The source lesson lists no references, so these are added starting points I verified as live. Grouped by topic.

Tiers & layered architecture
[1]
Multitier architecture β€” Wikipedia Why read: the canonical definition of three-tier and n-tier, plus a clear treatment of presentation / application / data tiers and how "layers" and "tiers" differ.
The principles behind the tiers
[2]
Single-responsibility principle β€” Wikipedia Why read: unpacks Robert C. Martin's "one reason to change" idea β€” the exact principle that argues for keeping the database, logic, and UI on separate tiers.
[3]
Separation of concerns β€” Wikipedia Why read: traces the idea from Dijkstra to modern practice, with the HTML/CSS/JS and network-stack examples that make loose coupling concrete.
βœ…
Link check

All three links were fetched and resolved live on August 13, 2026. No page showed material changes that would contradict the concepts above.