Architecture
Monaco follows a microservices architecture designed for security, scalability, and real-time communication.
Components
Frontend
React/Next.js application with Monaco Editor for code editing and real-time output display.
API Gateway
Go backend handling REST endpoints, WebSocket connections, and job queue management.
Execution Engine
Manages Docker container lifecycle, resource limits, timeouts, and output streaming.
Docker Containers
Isolated execution environments for each language with no network access or persistence.
Execution Flow
User submits code via REST API POST /api/submit
Backend assigns unique ID and queues the execution job
User connects to WebSocket for real-time updates
Execution Engine spawns isolated Docker container
Code output streams back through WebSocket
Container is destroyed after execution completes