Cloudflare
Cloudflare provider for ComputeSDK - Execute code in secure, isolated sandboxes on Cloudflare's edge network.
Installation
Setup
To use the Cloudflare provider in remote mode, deploy the Cloudflare sandbox demo Worker once and connect to it over HTTP.
You can print these setup instructions at any time by running:
Note: This command only prints instructions — it does not deploy anything and does not require Docker.
Step 1: Deploy the sandbox demo Worker
Follow the deployment instructions for the sandbox demo Worker.
Step 2: Set the Worker's API key secret
From the sandbox demo Worker project, set the SANDBOX_API_KEY secret:
Step 3: Configure your app
Add the Worker URL and the same API key to your .env file:
These are the only env vars needed at runtime.
Usage
Run Commands
Filesystem
Environment Variables
Pass environment variables at the provider level:
Or per-sandbox at creation time:
Sandbox Size and Image
Choose the size and image of a new sandbox when you create it:
vcpu
vCPUs of a custom instance type
memoryMib
Memory of the custom instance type, in MiB
diskMb
Disk of the custom instance type, in MB
image
Name of an image declared by the sandbox demo Worker. builder has Node.js 24 and common build tools.
Set vcpu, memoryMib, and diskMb together. Without them, the sandbox uses the Worker's default instance type. Without image, it uses the Worker's default image.
Configuration Options
Direct Mode
A Cloudflare Worker can call the sandbox demo Worker's Durable Object directly instead of using its HTTP API. Add a cross-script Durable Object binding to the Worker that uses ComputeSDK:
Pass the binding to the provider:
Limitations
Resource limits apply based on your Cloudflare plan
Some system calls may be restricted in the container environment
Port forwarding is not supported
Listing all sandboxes is not supported — use
getByIdto reconnect to a specific sandbox
Last updated
Was this helpful?