Complete checklist for deploying Billy Bullshit to Cloudflare Workers in production.
- Create Cloudflare account at https://dash.cloudflare.com/sign-up
- Note your Account ID (found in Workers & Pages dashboard)
- Add custom domain to Cloudflare (optional: billy.chitty.cc)
- Node.js 18+ installed (
node --version) - npm installed (
npm --version) - Wrangler CLI installed (
npm install -g wranglerornpm install) - Dependencies installed (
npm install) - Code passes TypeScript check (
npm run typecheck) - Code builds successfully (
npm run build)
- Login to Cloudflare:
wrangler login - Verify authentication:
wrangler whoami
- Run KV setup script:
bash scripts/setup-kv.sh- Creates production KV namespace
- Creates preview KV namespace
- Update
wrangler.tomlwith generated namespace IDs - Verify IDs are not placeholder values (
your-kv-namespace-id)
- Get Anthropic API key from https://console.anthropic.com/
- Set with:
wrangler secret put ANTHROPIC_API_KEY
- Set with:
- Get OpenAI API key from https://platform.openai.com/ (optional fallback)
- Set with:
wrangler secret put OPENAI_API_KEY
- Set with:
Note: Billy works without API keys using Cloudflare Workers AI (free tier)
# Use the deployment script
bash scripts/deploy-production.shThis script will:
- ✅ Check prerequisites
- ✅ Run TypeScript validation
- ✅ Build the project
- ✅ Warn about placeholder values
- ✅ Deploy to production
- ✅ Show next steps
# 1. Validate code
npm run typecheck
# 2. Build project
npm run build
# 3. Deploy to production
npm run deploy:production
# or
wrangler deploy --env production# Test all endpoints automatically
bash scripts/test-deployment.sh
# Or test against custom URL
bash scripts/test-deployment.sh https://your-worker.workers.devcurl https://billy.chitty.ccExpected: JSON with agent info, status: "online"
curl -X POST https://billy.chitty.cc/review \
-H "Content-Type: application/json" \
-d '{
"code": "if (condition == true) { return true; } else { return false; }",
"language": "javascript"
}'Expected: JSON with BS score, categorized issues, and fixes
curl -X POST https://billy.chitty.cc/chat \
-H "Content-Type: application/json" \
-d '{
"message": "What do you do?",
"sessionId": "test_123"
}'Expected: JSON with response and sessionId
curl -X POST https://billy.chitty.cc/roast \
-H "Content-Type: application/json" \
-d '{
"target": "my code that uses var instead of const"
}'Expected: JSON with brutal roast
curl -X POST https://billy.chitty.cc/analyze \
-H "Content-Type: application/json" \
-d '{
"subject": "React vs Vue",
"type": "comparison"
}'Expected: JSON with honest analysis
curl -X POST https://billy.chitty.cc/debate \
-H "Content-Type: application/json" \
-d '{
"position": "tabs are better than spaces",
"topic": "code formatting"
}'Expected: JSON with counter-argument
curl https://billy.chitty.cc/healthExpected: JSON with status: "healthy"
Check response times:
time curl -X POST https://billy.chitty.cc/review \
-H "Content-Type: application/json" \
-d '{"code":"console.log(\"test\")"}' \
> /dev/nullTarget: < 100ms response time (excluding AI processing)
Test KV storage:
# Send first message
curl -X POST https://billy.chitty.cc/chat \
-H "Content-Type: application/json" \
-d '{"message":"Remember: my favorite color is blue","sessionId":"persist_test"}'
# Send follow-up (should reference previous message)
curl -X POST https://billy.chitty.cc/chat \
-H "Content-Type: application/json" \
-d '{"message":"What is my favorite color?","sessionId":"persist_test"}'Expected: Billy should remember the conversation
# All logs
wrangler tail
# Production only
wrangler tail --env production
# Filter by status
wrangler tail --status error- Go to https://dash.cloudflare.com/
- Navigate to Workers & Pages
- Select "billy-bullshit-prod"
- View Metrics tab
Key metrics to monitor:
- Requests per second
- Error rate (target: < 1%)
- CPU time (target: < 50ms)
- Success rate (target: > 99%)
# List all KV namespaces
wrangler kv:namespace list
# List keys in namespace
wrangler kv:key list --binding CONVERSATIONS
# View specific conversation
wrangler kv:key get "conversation:session_id" --binding CONVERSATIONS
# Delete old conversations (optional)
wrangler kv:key delete "conversation:old_session" --binding CONVERSATIONS- Domain should already be configured in
wrangler.toml:[env.production] routes = [{ pattern = "billy.chitty.cc", custom_domain = true }]
- Deploy:
wrangler deploy --env production - Cloudflare automatically configures DNS
- Add domain to Cloudflare
- Update nameservers with your registrar
- Add route in
wrangler.toml - Deploy
Current CORS config (in src/index.ts):
cors({
origin: '*',
allowMethods: ['GET', 'POST', 'OPTIONS'],
allowHeaders: ['Content-Type', 'Authorization'],
})For production, consider restricting origins:
cors({
origin: ['https://yourapp.com', 'https://yourdomain.com'],
allowMethods: ['POST'],
allowHeaders: ['Content-Type'],
})If deployment has issues:
# List recent deployments
wrangler deployments list
# Rollback to previous version
wrangler rollback- API keys stored as secrets (not in code)
- CORS configured appropriately for production
- No sensitive data in logs
- Rate limiting considered (if needed)
- Environment variables set correctly
- Billy responds to API requests ✅
- All endpoints working (/review, /chat, /roast, /analyze, /debate) ✅
- Conversation history persists (KV storage) ✅
- Performance metrics acceptable (<100ms response time) - Test after deployment
- Custom domain configured (billy.chitty.cc) ✅
- CORS configured for production ✅
Solution: Run scripts/setup-kv.sh and update wrangler.toml with real IDs
Solution: Ensure Cloudflare account has Workers AI enabled (free on all plans)
Solution:
wrangler logout
wrangler loginPossible causes:
- Worker crashed - check logs:
wrangler tail - Exceeded CPU limits - optimize code
- Network timeout - reduce request complexity
Solutions:
- Use Anthropic API key for faster responses
- Check Workers AI status
- Monitor CPU time in dashboard
- Check deployment logs:
wrangler tail --env production - View Cloudflare Workers docs: https://developers.cloudflare.com/workers/
- Review DEPLOYMENT.md for detailed instructions
- Check Billy's GitHub issues
✅ Deployment is successful when:
- All automated tests pass (
scripts/test-deployment.sh) - Response time < 100ms (excluding AI processing)
- No errors in logs
- All endpoints return expected responses
- Conversation persistence works
- Custom domain resolves correctly
Remember: Billy doesn't break. Your deployment process might. Follow this checklist. 🔥