iuv sandbox
iuv sandbox provides access to Cloudflare Sandbox for running isolated compute environments.
Sandboxes are perfect for testing, building, and deploying applications in a secure, ephemeral environment.
List sandboxes
Section titled “List sandboxes”iuv sandbox listShows all your sandboxes with their status, runtime, and preview URLs.
Create a sandbox
Section titled “Create a sandbox”# Create a basic Node.js sandboxiuv sandbox create
# Create with custom configurationiuv sandbox create --name my-app --runtime node24 --vcpus 4 --ports 3000,8080
# Create and clone a git repositoryiuv sandbox create --git-url https://github.com/example/repo.git --git-revision main
# Create with environment variablesiuv sandbox create --env NODE_ENV=production,API_KEY=secret| Flag | Default | Description |
|---|---|---|
-n, --name | auto-generated | Sandbox name |
-r, --runtime | node24 | Runtime environment (node24, node22, python3.13) |
--vcpus | 2 | Number of vCPUs (1-8) |
--ports | 3000 | Comma-separated ports to expose |
--timeout | 600000 | Sleep timeout in milliseconds |
-e, --env | - | Environment variables (KEY=value,KEY2=value2) |
--git-url | - | Git repository URL to clone |
--git-revision | - | Git revision to checkout |
--app-id | - | Associated app ID |
Get sandbox details
Section titled “Get sandbox details”iuv sandbox get 123iuv sandbox get 123 --jsonShows detailed information about a specific sandbox including:
- External sandbox ID
- Status (creating, running, sleeping, stopped, failed, destroyed)
- Runtime and resource configuration
- Preview URLs for exposed ports
- Creation and update timestamps
Delete a sandbox
Section titled “Delete a sandbox”iuv sandbox delete 123Permanently deletes a sandbox and releases all associated resources.
Execute commands
Section titled “Execute commands”# Run a command in the sandboxiuv sandbox exec 123 "npm install"
# Run with custom working directoryiuv sandbox exec 123 "npm run build" --cwd /workspace/app
# Run with environment variablesiuv sandbox exec 123 "npm test" --env NODE_ENV=test
# Run in detached mode (fire-and-forget)iuv sandbox exec 123 "npm start" --detached| Flag | Description |
|---|---|
-e, --env | Environment variables (KEY=value,KEY2=value2) |
--cwd | Working directory for the command |
--detached | Run command in background mode |
The command output is streamed to your terminal. The CLI exits with the same exit code as the remote command (unless running in detached mode).
Write files
Section titled “Write files”# Upload a single fileiuv sandbox files 123 --file ./local-file.txt
# Upload multiple filesiuv sandbox files 123 --file ./file1.txt --file ./file2.txtFiles are uploaded to the sandbox’s /workspace directory. The filename is preserved (only the basename is used).
How it works
Section titled “How it works”Sandboxes are backed by Cloudflare Sandbox, providing:
- Isolated environments: Each sandbox runs in its own secure container
- Fast startup: Sandboxes start in seconds, not minutes
- Automatic sleep: Sandboxes sleep after inactivity (configurable timeout)
- Port exposure: Exposed ports get unique preview URLs
- Git integration: Automatically clone repositories on creation
Use cases
Section titled “Use cases”Test a Node.js application
Section titled “Test a Node.js application”# Create sandbox and clone repoiuv sandbox create --git-url https://github.com/myorg/myapp.git --name test-app
# Install dependencies and run testsiuv sandbox exec <id> "npm install && npm test"Quick API prototyping
Section titled “Quick API prototyping”# Create a Python sandboxiuv sandbox create --runtime python3.13 --name api-proto
# Upload your scriptiuv sandbox files <id> --file ./api.py
# Run the serveriuv sandbox exec <id> "python api.py" --detached
# Get the preview URLiuv sandbox get <id>Global options
Section titled “Global options”All subcommands accept:
--api-base-url <url> Override the API base URL (default: https://api.iuvdev.com)--json Output machine-readable JSONAPI Endpoints
Section titled “API Endpoints”The CLI uses these API endpoints internally:
GET /v1/sandbox- List sandboxesPOST /v1/sandbox- Create sandboxGET /v1/sandbox/:id- Get sandbox detailsDELETE /v1/sandbox/:id- Delete sandboxPOST /v1/sandbox/:id/exec- Execute commandPOST /v1/sandbox/:id/files- Write files