This guide shows how to set up and run CodeRunner locally or on a remote machine.
- Node.js (v18 or higher)
- Docker (Must be installed and running)
- npm
- git (for cloning the repository)
git clone https://www.github.com/hemanthkumar2k04/CodeRunner.git
cd CodeRunnerRun the provided setup script to automate building Docker images and starting the servers:
chmod +x setup.sh
sudo ./setup.shThis script will:
- Build necessary Docker runtime images
- Setup frontend and backend
The system requires Docker images for each programming language. Build the ones you need:
# Build Python runtime
cd runtimes/python
docker build -t python-runtime .
# Build JavaScript/Node runtime
cd ../javascript
docker build -t node-runtime .
# Build Java runtime (optional)
cd ../java
docker build -t java-runtime .
# Build C++ runtime (optional)
cd ../cpp
docker build -t cpp-runtime .
# Return to root
cd ../..Note: At minimum, build the python-runtime image. Add others as needed.
cd server
npm install
npm run devThe backend server will start on http://localhost:3000.
You should see output like:
Container Pool Initialized 🚀
Server running on http://localhost:3000
cd client
npm install
npm run devVite will start and show:
➜ Local: http://localhost:5173/
➜ Network: http://192.168.x.x:5173/
- Local access: Open
http://localhost:5173/in your browser - Remote access: Use the Network URL shown above to access from another machine
Both the backend and frontend are configured to be network-accessible:
- Frontend: Accessible via the Network URL printed by Vite (e.g.,
http://192.168.0.250:5173/) - Backend: The frontend automatically detects the server IP and connects to port 3000 on the same host
If you run CodeRunner on machine 192.168.0.250:
- Access frontend from another machine:
http://192.168.0.250:5173/ - Backend automatically connects to:
http://192.168.0.250:3000/
Edit server/src/config.ts to customize:
- Server port (default: 3000)
- Container pool size (default: 3 per language)
- Memory limits per container
- CPU limits per container
- Execution timeout (default: 5000ms)
- Supported languages and Docker images
Environment Variables:
Create a .env.local file in the client/ directory:
VITE_SERVER_URL=http://your-server-ip:3000If not set, the frontend will automatically use the same hostname it's accessed from.
Vite Server:
Edit client/vite.config.ts to change the development server:
server: {
host: '0.0.0.0', // Expose to all network interfaces
port: 5173,
}Solution: Ensure Docker is running:
# On Linux
sudo systemctl start docker
# On Mac
open /Applications/Docker.app
# On Windows
# Start Docker Desktop from Start menuSolution: On Linux, add your user to the docker group:
sudo usermod -aG docker $USER
newgrp docker- Create a file: Click the
+icon in the Workspace explorer - Write code: The file opens automatically in the Monaco editor
- Save: Press
Ctrl+S(orCmd+Son Mac) - Run: Click the Run button or press
Ctrl+Enter - View output: Console output appears in real-time in the bottom panel
| Language | Extensions | Required Runtime |
|---|---|---|
| Python | .py |
python-runtime |
| JavaScript | .js |
node-runtime |
| Java | .java |
java-runtime |
| C++ | .cpp, .c++ |
cpp-runtime |
- Create a file named
hello.py - Write:
for i in range(5): print(f"Hello {i}")
- Click Run
- See output in the console
Backend:
cd server
npm run dev # Runs with ts-node (auto-reload)Frontend:
cd client
npm run dev # Runs with Vite (auto-reload)Backend:
cd server
npm run build
npm startFrontend:
cd client
npm run build
# Serve the `dist/` folder with a static serverSolution: Kill the process using the port:
# On Linux/Mac
lsof -i :3000 # Find process ID
kill -9 <PID> # Kill it
# On Windows
netstat -ano | findstr :3000
taskkill /PID <PID> /FSolution:
- Ensure backend is running:
http://localhost:3000/ - Check the browser console (F12) for connection errors
- On remote access, use the Network URL for frontend
- Backend automatically detects the server IP
Solution:
- Verify Docker is running:
docker ps - Check images exist:
docker images | grep runtime - Check server logs for detailed errors
- Rebuild images if needed
- Read Architecture & Design to understand how execution works
- Check Tech Stack for technology details
- See Contributing to contribute to the project