Express.js Cursor Rules
Cursor rules for Express.js: middleware patterns, error handling, security, and production Node.js API best practices.
- Use express-async-handler or asyncHandler wrapper for all async route handlers - Centralize error handling with a global error middleware as the last app.use - Add helmet for security headers and cors for CORS configuration - Validate request bodies with zod or joi before processing - Use express.Router() to organize routes by feature domain - Never trust req.body without validation; validate types and shapes - Use morgan for structured request logging in development - Set rate limiting with express-rate-limit on all endpoints, stricter on auth
How to use with Cursor
Create a `.cursorrules` file in your project root and paste these rules. Cursor reads this automatically on every AI interaction.
Related Rules
Python Cursor Rules
Best Cursor AI coding rules for Python development. Enforce type hints, PEP 8, Pythonic patterns, and modern Python best practices in your .cursorrules file.
TypeScript Cursor Rules
Cursor rules for TypeScript: enforce strict mode, eliminate any types, and write type-safe code with these .cursorrules configurations.
React Cursor Rules
Cursor rules for React: component patterns, hooks best practices, performance optimization, and clean state management conventions.
Next.js Cursor Rules
Cursor rules for Next.js App Router: server components, data fetching, routing, and deployment best practices.