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
Requests resources and operations
The client decides what it needs and sends HTTP requests.
Processes requests
The server validates input, executes business logic, and creates responses.
Persists application state
The database is an implementation detail behind the API.
Clients and servers can evolve independently.
The API forms a boundary between client and server.
Database details should normally remain behind the API.