Start all services with hot-reload enabled:
docker-compose up -dThis will:
- Start all microservices in development mode
- Enable hot-reload (changes in source code will automatically restart the service)
- Mount source code as volumes for live editing
- Start supporting services (PostgreSQL, Redis, Kafka)
Build and run optimized production containers:
docker-compose -f docker-compose.prod.yml up -d- Docker (v20.10+) and Docker Compose (v2.0+)
- Environment Variables: Copy
.env.exampleto.envand configure:
cp .env.example .envThe Codexa platform consists of these microservices:
| Service | Port | Description |
|---|---|---|
| auth-service | 3000 | Authentication & Authorization |
| utils-service | 3001 | Email & File Upload |
| problem-service | 3002 | Problem Management |
| classroom-service | 3003 | Classroom & Assignment |
| code-service | 3004 | Code Execution |
| analytics-service | 3005 | Analytics & Metrics |
| ai-service | 3006 | AI-powered Features |
| postgres | 5432 | Database |
| redis | 6379 | Cache & Queues |
| kafka | 9092 | Message Broker |
# Development mode (hot-reload enabled)
docker-compose up -d
# Production mode
docker-compose -f docker-compose.prod.yml up -d
# Start specific service
docker-compose up -d auth-service# All services
docker-compose logs -f
# Specific service
docker-compose logs -f auth-service
# Last 100 lines
docker-compose logs --tail=100 -f# Stop all
docker-compose down
# Stop and remove volumes (WARNING: deletes data)
docker-compose down -v# Rebuild all
docker-compose build
# Rebuild specific service
docker-compose build auth-service
# Rebuild and restart
docker-compose up -d --build# Run database migrations
docker-compose exec auth-service npm run db:migrate
# Access shell
docker-compose exec auth-service sh
# Run Prisma Studio
docker-compose exec auth-service npx prisma studio# Run migrations
docker-compose exec -w /app/db-service auth-service npx prisma migrate deploy
# Generate Prisma Client
docker-compose exec -w /app/db-service auth-service npx prisma generate
# Seed database
docker-compose exec auth-service node seed.jsAll services are configured with hot-reload in development mode:
- TypeScript services: Use
tsxwithnodemonortsx watch - Changes: Automatically detected when you edit files
- Restart: Services restart within 1-2 seconds
To debug a specific service:
- Stop the service:
docker-compose stop auth-service- Run it interactively:
docker-compose run --rm -p 3000:3000 auth-service# Install in container
docker-compose exec auth-service npm install <package-name>
# Or rebuild the service
docker-compose build auth-serviceKey environment variables (add to .env):
# Database
DATABASE_URL=postgresql://user:password@postgres:5432/codexa
# JWT Secrets
JWT_ACCESS_SECRET=your-access-secret-here
JWT_REFRESH_SECRET=your-refresh-secret-here
# CORS
CORS_ORIGIN=http://localhost:3001
# Email (SMTP)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password
EMAIL_FROM=noreply@codexa.com
# Cloudinary (File Upload)
CLOUDINARY_CLOUD_NAME=your-cloud-name
CLOUDINARY_API_KEY=your-api-key
CLOUDINARY_API_SECRET=your-api-secret
# Judge0 (Code Execution)
JUDGE0_API_URL=https://judge0-ce.p.rapidapi.com
# Google AI
GOOGLE_API_KEY=your-google-api-key
# Build Target (development or production)
BUILD_TARGET=development
NODE_ENV=development# Check logs
docker-compose logs
# Check container status
docker-compose ps
# Restart all services
docker-compose restart# Check PostgreSQL is running
docker-compose ps postgres
# Check DATABASE_URL in .env
echo $DATABASE_URL
# Verify database is healthy
docker-compose exec postgres pg_isready -U user -d codexaIf a port is already in use, modify the port mapping in docker-compose.yml:
ports:
- "3001:3000" # Maps host port 3001 to container port 3000# Ensure volumes are mounted correctly
docker-compose down
docker-compose up -d
# Check if nodemon/tsx is running
docker-compose logs auth-service# WARNING: This deletes all data
docker-compose down -v
docker system prune -a
docker-compose up -dFor production deployment:
- Use
docker-compose.prod.yml - Set
NODE_ENV=productionandBUILD_TARGET=productionin.env - Use proper secrets management (AWS Secrets Manager, HashiCorp Vault, etc.)
- Configure reverse proxy (nginx, Traefik)
- Set up monitoring and logging
# Build production images
docker-compose -f docker-compose.prod.yml build
# Push to registry
docker-compose -f docker-compose.prod.yml push
# Deploy
docker-compose -f docker-compose.prod.yml up -d- Layer Caching: Dockerfiles are optimized for layer caching
- Multi-stage Builds: Separate build and runtime stages
- Volume Mounts: Development uses volume mounts for hot-reload
- Health Checks: Services wait for dependencies to be healthy
- Resource Limits: Add resource limits in production
For issues or questions, please contact the development team or create an issue in the repository.