A comprehensive learning project demonstrating production-level Node.js backend development with microservices architecture.
Build a distributed backend system for document management that demonstrates:
- Microservices Architecture: Multiple independent services communicating via REST and message queue
- Advanced Node.js: Cluster mode, worker threads, streams, event loop optimization
- Production Patterns: Caching, rate limiting, retry mechanisms, graceful shutdown
- Observability: Structured logging, metrics, distributed tracing
- Security: JWT authentication, RBAC, rate limiting, input validation
┌─────────────┐
│ Client │
└──────┬──────┘
│
┌──────▼──────────┐
│ API Gateway │
│ (Port 3000) │
└────────┬────────┘
│
┌────┴────┬──────────┬───────────┬──────────┬──────────┐
│ │ │ │ │ │
┌───▼──┐ ┌──▼──┐ ┌────▼────┐ ┌──▼───┐ ┌───▼────┐ ┌──▼────┐
│ Auth │ │User │ │Document │ │ File │ │ Search │ │Worker │
│ 3001 │ │3002 │ │ 3003 │ │ 3004 │ │ 3005 │ │ 3006 │
└──┬───┘ └──┬──┘ └────┬────┘ └──┬───┘ └───┬────┘ └──┬────┘
│ │ │ │ │ │
└─────────┴──────────┴───────────┴──────────┴──────────┘
│
┌──────────────┼──────────────┬──────────┐
│ │ │ │
┌────▼────┐ ┌───▼────┐ ┌───▼──┐ ┌──▼──────┐
│PostgreSQL│ │MongoDB │ │Redis │ │RabbitMQ │
└─────────┘ └────────┘ └──────┘ └─────────┘
bookspace/
├── services/ # Microservices
│ ├── gateway/ # API Gateway + routing (3000)
│ ├── auth/ # Authentication service (3001)
│ ├── user/ # User management (3002)
│ ├── document/ # Document CRUD + versioning (3003)
│ ├── file/ # File upload with streams (3004)
│ ├── search/ # Search service (3005)
│ └── worker/ # Background job processor (3006)
├── packages/ # Shared packages
│ ├── common/ # Utilities, errors, validators
│ ├── logger/ # Structured logging (Pino)
│ └── types/ # Shared TypeScript types
├── docker-compose.yml # Local development environment
└── prometheus.yml # Metrics collection config
- Node.js >= 20.0.0
- npm >= 10.0.0
- Docker & Docker Compose
- Install dependencies:
npm install- Build shared packages:
npm run build -w @bookspace/logger
npm run build -w @bookspace/common
npm run build -w @bookspace/types- Start infrastructure services:
docker-compose up -dThis starts:
- PostgreSQL on port 5432
- MongoDB on port 27017
- Redis on port 6379
- RabbitMQ on port 5672 (management UI: http://localhost:15672)
- Prometheus on port 9090
- Grafana on port 3001
Each service can be developed independently:
cd services/gateway
npm install
npm run dev- Runtime: Node.js 20+ with TypeScript
- Framework: Express (with option for Fastify)
- Monorepo: npm workspaces
- PostgreSQL: User data, notifications (with Prisma ORM)
- MongoDB: Documents, comments (with Mongoose)
- Redis: Caching, rate limiting, session store
- RabbitMQ: Message queue for async tasks
- Prometheus: Metrics collection
- Grafana: Metrics visualization
- Docker: Containerization
- Pino: Structured logging
- Zod: Runtime validation
- JWT: Authentication tokens
- bcrypt: Password hashing
- Monorepo setup with npm workspaces
- TypeScript configuration
- Shared packages (logger, common, types)
- Docker Compose infrastructure
- Next: Start building services
- API Gateway implementation
- JWT authentication
- User service with PostgreSQL
- Rate limiting
- Microservices vs Monolith
- Event-driven architecture
- Database selection (SQL vs NoSQL)
- Caching strategies
- Message queues vs Event buses
- Horizontal scaling
- Node.js cluster mode
- Worker threads
- Streams and backpressure
- Graceful shutdown
- Observability (logs, metrics, traces)
- Security best practices
- Prometheus: http://localhost:9090
- Grafana: http://localhost:3001 (admin/admin)
- RabbitMQ Management: http://localhost:15672 (bookspace/bookspace_dev_password)
You'll be ready to answer senior-level interview questions about:
- How to scale Node.js applications
- Microservices architecture patterns
- Message queue reliability
- Caching strategies
- Authentication & authorization
- Database transactions in distributed systems
- Error handling & retry mechanisms
- Production monitoring & observability
- Node.js internals (event loop, cluster, workers)
- System design for high-traffic APIs
MIT - This is a learning project
Current Status: Phase 1 Foundation Complete ✅
Next: Implement API Gateway and Auth Service