node-express — Cursor rule: what it does, how to install
A Cursor rule for Node.js and Express.js projects, covering API design, security, databases, testing, and deployment.
.cursor/rules/node-express.mdcWhat node-express does
This rule gives Cursor a set of practices for Node.js and Express.js backend work. It covers project and module layout, middleware placement, domain-based routes, error handling, configuration, REST API versioning, request validation, response formats, and API documentation.
The guidance also covers ORM or ODM use, migrations, connection pooling, transactions, JWT, password hashing, sessions, OAuth, role-based access, CORS, rate limiting, security headers, caching, logging, monitoring, tests, Docker, environment variables, and CI/CD. It targets **/*.js, **/*.ts, and src/**/*.ts; because alwaysApply: false, the rule is not applied to every project file by default.
Install it by creating .cursor/rules/node-express.mdc in the project and placing the rule there. A file outside those glob patterns will not match the rule.
What it helps with
- organize a Node.js and Express.js project
- design a versioned REST API with request validation
- set up JWT authentication and role-based access
- connect a database with migrations and transactions
- prepare tests, Docker, and CI/CD
Example prompts for the agent
- Review this Node.js project and suggest a module layout with routes grouped by domain.
- Design versioning, request validation, and response formats for this Express.js API.
- Check error handling, JWT use, CORS, and rate limiting in these files.
How to install node-express
Manually: put the files in place
.cursor/rules/node-express.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/node-express.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/node-express.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/node-express.mdManually: put the files in place
.clinerules/node-express.mdStep by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules
Questions about node-express
How do I install node-express in Cursor?
Create .cursor/rules/node-express.mdc in the project and add the rule content to that file.
What does the node-express rule do?
It guides Cursor through Node.js and Express.js work, including project structure, REST APIs, databases, authentication, security, testing, and deployment.
Which files does node-express apply to?
The rule targets **/*.js, **/*.ts, and src/**/*.ts. With alwaysApply: false, it is not automatically active for every project file.
Source text
node-express.mdc · CC0-1.0
--- description: "Node.js and Express.js best practices for backend development" globs: **/*.js, **/*.ts, src/**/*.ts alwaysApply: false --- # Node.js and Express.js Best Practices ## Project Structure - Use proper directory structure - Implement proper module organization - Use proper middleware organization - Keep routes organized by domain - Implement proper error handling - Use proper configuration management ## Express Setup - Use proper middleware setup - Implement proper routing - Use proper error handling - Configure proper security middleware - Implement proper validation - Use proper static file serving ## API Design - Use proper REST principles - Implement proper versioning - Use proper request validation - Handle errors properly - Implement proper response formats - Document APIs properly ## Database Integration - Use proper ORM/ODM - Implement proper migrations - Use proper connection pooling - Implement proper transactions - Use proper query optimization - Handle database errors properly ## Authentication - Implement proper JWT handling - Use proper password hashing - Implement proper session management - Use proper OAuth integration - Implement proper role-based access - Handle auth errors properly ## Security - Use proper CORS setup - Implement proper rate limiting - Use proper security headers - Implement proper input validation - Use proper encryption - Handle security vulnerabilities ## Performance - Use proper caching - Implement proper async operations - Use proper connection pooling - Implement proper logging - Use proper monitoring - Handle high traffic properly ## Testing - Write proper unit tests - Implement proper integration tests - Use proper test runners - Implement proper mocking - Test error scenarios - Use proper test coverage ## Deployment - Use proper Docker setup - Implement proper CI/CD - Use proper environment variables - Configure proper logging - Implement proper monitoring - Handle deployment errors ## Best Practices - Follow Node.js best practices - Use proper async/await - Implement proper error handling - Use proper logging - Handle process signals properly - Document code properly
© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules