Client-Server Architecture

Learn how the request-response cycle works — the fundamental pattern behind every web interaction.

Step 1 of 4

What are clients and servers?

The web runs on a simple idea: one computer asks for something, and another computer provides it.

Client: The program asking for data — usually your web browser (Chrome, Firefox, Safari). Your phone's browser, a mobile app, even a smart TV's Netflix app are all clients.

Server: A computer that stores website files (HTML, CSS, JS, images) and sends them to clients when asked. Servers run 24/7, waiting for requests. Companies like Google, Amazon, and Netflix run thousands of servers in huge buildings called data centers.

This arrangement is called client-server architecture, and it is the foundation of the web. Every time you visit a website, watch a video, or check your email, the same pattern plays out: your client sends a request, a server sends a response.

Why not just have everything on your own computer? Because the web needs shared, centralized data. When you post a photo on Instagram, it goes to Instagram's servers so that your friends' clients can fetch it. If it only lived on your phone, nobody else could see it.

Think of it this way: Think of a restaurant. You (the client) sit at a table and place an order (send a request). The kitchen (the server) receives your order, prepares the food, and sends it out to you (the response). You do not go into the kitchen yourself — you communicate through a structured system (the waiter, which is like HTTP).
Web Standard
A single computer can be both a client and a server. When a web developer runs a 'local server' on their laptop for testing, their browser (client) talks to a server program running on the same machine. This is how developers test websites before publishing them.