A modern online compiler supporting C++, Python, and Java with Docker containerization.
- Node.js 18+
- Docker Desktop
- Git
- Clone and install dependencies:
npm install- Build Docker images:
npm run docker:build- Start the application:
# Start both frontend and backend
npm run final
# Or start separately:
npm run dev # Frontend (Next.js)
npm run dev:server # Backend APIThe application uses separate Docker containers for each language:
- C++: GCC 12 with compilation and execution
- Python: Python 3.11 with standard library
- Java: OpenJDK 17 with compilation and execution
cd docker
chmod +x build-images.sh
./build-images.sh┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Frontend │ │ Backend API │ │ Docker │
│ (Next.js) │───▶│ (Express.js) │───▶│ Containers │
│ Port 3000 │ │ Port 3001 │ │ Isolated │
└─────────────────┘ └─────────────────┘ └─────────────────┘
POST /api/compile- Compile and execute codeGET /api/health- Health check
{
"language": "cpp|python|java",
"code": "source code string",
"input": "optional input string"
}{
"output": "execution output",
"success": true,
"exitCode": 0,
"executionTime": 1.23,
"language": "cpp"
}- Container Isolation: Each execution runs in a separate Docker container
- Resource Limits: Memory (128MB) and CPU (50%) restrictions
- Time Limits: 10s compilation, 5s execution timeout
- Network Isolation: Containers have no network access
- Read-only Mounts: Source code mounted as read-only
- Auto Cleanup: Containers and temp files automatically removed
npm run devnpm run dev:servernpm run final├── app/ # Next.js frontend
│ ├── api/ # API routes
│ ├── components/ # React components
│ └── globals.css # Global styles
├── server/ # Express.js backend
│ └── index.js # Main server file
├── docker/ # Docker configurations
│ ├── cpp/ # C++ runtime
│ ├── python/ # Python runtime
│ ├── java/ # Java runtime
│ └── build-images.sh # Build script
└── components/ # Shared UI components
For production deployment:
- Build Docker images on your server
- Configure environment variables
- Set up reverse proxy (nginx)
- Enable HTTPS
- Configure rate limiting
PORT=3001
DOCKER_HOST=unix:///var/run/docker.sock
MAX_EXECUTION_TIME=15000
MAX_MEMORY=128| Language | Version | Compiler/Runtime |
|---|---|---|
| C++ | GCC 12 | g++ |
| Python | 3.11 | python |
| Java | 17 | javac + java |
- Fork the repository
- Create a feature branch
- Make your changes
- Test with Docker containers
- Submit a pull request
MIT License - see LICENSE file for details.