DevBox is building an online code sandbox where developers write, run, and share code in the browser. Features:
- Browser IDE - code editor (Monaco) with syntax highlighting, autocomplete, and file tree. Supports JavaScript, Python, Go, and Rust.•Secure execution - run user code in isolated sandboxes. Prevent malicious code from accessing the host system, network, or other users' data. Enforce CPU (10s max) and memory (256 MB max) limits.•Real-time output - stdout/stderr streams to the browser in real time as the program runs.•Project persistence - save projects with multiple files/folders. Share via URL. Fork other people's projects.•Package installation - users can install npm/pip packages. Pre-warm popular packages in a base image.•Preview - for web projects (React, HTML), show a live preview that updates as the user types (hot reload).•Collaboration - two users can code together with live cursors (like Google Docs for code).
Targeting 200,000 users running 500,000 code executions per day.
Design an online code execution sandbox (like CodeSandbox / Replit) that runs user code safely with real-time collaboration. Build this architecture under realistic production constraints, then validate tradeoffs in the design lab simulation.
Request path: The solution keeps ingress, service logic, and stateful dependencies separated so each layer can scale independently.
Reference flow: Web Clients -> Load Balancer -> API Gateway -> API Service -> Primary NoSQL DB -> Realtime Bus -> Object Storage