Latest
Express.js Web Framework
Express Nodejs This document provides comprehensive guidelines for express nodejs development and best practices. Routing & Middleware Route Route definitions and methods Implement proper route definitions and methods Follow best practices for optimal results Route Route parameters and wildcards Implement proper route parameters and wildcards Follow best practices for optimal results Middleware Middleware execution order Implement proper middleware execution order Follow best practices for optimal results Custom Custom middleware development Implement proper custom middleware development Follow best practices for optimal results Third-party Third-party middleware integration Implement proper third-party middleware integration Follow best practices for optimal results Request Handling Body Body parsing (JSON, form data, files) Implement proper body parsing (json, form data, files) Follow best practices for optimal results Query Query string and parameter extraction Implement proper query string and parameter extraction Follow best practices for optimal results Header Header manipulation Implement proper header manipulation Follow best practices for optimal results Cookie Cookie and session management Implement proper cookie and session management Follow best practices for optimal results Request Request validation and sanitization Implement proper request validation and sanitization Follow best practices for optimal results Authentication & Security JWT JWT token authentication Implement proper jwt token authentication Follow best practices for optimal results Session-based Session-based authentication Implement proper session-based authentication Follow best practices for optimal results Password Password hashing and validation Implement proper password hashing and validation Follow best practices for optimal results CORS CORS configuration Implement proper cors configuration Follow best practices for optimal results Security Security middleware (helmet, rate limiting) Implement proper security middleware (helmet, rate limiting) Follow best practices for optimal results Testing Strategies Unit Unit testing with Jest Implement proper unit testing with jest Follow best practices for optimal results Integration Integration testing with Supertest Implement proper integration testing with supertest Follow best practices for optimal results API API endpoint testing Implement proper api endpoint testing Follow best practices for optimal results Mock Mock database operations Implement proper mock database operations Follow best practices for optimal results Test Test environment setup Implement proper test environment setup Follow best practices for optimal results Performance Optimization Response Response compression (gzip) Implement proper response compression (gzip) Follow best practices for optimal results Caching Caching strategies Implement proper caching strategies Follow best practices for optimal results Database Database query optimization Implement proper database query optimization Follow best practices for optimal results Memory Memory leak prevention Implement proper memory leak prevention Follow best practices for optimal results Cluster Cluster mode for scaling Implement proper cluster mode for scaling Follow best practices for optimal results WebSocket Integration Socket.IO Socket.IO implementation Implement proper socket.io implementation Follow best practices for optimal results Real-time Real-time communication Implement proper real-time communication Follow best practices for optimal results WebSocket WebSocket authentication Implement proper websocket authentication Follow best practices for optimal results Room Room and namespace management Implement proper room and namespace management Follow best practices for optimal results Event-driven Event-driven architecture Implement proper event-driven architecture Follow best practices for optimal results Advanced Features Custom Custom middleware development Implement proper custom middleware development Follow best practices for optimal results Plugin Plugin architecture Implement proper plugin architecture Follow best practices for optimal results Microservices Microservices integration Implement proper microservices integration Follow best practices for optimal results API API gateway patterns Implement proper api gateway patterns Follow best practices for optimal results Event-driven Event-driven programming Implement proper event-driven programming Follow best practices for optimal results Development Tools Nodemon Nodemon for development Implement proper nodemon for development Follow best practices for optimal results Debug Debug module for logging Implement proper debug module for logging Follow best practices for optimal results ESLint ESLint and Prettier setup Implement proper eslint and prettier setup Follow best practices for optimal results Hot Hot reload configuration Implement proper hot reload configuration Follow best practices for optimal results API API testing with Postman Implement proper api testing with postman Follow best practices for optimal results Follow these comprehensive guidelines for successful express nodejs implementation.
Node.js Microservices Architecture
Nodejs Microservices This document provides comprehensive guidelines for nodejs microservices development and best practices. Node.js Backend Development Express.js Express.js framework mastery Implement proper express.js framework mastery Follow best practices for optimal results Fastify Fastify for high performance Implement proper fastify for high performance Follow best practices for optimal results Koa.js Koa.js for modern async handling Implement proper koa.js for modern async handling Follow best practices for optimal results Middleware Middleware patterns and composition Implement proper middleware patterns and composition Follow best practices for optimal results Error Error handling and logging Implement proper error handling and logging Follow best practices for optimal results Database Integration MongoDB MongoDB with Mongoose ODM Implement proper mongodb with mongoose odm Follow best practices for optimal results PostgreSQL PostgreSQL with Sequelize/Prisma Implement proper postgresql with sequelize/prisma Follow best practices for optimal results Redis Redis for caching and sessions Implement proper redis for caching and sessions Follow best practices for optimal results Database Database per service pattern Implement proper database per service pattern Follow best practices for optimal results Connection Connection pooling and optimization Implement proper connection pooling and optimization Follow best practices for optimal results Service Communication HTTP/REST HTTP/REST inter-service calls Implement proper http/rest inter-service calls Follow best practices for optimal results Message Message queues (RabbitMQ, Apache Kafka) Implement proper message queues (rabbitmq, apache kafka) Follow best practices for optimal results Event-driven Event-driven architecture Implement proper event-driven architecture Follow best practices for optimal results Circuit Circuit breaker pattern Implement proper circuit breaker pattern Follow best practices for optimal results Service Service discovery mechanisms Implement proper service discovery mechanisms Follow best practices for optimal results Testing Strategies Unit Unit testing with Jest Implement proper unit testing with jest Follow best practices for optimal results Integration Integration testing with Supertest Implement proper integration testing with supertest Follow best practices for optimal results Contract Contract testing with Pact Implement proper contract testing with pact Follow best practices for optimal results Load Load testing with Artillery Implement proper load testing with artillery Follow best practices for optimal results End-to-end End-to-end testing automation Implement proper end-to-end testing automation Follow best practices for optimal results Security Best Practices Input Input validation and sanitization Implement proper input validation and sanitization Follow best practices for optimal results Helmet.js Helmet.js for security headers Implement proper helmet.js for security headers Follow best practices for optimal results CORS CORS configuration Implement proper cors configuration Follow best practices for optimal results SQL SQL injection prevention Implement proper sql injection prevention Follow best practices for optimal results Secrets Secrets management Implement proper secrets management Follow best practices for optimal results Message Patterns Publish-subscribe Publish-subscribe messaging Implement proper publish-subscribe messaging Follow best practices for optimal results Request-reply Request-reply patterns Implement proper request-reply patterns Follow best practices for optimal results Event Event sourcing implementation Implement proper event sourcing implementation Follow best practices for optimal results Saga Saga pattern for transactions Implement proper saga pattern for transactions Follow best practices for optimal results Dead Dead letter queue handling Implement proper dead letter queue handling Follow best practices for optimal results Error Handling Global Global error handling middleware Implement proper global error handling middleware Follow best practices for optimal results Graceful Graceful error responses Implement proper graceful error responses Follow best practices for optimal results Circuit Circuit breaker implementation Implement proper circuit breaker implementation Follow best practices for optimal results Retry Retry mechanisms with exponential backoff Implement proper retry mechanisms with exponential backoff Follow best practices for optimal results Fallback Fallback strategies Implement proper fallback strategies Follow best practices for optimal results Production Readiness Process Process management with PM2 Implement proper process management with pm2 Follow best practices for optimal results Cluster Cluster mode for scalability Implement proper cluster mode for scalability Follow best practices for optimal results Memory Memory and CPU monitoring Implement proper memory and cpu monitoring Follow best practices for optimal results Log Log aggregation Implement proper log aggregation Follow best practices for optimal results Incident Incident response procedures Implement proper incident response procedures Follow best practices for optimal results Follow these comprehensive guidelines for successful nodejs microservices implementation.
Node.js Express API Expert
Node.js Express API Development Best Practices Comprehensive guide for building robust, scalable, and secure RESTful APIs with Node.js and Express.js. RESTful API Design Resource-Based URL Structure Use nouns for resources, not verbs Implement consistent naming conventions Follow REST principles for HTTP methods Example API structure: HTTP Status Code Standards Use appropriate status codes for different scenarios Implement consistent response formats Handle edge cases with proper status codes Example status code usage: Request Validation and Sanitization Validate all incoming data using schemas Sanitize inputs to prevent injection attacks Provide clear validation error messages Example with Joi validation: Error Handling and Logging Centralized Error Handling Create custom error classes for different error types Implement global error handling middleware Log errors appropriately for debugging Example error handling system: Structured Logging Use proper logging libraries (Winston, Pino) Implement different log levels Structure logs for easy parsing and monitoring Example logging setup: Testing and Quality Assurance API Testing Strategy Write unit tests for business logic Implement integration tests for endpoints Use proper test databases for isolation Example testing setup: Summary Checklist [ ] Implement modular route organization with Express Router [ ] Use proper middleware chain ordering [ ] Handle async operations with proper error catching [ ] Validate and sanitize all inputs [ ] Implement JWT authentication with refresh tokens [ ] Use bcrypt for password hashing [ ] Configure security headers with helmet [ ] Implement rate limiting and CORS [ ] Create centralized error handling [ ] Use structured logging for monitoring [ ] Implement database connection pooling [ ] Add caching for performance optimization [ ] Write comprehensive tests for all endpoints [ ] Configure proper environment variables [ ] Use PM2 for production process management Follow these practices to build secure, scalable, and maintainable Express.js APIs that perform well in production environments.
Browse Cursor Rules - Cursor IDE Community Prompts & Configurations