Real-time collaborative code editing with secure sandboxed execution Built with Node.js, MongoDB, WebSocket, Docker, and Redis
CodeCrafter is a hardcore backend platform that enables multiple users to write, execute, and collaborate on code in real-time. Think of it as Google Docs for Code with a built-in secure code executor.
- ✅ Real-time Collaboration - Multiple users editing simultaneously with CRDT-based conflict resolution
- ✅ Secure Code Execution - Docker-based sandboxed environment
- ✅ Multi-language Support - JavaScript, Python, Java, C/C++, Go, Rust
- ✅ JWT Authentication - Secure user authentication and authorization
- ✅ WebSocket Communication - Real-time updates and collaboration
- ✅ Session Management - Create, join, and manage coding sessions
- ✅ CRDT Implementation - Conflict-free replicated data types for collaborative editing
- ✅ Background Workers - RabbitMQ-based job queue for code execution
- ✅ Redis Caching - Session storage and real-time data caching
- ✅ Rate Limiting - Protection against abuse and resource exhaustion
- ✅ Comprehensive Logging - Winston-based logging with multiple levels
- ✅ Health Monitoring - Built-in health checks and metrics
- ✅ Auto-scaling - Worker processes can be scaled based on demand
- 🐳 Docker & Docker Compose (recommended) OR
- Node.js 16+, MongoDB 4.4+, Redis 6+, RabbitMQ 3.8+
1️⃣ Clone Repository
git clone https://github.com/tanmayjoddar/Muweb.git
cd Muweb2️⃣ Start Everything (One Command!)
docker-compose up -d3️⃣ Verify Services
docker-compose ps4️⃣ Access Applications
- App: http://localhost:8000
- RabbitMQ: http://localhost:15672 (codecrafter / codecrafter123)
- Prometheus: http://localhost:9090
- Grafana: http://localhost:3001 (admin / codecrafter123)
✅ Done! Your entire stack is running.
1️⃣ Clone Repository
git clone https://github.com/tanmayjoddar/Muweb.git
cd Muweb2️⃣ Install Dependencies
npm install3️⃣ Set Up Environment
cp .env.example .env4️⃣ Start Application
npm run dev** 5️⃣ Start Worker (New Terminal)**
npm run worker# Start all services
docker-compose up -d
# Stop all services
docker-compose stop
# Restart specific service
docker-compose restart app
# Remove everything
docker-compose down
# Remove everything including data
docker-compose down -v# See all containers
docker-compose ps
# Real-time app logs
docker-compose logs -f app
# View last 50 lines
docker-compose logs app --tail 50
# All service logs
docker-compose logs# MongoDB shell
docker-compose exec mongo mongosh -u codecrafter -p codecrafter123
# Redis CLI
docker-compose exec redis redis-cli -a "your-password"
# PostgreSQL (if migrated)
docker-compose exec postgres psql -U codecrafter -d codecrafter# Run tests
docker-compose exec app npm test
# Database migration
docker-compose exec app npm run migrate
# View metrics
docker stats# Start 3 worker instances
docker-compose up -d --scale worker=3
# View all workers
docker-compose ps | grep worker| Service | URL | Port | Credentials |
|---|---|---|---|
| App | http://localhost:8000 | 8000 | - |
| Nginx | http://localhost:80 | 80 | - |
| RabbitMQ | http://localhost:15672 | 15672 | codecrafter / codecrafter123 |
| Prometheus | http://localhost:9090 | 9090 | - |
| Grafana | http://localhost:3001 | 3001 | admin / codecrafter123 |
| MongoDB | localhost | 27017 | codecrafter / codecrafter123 |
| Redis | localhost | 6379 | (from .env) |
cp .env.example .env# Database
MONGODB_URI=mongodb://codecrafter:codecrafter123@mongo:27017/codecrafter
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_PASSWORD=your_redis_password
# RabbitMQ
RABBITMQ_URL=amqp://rabbitmq:5672
RABBITMQ_USERNAME=codecrafter
RABBITMQ_PASSWORD=codecrafter123
# JWT
JWT_SECRET=your-super-secret-key-min-32-characters
JWT_REFRESH_SECRET=your-super-secret-refresh-key-min-32-chars
# Server
PORT=5000
NODE_ENV=development
FRONTEND_URL=http://localhost:3000
# Docker Limits
DOCKER_TIMEOUT=30
DOCKER_MEMORY_LIMIT=128m
DOCKER_CPU_LIMIT=0.5
# Languages
SUPPORTED_LANGUAGES=javascript,python,java,cpp,c,go,rust
DEFAULT_LANGUAGE=javascript# Run all tests
npm test
# Run specific test
npm test -- auth.test.js
# Watch mode
npm run test:watch
# With coverage
npm run test:coverage
# Run in Docker
docker-compose exec app npm testnpm run dev # Start with hot reload
npm run worker # Start code executor worker
npm start # Production start
npm test # Run tests
npm run migrate # Database migrationMuweb/
├── 📂 api/ # API Routes
├── 📂 config/ # Configuration
├── 📂 controllers/ # Business Logic
├── 📂 models/ # Data Models
├── 📂 middleware/ # Middleware
├── 📂 services/ # Services
├── 📂 websocket/ # WebSocket
├── 📂 workers/ # Background Workers
├── 📂 tests/ # Test Suite
├── 🐳 docker-compose.yml # Docker Setup
├── 📝 .env # Environment
└── 📦 package.json # Dependencies
# Check logs
docker-compose logs mongo
# Rebuild
docker-compose build --no-cache
docker-compose up -dnetstat -ano | findstr :5000
taskkill /PID <PID> /Flsof -i :5000
kill -9 <PID># Test connection
docker-compose exec mongo mongosh
docker-compose exec redis redis-cli ping
# Restart services
docker-compose restart# Check detailed logs
docker-compose logs app --tail 100
# View environment
docker-compose config | grep -A 20 "app:"
# Network check
docker network ls
docker network inspect muweb_codecrafter-network- 🐳 Docker Quick Start Guide - All Docker commands
- 🗄️ Local Redis & PostgreSQL Setup - Local database setup
- 🔄 MongoDB to PostgreSQL Migration - Complete migration guide
- ✅ JWT token-based authentication
- ✅ CORS protection
- ✅ Rate limiting (100 req/min)
- ✅ Input validation & sanitization
- ✅ SQL injection prevention
- ✅ XSS protection
- ✅ CSRF tokens
- ✅ Encrypted password hashing (bcrypt)
- ✅ Environment variable isolation
- ✅ Secure headers (Helmet.js)
This project is licensed under the MIT License - see the LICENSE file for details.
⭐ If you like this project, please give it a star!
3️⃣ Set Up Environment
cp .env.example .env4️⃣ Start Application
npm run dev5️⃣ Start Worker (New Terminal)
npm run worker