Back to Library
Coding
Featured

REST API Generator

Generate complete REST API endpoints with proper structure, validation, and documentation.

11,230 uses
6 variables
API
backend
REST
CRUD

Customize Prompt

Fill in the variables below to customize this prompt template

Name of the resource

Backend framework

Database type

Authentication method

Resource fields and types

Any additional requirements

Generated Prompt

Generate a complete REST API for {{resourceName}} with the following requirements:

Framework: {{framework}}
Database: {{database}}
Authentication: {{auth}}

Resource fields:
{{fields}}

Generate the following:

1. **Model/Schema** - Database model with proper types and validation

2. **Routes** - RESTful endpoints:
   - GET /{{resourceName}} - List with pagination, filtering, sorting
   - GET /{{resourceName}}/:id - Get single resource
   - POST /{{resourceName}} - Create new resource
   - PUT /{{resourceName}}/:id - Update resource
   - DELETE /{{resourceName}}/:id - Delete resource

3. **Controller** - Business logic with error handling

4. **Validation** - Input validation rules

5. **Tests** - Unit tests for each endpoint

6. **Documentation** - OpenAPI/Swagger spec

Additional requirements: {{requirements}}

Recommended Models

claude-3-5-sonnet
gpt-4o
deepseek-coder

Tips for Better Results

  • Be specific with your variable inputs for more accurate outputs
  • Try different models to compare results and find the best fit
  • Adjust the prompt based on your specific use case
  • Use the playground to test and iterate on your prompts