Production-ready system with nginx load balancing, PM2 process management and Docker containerization.
Demonstrates capabilities:
├── config/
│ ├── nginx.conf # Nginx configuration
│ └── ecosystem.config.cjs # PM2 configuration
├── docker/
│ └── bun/ # Docker images
├── docker-compose.yaml # Docker Compose
├── src/
│ ├── client.ts # WebSocket client
│ ├── server.ts # WebSocket server
│ └── lib/
│ └── swarm.ts # Swarm configuration
└── logs/ # Nginx and PM2 logs
# Install dependencies
bun install
# Start with PM2
pm2 start config/ecosystem.config.cjs
# Start nginx
nginx -c $(pwd)/config/nginx.conf
# Build and start
docker-compose up --build
# Scaling
docker-compose up --scale app=5
NODE_ENV=production
WS_PORT=8080
NGINX_PORT=80
PM2_INSTANCES=5
OPENAI_API_KEY=your_openai_api_key
upstream app_servers {
server localhost:8081;
server localhost:8082;
server localhost:8083;
server localhost:8084;
server localhost:8085;
}
# PM2 monitoring
pm2 monit
# Nginx status
curl http://localhost/nginx_status
# Docker logs
docker-compose logs -f
Critical for: