Modern System Design & API Architecture · Chapter 1 · ~15 min · Beginner
Client-Server Architecture & How the Web Works
Learn the foundational mental model behind every web and mobile app on earth: the Client-Server model, what happens when you type a URL, 3-tier architecture, and why latency vs bandwidth matters.
- Master the Client-Server mental model with simple analogies
- Trace what happens when you type a web URL step by step
- Understand the 3-Tier Architecture (Frontend, Backend, Database)
- Learn the critical difference between Latency and Bandwidth
1The Client-Server Model: The Restaurant Analogy
Every system on the internet — from Instagram and YouTube to your banking app — operates on a simple relationship called the Client-Server Model.
Think of it like visiting a restaurant:
The Client
Your laptop browser or smartphone app. It places an order: "Please show me my profile page."
The Network (HTTP)
Takes your request across the internet to the kitchen, and brings back the response.
The Server & DB
Prepares the data, verifies your password, queries the database, and returns the result.
In the Client-Server architecture, what role does a web browser (like Chrome or Safari) play?
2What Happens When You Type google.com?
This is the #1 most asked question in software engineering and system design interviews. When you hit Enter in your browser:
1. DNS Lookup (Finding the Address)
Computers don't speak human names like "google.com"; they speak numerical IP addresses (like 142.250.190.46). The browser asks the Domain Name System (DNS) to look up the IP address.
2. Establishing Connection (TCP & TLS)
The client connects to that IP address and establishes an encrypted HTTPS tunnel so no eavesdropper can intercept your data.
3. HTTP GET Request
The client sends an HTTP message: GET / HTTP/1.1.
4. Server Response
The server replies with 200 OK and provides the HTML, CSS, and images to draw the page.
What is the purpose of the Domain Name System (DNS) on the internet?
3The 3-Tier Architecture of Modern Apps
Nearly every web application you interact with is organized into three distinct tiers:
Frontend
HTML, CSS, JavaScript, and React. Runs inside the user's browser or mobile phone screen.
Backend (API)
Node.js, Python, or Java. Handles business logic, checks credentials, and processes orders.
Database
PostgreSQL, MySQL, or MongoDB. Safely and permanently stores user accounts, posts, and transactions.
4Latency vs. Bandwidth: Why Speed is King
In system design, people often confuse these two fundamental performance metrics:
Bandwidth (The Pipe Width)
How much data can travel through the network per second (e.g. 100 Mbps or 1 Gbps). Think of this like the number of lanes on a highway.
Latency (The Speed of Travel)
How long it takes for a single packet to travel from Client to Server and back (measured in milliseconds, ms). Think of this like the speed limit. Even with a 10-lane highway, traveling from New York to Sydney still takes time!
If a website has a high bandwidth connection (1 Gbps) but users in Australia experience 300ms delays when clicking buttons on a server in New York, what is the problem?
5Hands-On: Step Through a Live Web Request
Click "Next Step" to trace a web packet traveling across the internet from client to DNS, backend, and database:
Journey of a Web Request (From Click to Screen)
1. User Enters URL & DNS Lookup
Latency: ~15 msYou type 'codershub.com'. The browser asks a DNS server (the Internet's phonebook): 'What is the numerical IP address for this name?' DNS replies: '76.76.21.21'.
6Chapter Knowledge Challenge
Test your understanding of DNS, client-server models, latency, and 3-tier architectures:
What is the difference between Latency and Bandwidth?
Why are backend application servers typically kept stateless in modern web architecture?
7Recap
- The Client requests data; the Server processes requests and returns responses.
- DNS translates readable domain names into IP addresses.
- Web apps use a 3-tier architecture: Frontend (presentation), Backend (logic), and Database (storage).
- Bandwidth is volume capacity; Latency is time delay. Distance creates latency.
Ready for Chapter 2? Mark this chapter as complete to proceed: