Client–Server Architecture

REST APIs commonly follow a client-server architecture. The client initiates requests, while the server processes requests and returns representations of resources.

The client might be a browser, mobile application, CLI, another backend service, or an IoT device. The server owns application logic and data.

Separating client and server allows them to evolve independently. A React application can consume an API implemented by Node.js, Java, Go, Python, or another technology without knowing the implementation details.

Responsibilities

Client

Requests resources and operations

The client decides what it needs and sends HTTP requests.

Server

Processes requests

The server validates input, executes business logic, and creates responses.

Database

Persists application state

The database is an implementation detail behind the API.

Client–Server Separation
Key Takeaways
  • Clients and servers can evolve independently.

  • The API forms a boundary between client and server.

  • Database details should normally remain behind the API.