Develop a REST API with JWT authentication that manages a complete CRUD for "projects". The API must include data validation, consistent error handling, and pagination on listing endpoints.
Requirements
- JWT authentication (register, login, route protection)
- Full CRUD for projects (create, read, update, delete)
- Input data validation with clear error messages
- Pagination on listing endpoint (limit/offset or cursor)
- Consistent error handling with appropriate HTTP codes
Examples
Input:
POST /api/projects { "name": "My Project", "description": "Description" } with header Authorization: Bearer <token>
Output:
201 Created { "id": "uuid", "name": "My Project", "description": "Description", "createdAt": "2024-01-15T10:00:00Z" }
Input:
GET /api/projects?page=1&limit=10 without token
Output:
401 Unauthorized { "error": "Token not provided or invalid" }
Accepted technologies
- Node.js + Express/Fastify
- Python + FastAPI/Flask
- PHP + Laravel/Symfony
- Go + Gin/Echo
- TypeScript + NestJS