QUICKSTART
A sandbox configuration for cloudflare workflows.
Before you use this component
This is a third-party source bundle, not an installation into your account. UI Discovery has checked the available redistribution license evidence; runtime behavior has not been tested. Review all files, use a disposable project first, and do not enable scripts or hooks until you understand their permissions.
Some integrations require separately installed software, API keys or paid services. Credentials and subscriptions are not included. These are Claude Code resources; other clients may require adaptation.
Extract the ZIP into a temporary folder, inspect its entry file and supporting resources, then follow the original instructions. Do not overwrite an existing project configuration blindly. Keep the bundled license and attribution notices.
- Source publisher
- Claude Code Templates
- Creator supplied by source
- Not listed in source
- Pinned source version
- a344359459263d73d8948651c789244093c02e4e
- License evidence
- LICENSE
Source preview
cli-tool/components/sandbox/cloudflare/QUICKSTART.md
# Cloudflare Sandbox Quick Start Guide
Get your Cloudflare Claude Code Sandbox running in under 5 minutes.
## Prerequisites Checklist
- [ ] Cloudflare account (sign up at https://dash.cloudflare.com/sign-up)
- [ ] Anthropic API key (get from https://console.anthropic.com/)
- [ ] Node.js 16.17.0+ installed
- [ ] Docker installed and running (for local development)
## Option 1: Deploy to Production (Fastest)
Perfect if you want to skip local testing and deploy directly.
### Step 1: Install Dependencies
```bash
cd .claude/sandbox/cloudflare
npm install
```
### Step 2: Set API Key
```bash
npx wrangler secret put ANTHROPIC_API_KEY
# Paste your Anthropic API key when prompted
```
### Step 3: Deploy
```bash
npx wrangler deploy
```
### Step 4: Wait for Container Provisioning
```bash
# Wait 2-3 minutes, then check:
npx wrangler containers list
# You should see: ✓ Container ready
```
### Step 5: Test Your Deployment
```bash
# Get your worker URL from the deploy output, then:
curl -X POST https://YOUR-WORKER.YOUR-SUBDOMAIN.workers.dev/execute \
-H "Content-Type: application/json" \
-d '{"question": "What is the 10th Fibonacci number?"}'
```
Expected response:
```json
{
"success": true,
"question": "What is the 10th Fibonacci number?",
"code": "def fibonacci(n):\n ...",
"output": "55\n",
"error": "",
"executionTime": 1234
}
```
**Done!** Your sandbox is live at the edge.
---
## Option 2: Local Development First
Perfect if you want to test locally before deploying.
### Step 1: Install Dependencies
```bash
cd .claude/sandbox/cloudflare
npm install
```
### Step 2: Create Local Environment File
```bash
cp .dev.vars.example .dev.vars
# Edit .dev.vars and add your Anthropic API key
```
### Step 3: Start Docker
```bash
# macOS: Open Docker Desktop
# Linux: sudo systemctl start docker
# Windows: Start Docker Desktop
# Verify Docker is running:
docker ps
```
### Step 4: Start Development Server
```bash
npm run dev
```
Wait for:
```
⛅️ wrangler 3.78.12
-------------------
⎔ Starting local server...
[wrangler:inf] Ready on http://localhost:8787
```
### Step 5: Test Locally
```bash
# In a new terminal:
curl -X POST http://localhost:8787/execute \
-H "Content-Type: application/json" \
-d '{"question": "Calculate factorial of 5"}'
```
### Step 6: Deploy When Ready
```bash
# Stop the dev server (Ctrl+C)
npx wrangler secret put ANTHROPIC_API_KEY
npx wrangler deploy
```
**Done!** You've tested locally and deployed.
---
## Option 3: Using the CLI Tools
Perfect if you prefer command-line interaction.
### Step 1: Setup (same as above)
```bash
cd .claude/sandbox/cloudflare
npm install
npx wrangler secret put ANTHROPIC_API_KEY
npx wrangler deploy
```
### Step 2: Use the Launcher
```bash
# Execute a prompt
node launcher.ts "What is 2 to the power of 10?" \
"" \
your_anthropic_key \
https://your-worker.workers.dev
```
### Step 3: Use the Monitor (for debugging)
```bash
# Get detailed execution metrics
node monitor.ts "Calculate factorial of 5" \
your_anthropic_key \
https://your-worker.workers.dev
```
**Done!** You're using the CLI tools.
---
## Common Issues & Quick Fixes
### "Container not ready"
**Solution**: Wait 2-3 minutes after first deployment
```bash
npx wrangler containers list
```
### "Docker daemon is not running"
**Solution**: Start Docker Desktop or Docker service
```bash
docker ps # Should list containers
```
### "ANTHROPIC_API_KEY not configured"
**Solution**: Set the secret
```bash
# Production:
npx wrangler secret put ANTHROPIC_API_KEY
# Local (.dev.vars):
echo "ANTHROPIC_API_KEY=sk-ant-your-key" > .dev.vars
```
### "Worker not found"
**Solution**: Deploy the worker
```bash
npx wrangler deploy
```
### "Execution timeout"
**Solution**: Increase timeout in request
```json
{
"question": "Your question",
"timeout": 60000
}
```
---
## Next Steps
### 1. Customize Your Worker
Edit `src/index.ts` to add custom logic:
- Add authentication
- Implement rate limiting
- Add custom error handling
- Create specialized endpoints
### 2. Add Monitoring
```bash
# Watch logs in real-time
npx wrangler tail
# Use the monitor tool
node monitor.ts "your prompt" your_api_key
```
### 3. Test Different Languages
```bash
# Python (default)
curl -X POST https://your-worker.workers.dev/execute \
-d '{"question": "Fibonacci", "language": "python"}'
# JavaScript
curl -X POST https://your-worker.workers.dev/execute \
-d '{"question": "Fibonacci", "language": "javascript"}'
```
### 4. Integrate with Your App
```javascript
// Frontend integration
const response = await fetch('https://your-worker.workers.dev/execute', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ question: 'Calculate factorial of 5' })
});
const result = await response.json();
console.log(result.output);
```
### 5. Enable Advanced Features
See the main [README.md](./README.md) for:
- Streaming output
- Code Interpreter API
- Caching strategies
- Performance optimization
---
## Resources
- **Documentation**: [README.md](./README.md)
- **Debugging**: [SANDBOX_DEBUGGING.md](./SANDBOX_DEBUGGING.md)
- **Component Info**: [claude-code-sandbox.md](./claude-code-sandbox.md)
- **Cloudflare Docs**: https://developers.cloudflare.com/sandbox/
- **Anthropic Docs**: https://docs.anthropic.com/
---
## Getting Help
1. **Check logs**: `npx wrangler tail`
2. **Use monitor**: `node monitor.ts "test" your_key`
3. **Read debugging guide**: [SANDBOX_DEBUGGING.md](./SANDBOX_DEBUGGING.md)
4. **Check container status**: `npx wrangler containers list`
5. **Test health**: `curl https://your-worker.workers.dev/health`
---
**You're all set! Start executing code with Claude AI on Cloudflare's edge network.**
Preview capped at 60,000 characters. Download the bundle for every original file and notice.
Read the redistribution license
MIT License Copyright (c) 2025 Daniel (San) Ávila Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Bundle SHA-256: 074290f04f2b9de77d636151ec3ded3c2b15c4545c80b6dcd18c76830dae34c0. Files are served as downloads and are never executed by this page.