Module 1 · FundamentalsLesson 1 of 885 minBeginner

Clients and servers

Every app is a conversation. A client asks for something, a server answers.

Try it

Press "Send request" and follow the request out and the response back. Then switch to "Slow server" and watch the wait grow.

When you open an app, two kinds of computers are involved.

The client is the thing in your hand: a browser, a phone app, a smart TV. It shows you screens and collects your taps.

The server is a computer somewhere else, usually in a data centre. It stores the data (your photos, your messages, the price of a train ticket) and decides what you are allowed to see and change.

How they talk

The client sends a request: "give me the home feed" or "save this comment". The server does some work, then sends a response: the feed, or "saved".

The client always speaks first. A server sits and waits for requests, often from millions of clients at once.

Why split it this way?

  • One source of truth. If every phone kept its own copy of the data, they would disagree. The server keeps the real copy.
  • Rules stay safe. The server checks passwords and permissions. Code on a phone can be changed by anyone; code on the server cannot.
  • Clients stay light. A cheap phone can use a huge service, because the heavy work happens on the server.

Where time goes

Every request pays three costs: travel to the server, work on the server, and travel back. Most of system design is about shrinking one of those three, or doing the work fewer times.

Quick check

You tap "like" on a photo. Where is the like actually saved?