A cloud-based development environment supporting popular frameworks with auto-scaling Docker containers
Features β’ Architecture β’ Quick Start β’ Development
- 14+ Framework Templates: React, Vue, Svelte, Solid, Lit, Preact, Vanilla JS/TS
- Language Support: JavaScript, TypeScript, HTML, CSS, JSON, Markdown, and more
- Smart Code Completion: Monaco Editor with IntelliSense and syntax highlighting
- Multi-Editor Support: Both Monaco Editor and CodeMirror integration
- Auto-Scaling Containers: Dynamic Docker container provisioning
- Kubernetes Deployment: Automated container orchestration and management
- Isolated Environments: Each project runs in its own container
- Resource Monitoring: Real-time CPU, memory, and storage tracking
- Integrated Terminal: Full-featured terminal with session persistence
- Package Management: npm install/uninstall with real-time updates
- Dev Server Management: Start/stop/monitor development servers
- File System Access: Complete file tree navigation and editing
- Live Preview: Real-time preview of running applications
- Firebase Authentication: Secure user authentication and session management
- Real-time Collaboration: WebSocket-based real-time updates
- Cloud Storage: Persistent file storage and project management
- Session Recovery: Automatic session restoration after disconnection
- Health Monitoring: Comprehensive system health checks
- Usage Analytics: Resource usage tracking and optimization
- Background Jobs: BullMQ-powered asynchronous task processing
- Automatic Cleanup: Smart resource cleanup and garbage collection
CodeStudio employs a microservices architecture with containerized development environments, designed for scalable cloud-based development.
graph TB
subgraph "Client Layer"
UI[React Frontend<br/>Monaco Editor β’ CodeMirror]
UI -->|HTTP + WebSocket| LB[Load Balancer]
end
subgraph "API Gateway"
LB --> API[Express.js Server<br/>Port 8000]
API --> AUTH[Firebase Auth<br/>JWT Tokens]
API --> RATE[Rate Limiting<br/>Request Throttling]
end
subgraph "Application Layer"
CTRL[Controllers<br/>Request Handlers]
SERV[Services<br/>Business Logic]
QUEUE[BullMQ Queue<br/>Background Jobs]
WS[WebSocket Server<br/>Real-time Updates]
end
subgraph "Container Orchestration"
K8S[Kubernetes Cluster<br/>Auto-scaling]
DOCKER[Docker Registry<br/>Framework Images]
DEPLOY[Deployment Controller<br/>Container Management]
end
subgraph "Data Layer"
MONGO[(MongoDB<br/>Projects & Sessions)]
REDIS[(Redis<br/>Queue & Cache)]
STORAGE[(Cloud Storage<br/>Project Files)]
end
API --> CTRL
CTRL --> SERV
SERV --> QUEUE
SERV --> WS
SERV --> K8S
K8S --> DOCKER
DOCKER --> DEPLOY
SERV --> MONGO
QUEUE --> REDIS
DEPLOY --> STORAGE
classDef clientLayer fill:#e1f5fe
classDef apiLayer fill:#f3e5f5
classDef appLayer fill:#e8f5e8
classDef containerLayer fill:#fff3e0
classDef dataLayer fill:#ffebee
class UI,LB clientLayer
class API,AUTH,RATE apiLayer
class CTRL,SERV,QUEUE,WS appLayer
class K8S,DOCKER,DEPLOY containerLayer
class MONGO,REDIS,STORAGE dataLayer
| Component | Technology | Purpose | Key Features |
|---|---|---|---|
| Frontend | React 19 + Vite | Modern development UI | Monaco Editor, CodeMirror, real-time updates |
| Backend | Node.js + Express | RESTful API server | Modular architecture, middleware pipeline |
| Database | MongoDB + Mongoose | Document storage | Flexible schema, session persistence |
| Queue | Redis + BullMQ | Background processing | Job queuing, retry logic, monitoring |
| Container | Docker + Kubernetes | Container orchestration | Auto-scaling, resource management |
| Editor | Monaco + CodeMirror | Code editing | Multi-language support, IntelliSense |
| Terminal | node-pty + xterm.js | Terminal emulation | Full PTY support, session persistence |
| Auth | Firebase Auth | User authentication | JWT tokens, session management |
| Storage | Firebase Storage | File persistence | Cloud storage, automatic backup |
React (JS/TS) β’ Vue (JS/TS) β’ Svelte (JS/TS) β’ Solid (JS/TS)
Lit (JS/TS) β’ Preact (JS/TS) β’ Vanilla (JS/TS)
Create Request β Template Selection β Docker Build β
Kubernetes Deploy β Resource Allocation β Development Ready
const scalingRules = {
cpu: "Scale up when CPU > 70% for 5 minutes",
memory: "Scale up when Memory > 80% for 3 minutes",
requests: "Scale up when active sessions > 10",
cooldown: "5 minute cooldown between scaling events"
}- Node.js 18+ with npm
- Docker and Docker Compose
- Kubernetes cluster (local or cloud)
- MongoDB instance
- Redis instance
git clone https://github.com/yourusername/CodeStudio.git
cd CodeStudio# Install client dependencies
cd client && npm install && cd ..
# Install server dependencies
cd server && npm install && cd ..Server Environment (server/.env):
# Database Configuration
MONGODB_URL=mongodb://localhost:27018/codestudio
# Redis Configuration
REDIS_HOST=localhost
REDIS_PORT=6379
# Firebase Configuration
FIREBASE_PROJECT_ID=your-project-id
FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
FIREBASE_CLIENT_EMAIL=your-service-account@your-project.iam.gserviceaccount.com
# Server Configuration
PORT=8000
NODE_ENV=developmentClient Environment (client/.env):
# API Configuration
VITE_API_BASE_URL=http://localhost:8000
# Firebase Configuration
VITE_FIREBASE_API_KEY=your-firebase-api-key
VITE_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your-project-idOption A: Development Mode
# Start database services
cd server && npm run db:up
# Start backend server
npm run server:dev
# Start worker process (in another terminal)
npm run worker:dev
# Start frontend client (in another terminal)
cd client && npm run devOption B: Docker Compose
# Start all services
docker-compose up --build
# Access applications
# Frontend: http://localhost:5173
# Backend: http://localhost:8000# Test server health
curl http://localhost:8000/health
# Test client access
open http://localhost:5173CodeStudio/
βββ client/ # React Frontend
β βββ src/
β β βββ components/ # React Components
β β β βββ IDE.jsx # Main IDE Interface
β β β βββ Dashboard.jsx # Project Dashboard
β β β βββ AuthModal.jsx # Authentication
β β β βββ modals/ # Modal Components
β β βββ contexts/ # React Contexts
β β β βββ AuthContext.jsx # Authentication State
β β β βββ ProjectContext.jsx # Project Management
β β βββ hooks/ # Custom Hooks
β β β βββ useTerminal.js # Terminal Integration
β β β βββ useResourceMonitor.js # Resource Monitoring
β β βββ services/ # API Services
β β β βββ authService.js # Authentication
β β β βββ fileOperations.js # File Management
β β β βββ serverManager.js # Server Operations
β β βββ stores/ # State Management
β β βββ authStore.js # Auth State (Zustand)
β β βββ projectStore.js # Project State
β βββ package.json
β
βββ server/ # Node.js Backend
β βββ config/ # Configuration
β β βββ firebase.js # Firebase Setup
β β βββ db.js # Database Connection
β βββ models/ # Database Models
β β βββ Deployment.js # Project Schema
β β βββ Session.js # Session Schema
β β βββ Terminal.js # Terminal Schema
β β βββ User.js # User Schema
β βββ routes/ # API Routes
β β βββ api.js # Main API Routes
β βββ services/ # Business Logic
β β βββ firebaseFileService.js # File Operations
β βββ workers/ # Background Workers
β β βββ worker.js # Main Worker
β β βββ deploymentJobs.js # Deployment Jobs
β βββ middleware/ # Express Middleware
β β βββ authMiddleware.js # Authentication
β βββ server.js # Entry Point
β
βββ docker-compose.yml # Docker Configuration
βββ README.md # Documentation
# Client Development
cd client
npm run dev # Start development server
npm run build # Build for production
npm run lint # Run ESLint
# Server Development
cd server
npm run server:dev # Start with nodemon
npm run worker:dev # Start worker with nodemon
npm run db:up # Start MongoDB and Redis
npm run db:down # Stop database services
# Database Operations
npm run db:seed # Seed sample data
npm run db:reset # Reset database// Add to server/config/frameworks.js
const frameworks = {
'my-framework': {
name: 'My Framework',
variants: ['javascript', 'typescript'],
dockerImage: 'my-framework:latest',
defaultPort: 3000,
startCommand: 'npm run dev'
}
};// Add to client/src/components/TechIcons.js
export const techIcons = {
'my-framework': {
color: '#ff6b6b',
svg: <svg>...</svg>
}
};# Build and push Docker image
docker build -t my-framework:latest .
docker push my-framework:latest
# Add Kubernetes deployment template
kubectl apply -f k8s/my-framework-template.yaml# Build and run with Docker Compose
docker-compose up --build -d
# Scale services
docker-compose up --scale server=3 --scale worker=2# Apply Kubernetes manifests
kubectl apply -f k8s/
# Check deployment status
kubectl get pods -l app=codestudio
# View logs
kubectl logs -f deployment/codestudio-server# Required for production
NODE_ENV=production
MONGODB_URL=mongodb://mongo:27017/codestudio
REDIS_HOST=redis
REDIS_PORT=6379
FIREBASE_PROJECT_ID=your-project-id
FIREBASE_PRIVATE_KEY=your-private-key- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Install dependencies:
npm install - Start development:
npm run dev - Make your changes
- Run tests:
npm test - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Submit a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Monaco Editor - VS Code's editor
- CodeMirror - Versatile text editor
- Docker - Containerization platform
- Kubernetes - Container orchestration
- React - Frontend framework
- Node.js - JavaScript runtime