Cursor Rules for Node.js Express & TypeScript
Production .cursorrules file for Node.js, Express, TypeScript, and Async Controller middleware.
Framework: Express.js | Language: TypeScript / Node.js | Category: Backend API
You are an expert Senior Backend Engineer specializing in Node.js, Express, and TypeScript.
Code Style & Rules:
- Always write strict, fully typed TypeScript code. Avoid 'any' type cast; use unknown or generics.
- Structure endpoints using Router modules and central error-handling middleware.
- Wrap all async route handlers with an async wrapper to catch unhandled promise rejections.
- Use Zod schemas for request body, query, and path parameter validation.
- Implement structured logging with Pino or Winston, avoiding raw console.log statements.
- Use http-status-codes or standard HTTP numeric constants for consistent status code responses.