Fundamentalsclient-serverclientserverrequest–responserequest-response

Client–server model

Definition

In the client–server model, a client initiates each exchange by sending a request, and a server that owns the data or logic handles it and returns a response.

In practice

Almost every web system follows it: a browser or mobile app is the client, an API server is the server, and that server is in turn a client of its database and other services. Centralising data on the server keeps one source of truth and lets many clients share it, while every request pays network round trips, so the number of calls per page matters.

The model is synchronous by default: the client waits, so it needs timeouts, and the server must be reachable, so one server is a single point of failure. Servers are usually kept stateless and replicated behind a load balancer. When the server needs to push data, plain request–response gives way to WebSockets, server-sent events or push notifications.

Example

A phone app sends GET /orders/42 to the API, which queries PostgreSQL and returns a JSON order in 80 ms, 60 ms of which is network round trip.