Node.js Express API

Windsurfwindsurfexpressnode.jsapi

Windsurf rules for Node.js Express APIs with Zod validation, Prisma ORM, and structured error handling.

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

What you get when you save this prompt

Your workspace unlocks powerful tools to iterate and improve.

AI OPTIMIZE

AI Optimization

One-click improvement with structure analysis and pattern suggestions.

VERSION DIFF

Version History

Track every edit. Compare versions side-by-side with word-level diffs.

ORGANIZE
Development
Code Review
Testing
Marketing

Folders & Tags

Organize your library with nested folders, tags, and drag-and-drop.

MCP
$ npm i -g @promptingbox/mcp
Claude · Cursor · ChatGPT

Use 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.