A distributed architecture where clients initiate requests and servers listen and respond. Every web page load, API call, or app interaction follows this model.
The backbone of the web. A stateless protocol where the client sends a method (GET, POST, PUT, DELETE), the server processes it, and returns a status code + body.
REST (Representational State Transfer) defines a uniform interface for client-server communication. Resources are identified by URLs, actions by HTTP verbs, and responses in JSON/XML.
Upgrades HTTP to a persistent, bidirectional connection. The server can push data to the client at any time — no polling required.
A cache sits between client and server to store frequent responses. On a cache hit, the origin server is bypassed entirely — slashing latency and cost.
All modern client-server communication should use TLS (HTTPS) to encrypt data in transit. Authentication (JWTs, sessions) controls who can access server resources.
flowchart LR
C["Client
(Browser / App)"]
N["Network
(Internet / TLS)"]
S["Server
(API / Origin)"]
D["Database"]
C -->|"HTTP Request"| N
N -->|"Forward"| S
S -->|"Query"| D
D -->|"Rows"| S
S -->|"HTTP 200 + JSON"| N
N -->|"Response"| C
style C fill:#12161f,stroke:#00b0ff,color:#fff
style N fill:#0d1117,stroke:#7c4dff,color:#aaa
style S fill:#12161f,stroke:#1de9b6,color:#fff
style D fill:#0d1117,stroke:#ff9100,color:#fff
Select a pattern to watch how data flows between client and server
Choosing the right communication protocol for your use case
| Protocol | Latency | State | Direction | Best For |
|---|---|---|---|---|
| HTTP/REST | Stateless | Request-Response | Web APIs, CRUD | |
| WebSocket | Stateful | Bidirectional | Chat, Live Data | |
| GraphQL | Stateless | Query-Based | Flexible APIs | |
| gRPC | Stateful | Bidirectional | Microservices |
| Feature | Client | Server |
|---|---|---|
| Initiated by | Client (always) | Server (push only with WS) |
| Connection lifetime | Short (per request) | Can be long-lived (WS) |
| State ownership | UI state, tokens | Sessions, DB, business logic |
| Security concern | XSS, token theft | SQL injection, DDoS |
| Scalability role | Stateless (easy to scale) | Bottleneck (needs strategies) |