Installation
Configuration
Using the provider directly
Worker Setup
Cloudflare sandboxes require specific Worker configuration:1. Configure wrangler.json
2. Create your Worker
ENV variables and secrets
Configuration Options
ThecreateCloudflareProvider
function accepts these configuration options:
env
(required): Your Cloudflare Worker’s environment object containing theSandbox
Durable Object bindinghostname
(required): Your Worker’s hostname used for generating preview URLs when exposing ports
Unique Features
Preview URLs
Cloudflare sandboxes can generate public preview URLs when services are exposed on specific ports, making them accessible from anywhere on the internet.Edge-Native Execution
Sandboxes run on Cloudflare’s global edge network, providing low-latency execution closest to your users.Durable Objects Integration
Built on Cloudflare’s Durable Objects platform for strong consistency, automatic geographic distribution, and seamless Workers platform integration.Local Development
For local development withwrangler dev
, only ports explicitly exposed in the Dockerfile are available for port forwarding. This is not an issue in production.
To test multiple ports locally, create a custom Dockerfile:
Requirements
- Cloudflare Workers: Must run within a Cloudflare Worker environment
- Wrangler: For local development and deployment
- Docker: For building sandboxes locally and deploying to Cloudflare
- Node.js 18+: For development tooling