Home › All rules › Community › Node Express Cursor Rules

Node Express Cursor Rules

Node.js and Express.js best practices for backend development

CursorNode.js / TypeScriptCommunity (CC0)

How to use

Save this as .cursor/rules/node-express.mdc in your project, commit it, and Cursor will load it. Review it first: community files can be opinionated or out of date.

Note: Review and test before use. Provided as is, without warranty. See Terms.

.cursor/rules/node-express.mdcDownload  
---
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

More: Node.js / TypeScript rules · all community rules

Related rules

Express 5 API AGENTS.md

AGENTS.md for Express 5 REST APIs in TypeScript with zod validation, error middleware, and supertest.

AGENTS.mdNode.js / TypeScript

Fastify 5 API rules

Cursor rules for Fastify 5 APIs in TypeScript: plugins and encapsulation, JSON schema validation, hooks, and inject tests.

CursorNode.js / TypeScript

TypeScript Node.js API Copilot instructions

Copilot instructions for Node.js + TypeScript APIs with Hono/Express, zod and Vitest.

GitHub CopilotNode.js / TypeScript

Es Module Nodejs Guidelines Cursor Rules

Cursor rules for ES Module development with Node.js guidelines.

CursorNode.js / TypeScriptCommunity (CC0)

Nodejs Mongodb Tutorial Cursor Rules

Cursor rules for Node.js development with MongoDB integration.

CursorNode.js / TypeScriptCommunity (CC0)

Copilot Sdk Nodejs Copilot Instructions

This file provides guidance on building Node.js/TypeScript applications using GitHub Copilot SDK.

GitHub CopilotNode.js / TypeScriptCommunity (MIT)

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.