Skip to main content
rule

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.

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/node-express.mdc
Open on GitHub

What 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.mdc

Frontmatter: description, globs, alwaysApply

Step 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

Similar IDE rules

All IDE rules for Backend and APIs →

From the same set210

plasticode-telegram-api-cursorrules-prompt-file A Cursor rule that points the assistant at PHP 7.4, Plasticode and the Telegram Bot API. Useful when your bot is built on Plasticode and you want PSR-12 code. ★ 41,024repo stars pandas-scikit-learn-guide-cursorrules-prompt-file Directs Cursor to write vectorized Python data analysis code, follow PEP 8 standards, and keep Jupyter notebooks reproducible. ★ 41,024repo stars optimize-rell-blockchain-code-cursorrules-prompt-f A Cursor rule for Rell blockchain development on Chromia. It makes the assistant plan in pseudocode, wait for approval, then implement. ★ 41,024repo stars optimize-dry-solid-principles-cursorrules-prompt-f A Cursor rule that steers the assistant toward DRY and SOLID edits, respect for the existing architecture and questions before coding. ★ 41,024repo stars nextjs15-supabase-cursorrules-prompt-file A Cursor rule that keeps the agent inside a Next.js 15, Supabase and TypeScript strict stack — from session checks to RLS and Stripe keys. ★ 41,024repo stars nextjs15-react19-vercelai-tailwind-cursorrules-prompt-file Defines architecture standards for Next.js 15, React 19, Tailwind CSS, and Vercel AI SDK in Cursor. Guides component design, async runtime APIs, and typed form handling. ★ 41,024repo stars nextjs This rule guides Next.js work with TypeScript and Tailwind UI. Use it when shaping project structure, components, routes, forms, and data loading. ★ 41,024repo stars nextjs-vercel-typescript-cursorrules-prompt-file A Cursor rule that sets code style and file structure for Next.js projects with TypeScript, Vercel middleware and a KV database. ★ 41,024repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor