Backend Concepts
backendbackend-conceptsCore ConceptBeginner
REST API Architecture
Learn REST principles, statelessness, resource naming conventions, and best practices for building scalable RESTful APIs.
Verified: 2026-09-30
Tested on:node 22.x
Platforms:
webnode
#backend#rest#api#http#architecture
What is REST?
REST (Representational State Transfer) is an architectural style for designing networked applications. RESTful APIs use standard HTTP verbs and URIs to interact with abstract entities known as Resources.
6 Guiding Constraints of REST
- Client-Server: Complete separation of user interface concerns from data storage and business logic.
- Stateless: Each request from the client must contain all necessary information for the server to process it. The server stores no context between requests.
- Cacheable: Responses must explicitly define whether they can be cached by clients or intermediary proxies (
Cache-Controlheader). - Uniform Interface: Consistent resource identification (
/users), manipulation through representations (JSON), and self-descriptive messages. - Layered System: Clients cannot tell whether they are connected directly to the end server or an intermediary load balancer, proxy, or CDN.
- Code on Demand (Optional): Servers can temporarily extend client functionality by transferring executable code (e.g. JavaScript scripts).
REST Resource Naming Conventions
Always use plural nouns rather than verbs for endpoint URIs:
| Action | ❌ Bad (RPC Style) | ✅ Good (RESTful Style) |
|---|---|---|
| List all users | GET /getAllUsers | GET /api/v1/users |
| Get a single user | GET /getUserById?id=12 | GET /api/v1/users/12 |
| Create user | POST /createNewUser | POST /api/v1/users |
| Update user | POST /updateUser/12 | PUT /api/v1/users/12 |
| Delete user | POST /deleteUser?id=12 | DELETE /api/v1/users/12 |
| Get user orders | GET /getUserOrders/12 | GET /api/v1/users/12/orders |
API Versioning Strategies
- URI Path Versioning (Recommended):
/api/v1/users - Header Versioning:
Accept: application/vnd.company.v1+json - Query Parameter Versioning:
/api/users?version=1
Client-Server Architecture
Understand client-server separation of concerns, 2-tier vs 3-tier architectures, and how modern web clients communicate with backend servers.
HTTP Methods & Idempotency
Understand HTTP request methods (GET, POST, PUT, PATCH, DELETE), safety, idempotency, and when to use each in REST APIs.