PluginBench
Rule

node express

via PatrickJS/awesome-cursorrules

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

What is node express?

Comprehensive guide for building production-ready Express.js applications with proper project structure, security, authentication, and deployment patterns. Use this rule when developing REST APIs and backend services with Node.js and Express.

  • Establish project structure with organized routes, middleware, and modules by domain
  • Configure Express with security middleware, CORS, rate limiting, and input validation
  • Implement authentication patterns including JWT, password hashing, sessions, and role-based access control
  • Integrate databases with proper ORM/ODM, migrations, connection pooling, and query optimization
  • Apply performance optimization through caching, async operations, and connection pooling
  • Set up testing with unit tests, integration tests, and proper test coverage

Applies to

File patterns this rule matches.

**/*.js
**/*.ts
src/**/*.ts
Rule definition (reference)

Source of truth, from the repository.

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

Related rules

Senior full-stack TypeScript, React, Node.js guidance with clean architecture, testing, and WHY-oriented reasoning.

**/*
41k
via PatrickJS/awesome-cursorrules

Quantitative factor research skills for designing, evaluating, and mining alpha factors in equities markets.

**/*
41k
via PatrickJS/awesome-cursorrules

Android development with Jetpack Compose, clean architecture, and Material Design 3.

**/*
41k
via PatrickJS/awesome-cursorrules

Angular development with Novo Elements UI library using standalone components.

**/*
41k
via PatrickJS/awesome-cursorrules

Expert Angular 18 + TypeScript development with Jest, emphasizing clean code and performance.

**/*
41k
via PatrickJS/awesome-cursorrules

Manage Kubernetes clusters, add-ons, stacks, and credentials via the Ankra CLI platform.

**/*.sh +5
41k
via PatrickJS/awesome-cursorrules