API Route Generator
Both editors excel at pattern-matching from reference code. Pointing to an existing route as a style guide produces remarkably consistent output. The comprehensive endpoint list prevents incomplete CRUD implementations.
Generate a REST API route for {{resource_name}} following this project's existing patterns. Reference route: {{reference_route_path}} (use this as the style guide) Framework: {{framework}} ORM: {{orm}} Auth: {{auth_method}} Endpoints to create: - GET /api/{{resource_name}} — list with pagination, filtering by {{filter_fields}}, sorting - GET /api/{{resource_name}}/[id] — single resource with {{related_resources}} included - POST /api/{{resource_name}} — create with Zod validation - PATCH /api/{{resource_name}}/[id] — partial update - DELETE /api/{{resource_name}}/[id] — soft delete if project uses it, hard delete otherwise Each endpoint must include: - Auth check (match the pattern in {{reference_route_path}}) - Input validation with descriptive error messages - Proper HTTP status codes (201 for create, 204 for delete, 422 for validation errors) - Rate limiting if the project has it - Consistent response shape matching existing endpoints Also generate: - TypeScript types for request/response bodies - A Zod schema for the create and update payloads - An API client function that the frontend can use to call each endpoint
Variables to customize
Why this prompt works
Both editors excel at pattern-matching from reference code. Pointing to an existing route as a style guide produces remarkably consistent output. The comprehensive endpoint list prevents incomplete CRUD implementations.
What you get when you save this prompt
Your workspace unlocks powerful tools to iterate and improve.
AI Optimization
One-click improvement with structure analysis and pattern suggestions.
Version History
Track every edit. Compare versions side-by-side with word-level diffs.
Folders & Tags
Organize your library with nested folders, tags, and drag-and-drop.
$ npm i -g @promptingbox/mcpUse Everywhere
Access prompts from Claude, Cursor, ChatGPT & more via MCP integration.
Your prompts, organized
Save, version, and access your best prompts across ChatGPT, Claude, Cursor, and more.