A full-stack, multi-language code execution sandbox built with React, Node.js, and Docker.
Users can write code in the browser, select a language, and get real-time output from Docker containers.
- Secure Docker-based execution
- Each submission runs in a short-lived container with no persistent state
- Multi-language support
- Python and JavaScript
- Write just
console.log("Hello")
orprint("Hi")
- Code formatting
- Auto-format Python and JavaScript code for better readability
- Format button and keyboard shortcut (Ctrl+Shift+F)
- Temp file cleanup
- Smart error formatting
- Cleans up messy compiler output to show what matters
Layer | Tech |
---|---|
Frontend | React + CSS |
Backend | Node.js + Express |
Execution | Docker (python:3.11-slim , node:20-slim ) |
Code Handling | fs , uuid , child_process |
- Users type code and select a language in the frontend.
- The backend saves the code to a temporary file.
- Docker runs the code in a secure, language-specific container.
- The output or error is captured and returned to the frontend.
- The frontend displays the result in the browser.
- Node.js (v16 or higher)
- Docker (must be running)
- Python (v3.8 or higher, for optional Python backend)
git clone https://github.com/jadengong/code-execution-sandbox
cd code-execution-sandbox
From the root directory:
npm install
Navigate into the frontend /client
folder:
cd client
npm install
Option 1: Start with nodemon (Recommended)
npm run dev
Option 2: Start services separately
Start the backend server (from the root):
npm start
# Backend will run on http://localhost:5000
Start the frontend server (from /client
):
# PowerShell (Windows)
cd client; npm start
# Bash (macOS/Linux)
cd client && npm start
# Frontend will run on http://localhost:3000
# API calls will be automatically proxied to backend
Test the core functionality:
# Start local development
npm run dev
# Run backend tests
npm test
# Run frontend tests
cd client && npm test
GET /
- API informationGET /api/health
- Health checkPOST /api/execute
- Execute codePOST /api/cleanup
- Manual cleanup
- Clone and install dependencies (see Setup Instructions above)
- Start the backend server with
npm start
- Start the frontend with
cd client; npm start
(PowerShell) orcd client && npm start
(Bash) - Open your browser and start coding!
jest.setup.js
- Jest testing configuration
Happy Coding! 🎉
- Ctrl + Enter: Run Code
- Ctrl + Shift + S: Load Example
- Ctrl + Shift + F: Format Code