Skip to main content

Overview

Nadoo Sandbox is a secure code execution service that runs user code in isolated Docker containers. It supports 12+ programming languages with built-in resource limits and security controls.

Key Features

Multi-Language Support

Execute code in Python, JavaScript, TypeScript, Java, Go, Rust, C++, C#, Ruby, PHP, SQL, and Bash

Secure Isolation

All code runs in isolated Docker containers with resource limits

Async Execution

Support for both synchronous and asynchronous code execution

Rate Limiting

Built-in rate limiting to prevent abuse

Architecture

Nadoo Sandbox features a Multi-Provider Executor architecture with Warm Pool support for optimal performance.
┌─────────────────────────────────────────────────────────────┐
│                       API Gateway                            │
└──────────────────────────┬──────────────────────────────────┘

┌──────────────────────────▼──────────────────────────────────┐
│                      FastAPI App                             │
├─────────────────────────────────────────────────────────────┤
│  - Execute API    - Provider API    - Health Check          │
└──────────────────────────┬──────────────────────────────────┘

┌──────────────────────────▼──────────────────────────────────┐
│                   Executor Client                            │
├─────────────────────────────────────────────────────────────┤
│  - Provider Registry    - Failover Chain    - Load Balance  │
└──────────────────────────┬──────────────────────────────────┘

          ┌────────────────┼────────────────┐
          │                │                │
┌─────────▼─────────┐ ┌────▼────┐ ┌─────────▼─────────┐
│   Warm Pool       │ │         │ │   Cloud Providers │
├───────────────────┤ │  Local  │ ├───────────────────┤
│ - Pre-warmed      │ │  Docker │ │ - AWS Lambda      │
│   Containers      │ │         │ │ - GCP Cloud Run   │
│ - Health Check    │ │         │ │ - Azure Container │
│ - Auto Scaling    │ │         │ │   Apps            │
└───────────────────┘ └─────────┘ └───────────────────┘

Key Components

  • Executor Client: Unified interface for all providers with automatic failover
  • Warm Pool: Pre-warmed containers for ~50-100ms cold start latency
  • Provider Registry: Pluggable architecture for adding new execution backends
  • Failover Chain: Automatic fallback when primary provider fails

Use Cases

  • Online Code Editors: Run user code safely
  • Automated Testing: Execute test suites in isolated environments
  • Educational Platforms: Provide safe coding environments for students
  • AI Coding Assistants: Execute AI-generated code securely

Quick Example

curl -X POST http://localhost:8002/api/v1/execute \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "print(\"Hello, Sandbox!\")",
    "language": "python"
  }'

Next Steps