A full-stack code execution platform that allows users to write and execute code in multiple programming languages.
The project consists of three main components:
- Code Runner (Go) - Executes code in isolated environments
- Playground Server (Go) - API server with authentication and MongoDB integration
- Playground Client (Next.js) - Frontend web application
- User authentication (register, login, logout)
- Code execution in multiple languages (JavaScript, Python, Go, Java, C++, C, Rust)
- Execution history tracking
- Real-time code editing with Monaco Editor
- Secure code execution via isolated code runner
- Docker and Docker Compose
- Go 1.21+ (for local development)
- Node.js 18+ (for local development)
- Start the code runner:
cd code-runner
docker-compose up -d- Start the playground server:
cd playground-server
docker-compose up -d- Start the playground client:
cd playground-client
npm install
npm run devThe application will be available at:
- Client: http://localhost:3000
- Server API: http://localhost:8080
- Code Runner: http://localhost:8000
Already set up. See code-runner/README.md for details.
cd playground-server
go mod download
go run main.goMake sure MongoDB is running (via Docker or locally).
cd playground-client
npm install
npm run devMONGODB_URI- MongoDB connection string (default: mongodb://localhost:27017)DATABASE_NAME- Database name (default: playground)JWT_SECRET- Secret key for JWT tokensPORT- Server port (default: 8080)CODE_RUNNER_URL- Code runner URL (default: http://localhost:8000)
NEXT_PUBLIC_API_URL- Playground server URL (default: http://localhost:8080)
POST /api/auth/register- Register new userPOST /api/auth/login- Login userGET /api/auth/me- Get current user (protected)
POST /api/execute- Execute code (protected)GET /api/executions- Get execution history (protected)
- Go
- Gin (HTTP framework)
- MongoDB
- JWT authentication
- Docker
- Next.js 14
- TypeScript
- Tailwind CSS
- Monaco Editor
- Axios
- React Hot Toast
- Passwords are hashed using bcrypt
- JWT tokens for authentication
- CORS enabled
- Code execution in isolated Docker containers
MIT