VibesOS cloudflare
Self-contained deploy automation — invoke directly, do not decompose. Deploys a Vibes app to Cloudflare Workers via the Deploy API. Use when deploying, publishing, going live, pushing to production, or hosting on the edge.
git clone https://github.com/popmechanic/VibesOS
T=$(mktemp -d) && git clone --depth=1 https://github.com/popmechanic/VibesOS "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/cloudflare" ~/.claude/skills/popmechanic-vibesos-cloudflare && rm -rf "$T"
skills/cloudflare/SKILL.mdPlan mode: If you are planning work, this entire skill is ONE plan step: "Invoke /vibes:cloudflare". Do not decompose the steps below into separate plan tasks.
╔═══════════════════════════════════════════════╗ ║ ☁️ CLOUDFLARE WORKERS DEPLOY ║ ║ Deploy API · Pocket ID · Edge Functions ║ ╚═══════════════════════════════════════════════╝
Deploy to Cloudflare
Deploy your Vibes app to Cloudflare Workers via the Deploy API.
Prerequisites
- Assembled HTML file (from
or/vibes:vibes
)/vibes:factory - Vibes account (browser login on first deploy)
No Cloudflare account or wrangler CLI needed — the Deploy API handles infrastructure.
Quick Deploy
VIBES_ROOT="${CLAUDE_PLUGIN_ROOT:-$(dirname "$(dirname "${CLAUDE_SKILL_DIR}")")}" bun "$VIBES_ROOT/scripts/deploy-cloudflare.js" --name myapp --file index.html
On first run, a browser window opens for Pocket ID authentication. Tokens are cached for subsequent deploys.
Static Assets: Place images, fonts, or other static files in an
assets/ directory next to the app file. The deploy script auto-discovers and includes them (binary files are base64-encoded). Reference in code with absolute paths like /assets/logo.png.
Deploy with AI enabled
VIBES_ROOT="${CLAUDE_PLUGIN_ROOT:-$(dirname "$(dirname "${CLAUDE_SKILL_DIR}")")}" bun "$VIBES_ROOT/scripts/deploy-cloudflare.js" --name myapp --file index.html --ai-key "sk-or-v1-your-key"
The
--ai-key flag configures the OpenRouter API key for the useAI() hook. Without it, /api/ai/chat returns {"error": "AI not configured"}.
Endpoints
| Endpoint | Method | Description |
|---|---|---|
| GET | Public registry read |
| GET | Check subdomain availability |
| POST | Claim a subdomain (auth required) |
| POST | AI proxy to OpenRouter (requires AI key) |
Important: Custom Domain Required for Subdomains
Workers.dev domains only support one subdomain level for SSL. For multi-tenant apps with subdomains (tenant.myapp.workers.dev), you MUST use a custom domain.
Won't work:
tenant.myapp.username.workers.dev (SSL error)
Will work: tenant.myapp.com (with custom domain)
On workers.dev, use the
?subdomain= query parameter for testing:
→ landing pagemyapp.username.workers.dev
→ tenant appmyapp.username.workers.dev?subdomain=tenant
→ admin dashboardmyapp.username.workers.dev?subdomain=admin
Custom Domain Setup
- Add domain to Cloudflare (get nameservers from Cloudflare DNS dashboard)
- Point registrar nameservers to Cloudflare's assigned nameservers
- Delete conflicting DNS records for the apex domain (A, AAAA, CNAME)
- Add Custom Domain in Workers & Pages → your worker → Settings → Domains & Routes → Add → Custom Domain (apex: yourdomain.com)
- Add wildcard CNAME in DNS: Name:
, Target:*
(Proxied: ON)<worker-name>.<username>.workers.dev - Add Route in Workers & Pages → your worker → Settings → Domains & Routes → Add → Route:
*.yourdomain.com/*
After setup:
→ landing pageyourdomain.com
→ tenant apptenant.yourdomain.com
→ admin dashboardadmin.yourdomain.com
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
| Browser doesn't open for auth | Headless environment | Copy the printed URL and open manually |
| Deploy API returns 401 | Expired or invalid token | Delete and retry |
| 404 on subdomain URL | Workers.dev doesn't support nested subdomains | Set up a custom domain (see Custom Domain Setup above) |
returns "AI not configured" | Missing OpenRouter key | Redeploy with |
| Stale content after redeploy | Browser cache | Hard refresh (Cmd+Shift+R) or clear cache |
What's Next?
After successful deployment, present these options:
AskUserQuestion: question: "Your app is deployed! What would you like to do next?" header: "Next steps" options: - label: "Set up custom domain" description: "Configure DNS for subdomain routing (required for multi-tenant)" - label: "Enable AI features" description: "Add OpenRouter API key for the useAI() hook" - label: "Add auth & SaaS features" description: "Transform into SaaS with /vibes:factory, then redeploy" - label: "Open in browser" description: "Visit the deployed URL to verify everything works"