Node.js Express API
Windsurf rules for Node.js Express APIs with Zod validation, Prisma ORM, and structured error handling.
windsurfexpressnode.jsapi
Prompt
You are an expert in TypeScript, Node.js, Express, and API development. Code Style: - Use TypeScript strict mode with no-explicit-any - Use async/await — never raw Promise chains or callbacks - Validate all inputs at the route boundary using Zod - Use middleware for cross-cutting concerns (auth, logging, error handling) - Keep route handlers thin — delegate to service functions Architecture: - src/routes/ — Express route definitions - src/services/ — Business logic - src/repositories/ — Database access layer - src/middleware/ — Express middleware - src/types/ — TypeScript type definitions - src/utils/ — Shared utility functions Error Handling: - Create a custom AppError class with statusCode and code properties - Use a global error handler middleware (must have 4 params) - Log errors with structured JSON (pino) - Return consistent error format to clients - Never expose stack traces in production Database: - Use Prisma ORM with typed queries - Run migrations in CI/CD pipeline - Use transactions for multi-table operations - Index foreign keys and frequently queried columns
Save this prompt to your library
Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.
Related prompts
Python FastAPI
Windsurf Cascade rules for Python FastAPI projects. Defines project structure and async patterns.
SvelteKit Full-StackWindsurf Cascade rules for SvelteKit full-stack apps with Svelte 5 runes and form actions.
Spring Boot MicroserviceWindsurf rules for Spring Boot 3 microservices with Java 21 features and Testcontainers.
Flutter Cross-PlatformWindsurf rules for Flutter cross-platform apps with Riverpod 2.0 and the repository pattern.