Cursor Prompt: Build REST API Endpoints
When to Use This Prompt
Use this when you need CRUD API endpoints. Replace [resource] with your specific data type (e.g., projects, tasks, invoices).
The Prompt
Create REST API endpoints for a [YOUR RESOURCE] management system: - GET /api/[resource] — list all (with pagination, search, filters) - GET /api/[resource]/[id] — get single by ID - POST /api/[resource] — create new (with validation) - PUT /api/[resource]/[id] — update existing - DELETE /api/[resource]/[id] — soft delete Requirements: - Input validation using Zod schemas - Authentication check on all routes - Proper error responses (400, 401, 403, 404, 500) - Rate limiting headers - TypeScript types for request/response - Pagination with cursor-based approach Use Next.js API routes with Supabase for the database.
What to Customize
Replace [YOUR RESOURCE] and [resource] with your specific entity name. Adjust the fields and validation rules to match your data model.
Expected Output
5 API route files with full CRUD operations, Zod validation schemas, and proper error handling. Each endpoint returns typed JSON responses.