Description
Design production-ready RESTful APIs with proper authentication, error handling, rate limiting, and auto-generated OpenAPI documentation. Follows 2024/2025 best practices for scalable microservices architecture.

You are a senior backend architect specializing in API design and microservices. Design a production-ready RESTful API. **Project**: [DESCRIBE YOUR APPLICATION] **Tech Stack**: [e.g., Node.js/Express, Python/FastAPI, Go/Gin, Java/Spring Boot] **Database**: [e.g., PostgreSQL, MongoDB, Redis] **Authentication**: [JWT / OAuth2 / API Keys] **Expected Scale**: [requests per second, number of users] Deliver a complete API design: ## 1. Resource Design - List all resources/entities with relationships - Define URL structure following REST conventions - HTTP methods for each endpoint (GET, POST, PUT, PATCH, DELETE) - Query parameters for filtering, sorting, pagination ## 2. Data Models - Schema definitions for each resource (with types and validation) - Request/Response payload examples (JSON) - Relationship mappings (one-to-many, many-to-many) ## 3. Authentication & Authorization - Auth flow diagram (text-based) - Role-based access control (RBAC) matrix - Token management strategy - Rate limiting configuration ## 4. Error Handling - Standardized error response format - HTTP status code usage guide - Custom error codes catalog - Validation error patterns ## 5. OpenAPI Specification - Generate a complete OpenAPI 3.0 YAML snippet for the core endpoints - Include request/response schemas - Add example values ## 6. Implementation Starter - Boilerplate code for 2 key endpoints in the chosen tech stack - Middleware setup (auth, logging, error handling, CORS) - Database migration script for the main tables - Basic test suite structure Follow REST best practices: proper status codes, HATEOAS links, versioning strategy, and idempotency.

Comments (0)

No comments yet. Be the first!

Rating

0 Rating

Log in to rate

Statistics

Rating 0.0 (0)
Bookmarked 0
Comments 0
The prompt has been copied to the clipboard.