Prompt file imported from APagnieszka/10x-project (
.github/prompts/api-plan.prompt.md). Copyright stays with the author.
You are an experienced API architect tasked with creating a comprehensive REST API plan. Your plan will be based on the provided database schema, Product Requirements Document (PRD), and technology stack specified above. Carefully review the inputs and perform the following steps:
-
Analyze the database schema:
- Identify main entities (tables)
- Note relationships between entities
- Consider any indexes that may impact API design
- Pay attention to validation conditions specified in the schema.
-
Analyze the PRD:
- Identify key features and functionalities
- Note specific requirements for data operations (retrieving, creating, updating, deleting)
- Identify business logic requirements that go beyond CRUD operations
-
Consider the technology stack:
- Ensure the API plan is compatible with the specified technologies.
- Consider how these technologies may influence the API design
-
Create a comprehensive REST API plan:
- Define main resources based on database entities and PRD requirements
- Design CRUD endpoints for each resource
- Design endpoints for business logic described in the PRD
- Include pagination, filtering, and sorting for list endpoints.
- Plan appropriate use of HTTP methods
- Define request and response payload structures
- Include authentication and authorization mechanisms if mentioned in the PRD
- Consider rate limiting and other security measures
Before delivering the final plan, work inside <api_analysis> tags in your thinking block to break down your thought process and ensure you've accounted for all necessary aspects. In this section:
- List main entities from the database schema. Number each entity and quote the relevant part of the schema.
- List key business logic features from the PRD. Number each feature and quote the relevant part of the PRD.
- Map PRD features to potential API endpoints. For each feature, consider at least two possible endpoint designs and explain which one you chose and why.
- Consider and list any security and performance requirements. For each requirement, quote the part of the input documents that supports it.
- Clearly map business logic from PRD to API endpoints.
- Incorporate validation conditions from the database schema into the API plan.
This section may be quite long.
The final API plan should be formatted in markdown and contain the following sections:
# REST API Plan
## 1. Resources
- List each main resource and its corresponding database table
## 2. Endpoints
For each resource provide:
- HTTP Method
- URL Path
- Brief description
- Query parameters (if applicable)
- Request payload JSON structure (if applicable)
- Response payload JSON structure
- Success codes and messages
- Error codes and messages
## 3. Authentication and Authorization
- Describe the chosen authentication mechanism and implementation details
## 4. Validation and Business Logic
- List validation conditions for each resource
- Describe how business logic is implemented in the API
Ensure your plan is comprehensive, well-structured, and addresses all aspects of the input materials. If you must make any assumptions due to unclear input information, state them clearly in your analysis.
The final output should consist solely of the API plan in markdown format in English, which you will save to .ai/api-plan.md and should not repeat or reiterate any work done in the thinking block.
@.ai/db-plan.md @.ai/prd.md @.ai/tech-stack.md