Cloud Code is a cloud-based development environment that allows users to write, run, and interact with their code in real time. It uses container-based code execution and dynamic deployment through Kubernetes.
- Cloud-Based IDE with syntax highlighting & error detection
- Real-Time Collaboration via WebSockets
- Isolated Kubernetes Pods per project
- Integrated Terminal with PTY support
- File Management with S3 synchronization
- Authentication System (JWT-based)
- Dynamic Project Routing (
{username}-{replid}.example.com) - Multi-Language Support via base templates
Tech Stack: Express.js, MongoDB, AWS SDK
- Responsibilities:
- User authentication (Signup/Signin)
- Project initialization
- S3 template management
- JWT token generation
Tech Stack: Express-WS, Node-PTY, Socket.IO
- Key Components:
- WebSocket server for real-time updates
- File sync service (local ↔ S3)
- PTY terminal management
- Container lifecycle management
Tech Stack: Kubernetes Client, YAML
- Functions:
- Dynamic pod creation/deletion
- Service configuration
- Namespace management
- Ingress rule updates
Tech Stack: NGINX Ingress Controller
- Features:
- Traffic routing based on subdomains
- SSL termination
- Load balancing
- Security policies
Tech Stack: React, Redux, Xterm.js, Monaco Editor
- Components:
- Code Editor (Monaco)
- Terminal Emulator (Xterm)
- File Explorer
- Collaboration Panel
- Authentication UI
| Component | Technology |
|---|---|
| Container Runtime | Kubernetes + Docker |
| Storage | AWS S3 |
| Real-Time | WebSockets/Socket.IO |
| Terminal | Xterm.js + node-pty |
| Editor | Monaco Editor |
| Auth | JWT + Cookie Sessions |
| CI/CD | Kubernetes Manifests |
- Pod Isolation: Each user session runs in separate Kubernetes namespace
- Network Policies: Restrict inter-pod communication
- JWT Validation: Token verification for all WebSocket connections
- S3 IAM Policies: Bucket access restricted per user
- Ingress Validation: Strict hostname routing rules
- Kubernetes cluster (minikube for local but note that you need domain for routing and ingress ip should be exposed over internet to setp up DNS record *.example.com)
- AWS S3 bucket with templates
- MongoDB instance
- Node.js v18+
-
Clone Repository
git clone https://github.com/adeebkhans/CloudCode.git cd cloudcode -
Configure Environment
# Backend (in each service) cp backend/.env.example backend/.env # Frontend cp frontend/.env.example frontend/.env
-
Install Dependencies
# Backend services cd backend && npm install # Frontend cd frontend && npm install
-
Start Services
# Init Service cd backend/init-service && npm start # Runner Service cd backend/runner-service && npm start Note: for note pty package you may see some errors, please make sure to install "MSVC v143 - VS 2022 C++ x64/x86 Spectre-mitigated libraries" from visual studio builder # Orchestrator cd backend/orchestrator && npm start # Frontend cd frontend && npm run dev
-
Deploy Kubernetes Components
kubectl create namespace ingress-nginx kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/cloud/deploy.yaml
- User signs up/in via frontend
- Init service creates project skeleton in S3
- Orchestrator creates Kubernetes resources
- Runner service initializes container
- Frontend connects via WebSocket:
- Editor ↔ File Service
- Terminal ↔ PTY Service
- All changes sync to S3 periodically
The terminal interface uses:
- xterm.js: Browser-based terminal emulator
- xterm-addon-fit: Auto-resize functionality
- node-pty: Pseudoterminal backend
- Kubernetes Dashboard: Pod health monitoring
- Prometheus+Grafana: Metrics collection
- S3 Access Logs: File change tracking
- MongoDB Auditing: Auth attempts logging
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
Happy Coding! ^_^