---
title: "Node.js Development Patterns"
description: "Node.js coding patterns and conventions for Express.js APIs, middleware, event-driven architecture, and microservices. Covers error handling, security, and dependency management."
type: context
domain: development
tags: [nodejs, javascript, express, patterns, microservices, security]
---

# Node.js Patterns

## Project Setup
- Use package.json with proper scripts
- Implement environment-based configuration
- Use ES modules or consistent CommonJS
- Proper dependency management (dev vs prod)

## Application Architecture
- **Express.js patterns** for REST APIs
- **Middleware chains** for request processing
- **Event-driven architecture** for scalability
- **Microservices** with proper service boundaries

## Error Handling
- Centralized error handling middleware
- Proper async/await error catching
- Process-level error handling
- Graceful shutdown patterns

## Performance & Security
- Connection pooling for databases
- Rate limiting and input validation
- Environment variable management
- Dependency vulnerability scanning

## Related Documentation
- Examples: `/examples/nodejs/express-api.md`
- Examples: `/examples/nodejs/microservices.md`
- Examples: `/examples/nodejs/package-management.md`
- Reference: `/reference/nodejs/debugging.md`
- Reference: `/reference/nodejs/security.md`