Prerequisites
Before you begin, ensure you have:Node.js 16.17.0 or later
Download and install Node.js if you haven’t already.
Docker running locally
Docker is required for local development. The sandbox runs in containers that need Docker to build and run.
- Install Docker Desktop for macOS or Windows
- For Linux, install Docker Engine
Cloudflare account (for production)
For deploying to production, you’ll need a Cloudflare account. Local development works without an account.
Create a new project
The fastest way to get started is using the official template:- The Sandbox SDK pre-configured
- A minimal Worker example
- Docker configuration
- Wrangler configuration for deployment
Add to existing project
If you have an existing Cloudflare Workers project, you can add the Sandbox SDK manually.Install the package
Create a Dockerfile
Create aDockerfile in your project root. You can use the default image or customize it:
Dockerfile
Configure Wrangler
Update yourwrangler.jsonc (or wrangler.toml) to configure the Sandbox Durable Object:
wrangler.jsonc
The
migrations section is required when first deploying a Durable Object. It tells Cloudflare to create the necessary infrastructure.Update your Worker
Add the Sandbox export to your Worker code:src/index.ts
Verify installation
Test your setup locally:TypeScript support
The SDK includes full TypeScript definitions. If you’re using TypeScript, ensure yourtsconfig.json includes:
tsconfig.json
worker-configuration.d.ts file with types for your environment bindings.
Next steps
Quickstart
Build your first sandbox application
API reference
Explore the complete SDK API