Full-Stack CRUD API Generator
Generate complete CRUD API endpoints with database schema, validation, error handling, and frontend integration code.
You are a senior full-stack engineer. Generate a production-ready CRUD API.
Resource: {{resourceName}} Fields: {{fields}} Backend Framework: {{framework || "Express.js"}} Database: {{database || "PostgreSQL with Prisma"}} Frontend: {{frontend || "React with fetch/axios"}} Authentication: {{auth || "JWT-based"}}
Generated Code Structure
1. Database Schema ({{database}})
prisma// schema.prisma model {{resourceName}} { id String @id @default(cuid()) {{#each fields}} {{this}} {{/each}} createdAt DateTime @default(now()) updatedAt DateTime @updatedAt }
Or the equivalent for {{database}}. Include proper indexes, relations, and constraints.
2. Validation Schema
Define validation rules for create and update operations:
Create{{resourceName}}:
- [field]: [type], [required], [min/max], [custom validation]
- ...
Update{{resourceName}}:
- [field]: [type], [optional], [min/max], [custom validation]
- ...
3. API Endpoints
List GET /api/{{resourceName | downcase}}s
- Pagination: ?page=1&limit=20
- Search: ?search=term
- Filter: ?field=value
- Sort: ?sort=field&order=asc|desc
- Response:
{ data: [...], total, page, limit, totalPages }
Get One GET /api/{{resourceName | downcase}}s/:id
- Response:
{ data: {...} } - Error: 404 if not found
Create POST /api/{{resourceName | downcase}}s
- Body: validated fields
- Response: 201
{ data: {...} } - Error: 400 validation errors
Update PUT /api/{{resourceName | downcase}}s/:id
- Body: partial or full fields
- Response: 200
{ data: {...} } - Error: 404 not found, 400 validation
Delete DELETE /api/{{resourceName | downcase}}s/:id
- Response: 204 No Content
- Error: 404 not found
4. Error Handling Middleware
{
error: {
code: "VALIDATION_ERROR | NOT_FOUND | UNAUTHORIZED | INTERNAL",
message: "Human-readable message",
details: [...] // field-level errors
}
}
5. Frontend Integration Example
For {{frontend}}, provide:
// Example: React hook or service function
async function fetch{{resourceName}}s(params) { ... }
async function create{{resourceName}}(data) { ... }
async function update{{resourceName}}(id, data) { ... }
async function delete{{resourceName}}(id) { ... }
Include loading states, error handling, and TypeScript types if applicable.
6. Authentication Integration
For {{auth}}, include:
- Middleware/guard for each protected route
- Token extraction and validation
- Role-based access if applicable
Output with code blocks for all generated code, bold endpoint descriptions, and | table | for field specifications.
- Open the Full-Stack CRUD API Generator workflow in your AI chat interface.
- Replace the variables in [brackets] with your specific inputs.
- For best results, use claude-sonnet-4 as the target model.
- Review the generated output and iterate by refining your inputs.
- Save your final result and share it with your team.
- Quickly generate development-specific content with structured prompts.
- Standardize development workflows across your team using a shared template.
- Onboard new team members with a repeatable development process.
- Automate api tasks with AI-powered development workflows.
- Automate crud tasks with AI-powered development workflows.
- Automate backend tasks with AI-powered development workflows.
- Use Full-Stack CRUD API Generator to create a api project from scratch.
- Adapt Full-Stack CRUD API Generator for a different development domain with custom variables.
- Combine Full-Stack CRUD API Generator with other workflows in the development category for a complete pipeline.
- Run Full-Stack CRUD API Generator with multiple AI models to compare output quality.
- Schedule Full-Stack CRUD API Generator as a recurring development task.
- Simplified version: remove optional variables for faster results.
- Advanced version: add custom validation steps after generation.
- Batch version: run Full-Stack CRUD API Generator on multiple inputs sequentially.
- api-focused variant: emphasize api best practices in the prompt.
- crud-focused variant: emphasize crud best practices in the prompt.
- Skipping variable customization — always replace [bracketed] placeholders.
- Using the wrong AI model tier for complex outputs.
- Not iterating on the first result — refinement improves quality significantly.
- Ignoring api best practices when customizing the prompt.
- Using claude-sonnet-4 outside its optimal use case for this workflow.
$ echo "contribute.sh"