prompt template
Create a complete REST API for a [RESOURCE_NAME] resource. **Fields:** [LIST_FIELDS_WITH_TYPES — e.g., "title: string, price: number, category: enum(electronics,books,clothing), isActive: boolean"] Generate the following for Next.js API routes (App Router): 1. **GET /api/[resource]** — list all with pagination, sorting, and filtering 2. **GET /api/[resource]/[id]** — get single by ID 3. **POST /api/[resource]** — create with input validation 4. **PATCH /api/[resource]/[id]** — partial update 5. **DELETE /api/[resource]/[id]** — soft delete For each endpoint include: - TypeScript types for request/response - Input validation with clear error messages - Proper HTTP status codes (200, 201, 400, 404, 500) - Try/catch with consistent error response shape - SQL queries using parameterized statements (no ORM) Also generate: - The SQL CREATE TABLE statement - A shared types file - A shared db utility for running queries
How to Use This Prompt
- 1Copy the prompt template above
- 2Paste into claude
- 3Replace [bracketed placeholders] with your specific project details
- 4Iterate on the AI output to refine and customize the results
More Backend Prompts
Related backend templates from the vault
⚙️
Rate-Limited API with Token Bucket
Use this prompt to rate-limited api with token bucket with AI assistance
Beginnerrate-limitingtoken-bucket
⚙️
Distributed Transaction Saga Implementation
PROImplement a saga pattern for distributed transactions with compensation logic and failure recovery
Advancedbackendsaga-pattern
⚙️
Database Transaction Manager
Use this prompt to database transaction manager with AI assistance
Intermediatetransactionsdatabase
⚙️
Background Job Queue Pattern
PROImplement a lightweight background job queue using PostgreSQL
Advancedjobsqueue
You Might Also Like
Prompts from other categories that share similar tags
🎨
Frontend
Dark Mode Implementation Guide
Add a complete dark mode system to an existing Next.js app
Shared:next.js
🔌
API Design
API Contract First Design
Design a complete API contract before writing any implementation code
Shared:rest
🔌
API DesignPRO
Webhook System Designer
Design and implement a webhook delivery system
Shared:backend
🎨
Frontend
Responsive Landing Page Builder
Generate a complete, conversion-optimized landing page
Shared:next.js
Keep Exploring the Vault