Ultra-minimal Cloudflare Worker for secure, isolated iframe hosting for Vibes.diy applications.
Vibesbox is a simple Cloudflare Worker that serves a single static HTML file to provide secure, isolated iframe hosting. The worker accepts any subdomain pattern (*.vibesbox.dev) and returns the exact same iframe.html content for all requests - no dynamic logic needed.
vibesbox.dev/* → Cloudflare Worker → Static iframe.html
- Zero server complexity: Just serves static HTML
- Global CDN: Cloudflare's edge network for speed
- Infinite scale: Handles unlimited subdomains automatically
- Perfect isolation: Each subdomain = unique origin for security
- Cost effective: Minimal Cloudflare Worker costs
- Static HTML serving: Same content for all requests
- Wildcard subdomain support:
*.vibesbox.dev
works automatically - Modern JavaScript environment: React 19.1.1, Babel, TailwindCSS
- Screenshot capabilities: html2canvas-pro integration
- Error handling: Complete JSX/React error reporting
- postMessage communication: Full parent-iframe messaging
-
Install dependencies:
pnpm install
-
Deploy:
pnpm deploy
# Start local development (port 8989)
pnpm dev
# Deploy to staging
pnpm deploy:staging
# Deploy to production
pnpm deploy
vibesbox.dev A 192.0.2.1 (Cloudflare proxy)
*.vibesbox.dev CNAME vibesbox.dev
- Any request to any subdomain (abc123.vibesbox.dev, test.vibesbox.dev, etc.)
- Returns identical HTML - the complete iframe.html content as a string constant
- iframe handles everything - code execution, rendering, screenshots via postMessage
- No server logic - the worker doesn't parse subdomains or transform content
export default {
async fetch(): Promise<Response> {
return new Response(IFRAME_HTML, {
headers: {
'Content-Type': 'text/html',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, OPTIONS',
'X-Frame-Options': 'ALLOWALL',
'Cache-Control': 'public, max-age=3600',
},
});
},
};
The worker doesn't need to:
- Parse subdomain names
- Store or retrieve data
- Transform content
- Handle routing
It literally just returns the same HTML file for every request to any subdomain.
MIT