VibeSDK: A One-Click, Self-Hosted Platform for AI App Generation
"Vibe coding" has turned application development into a conversation. Instead of writing code line-by-line, users describe an application in natural language, and AI generates it. As this workflow gains traction, companies are looking to offer this capability internally or embed it directly into their own products — without sending their code or data to a third-party service.
To address that need, Cloudflare is open-sourcing VibeSDK, a complete, end-to-end AI coding platform designed to be deployed with a single click. The project bundles everything required to run your own platform, from sandboxed code execution to scalable production deployment. A live demo is available on Cloudflare's build platform, and the full codebase is ready to be forked and customized.
Deploying VibeSDK provisions a full set of services:
- LLM orchestration via the Agents SDK, handling code generation, debugging, and iterative fixes.
- Isolated sandboxes for each user, providing secure, contained environments for running AI-generated code.
- Elastic scaling to support thousands or millions of deployed applications on Cloudflare's network.
- Centralized observability and multi-provider caching through AI Gateway, monitoring cost and performance.
- Reusable templates stored in R2, which act as starting points to accelerate the generation of common app types.
- One-click export to a user's own Cloudflare account or GitHub repository, enabling them to continue development independently.
Why Build Your Own Vibe Coding Stack?
Building a proprietary platform offers control that third-party tools cannot: custom prompting logic tailored to specific use cases, complete authority over the development environment, and full ownership of the hosting infrastructure and data. VibeSDK is not a locked-in, monolithic tool — developers can take the whole thing or extract individual components to fit their unique requirements.
Inside a Session: Sandbox, Generation, and Live Preview
Generating code is one challenge; running it safely is another. AI-generated code is fundamentally untrusted, and it needs to execute package installs, build commands, and dev servers. VibeSDK isolates this risky execution within Cloudflare Sandboxes, providing users with dedicated, container-based environments that are resilient against impacting other workloads or the underlying platform.
The platform assigns each user a sandbox, persisting their session so they can return to their workspace with files intact if they leave and come back.

When a user submits a request, VibeSDK orchestrates the workflow: from writing component files and running bun install to starting the server and generating a unique preview URL. Users can watch the process in real-time — from file creation to dependency upload — before the final application is displayed.
async function generateAndWriteCode(instanceId: string) {
// AI generates the application structure
const aiGeneratedFiles = await callAIModel("Create a React todo app");
// Write all generated files to the sandbox
for (const file of aiGeneratedFiles) {
await sandbox.writeFile(
`${instanceId}/${file.path}`,
file.content
);
// User sees: "✓ Created src/App.tsx"
notifyUser(`✓ Created ${file.path}`);
}
}
Beyond the Preview: Deployment and Debugging
The experience extends past a simple preview. As the AI generates and runs code, VibeSDK continuously captures console output and build logs, feeding errors back to the model for automatic fixes. Edits, installations, and error resolution occur live before your eyes.
VibeSDK employs a separate, specialized "deployment sandbox" to migrate an app from a user's development sandbox to production. It executes wrangler deploy and publishes the completed app to Cloudflare Workers. Each app gets its own isolated Worker and is delivered a unique URL. Worker for Platforms supports launching applications at mass scale, ensuring no cross-tenant access across identical deployment namespaces.
async function deployToWorkersForPlatforms(instanceId: string) {
// 1. Package the app from development sandbox
const devSandbox = getSandbox(env.Sandbox, instanceId);
const packagedApp = await devSandbox.exec('zip -r app.zip .');
// 2. Transfer to specialized deployment sandbox
const deploymentSandbox = getSandbox(env.DeployerServiceObject, 'deployer');
await deploymentSandbox.writeFile('app.zip', packagedApp);
await deploymentSandbox.exec('unzip app.zip');
// 3. Deploy using Workers for Platforms dispatch namespace
const deployResult = await deploymentSandbox.exec(`
bunx wrangler deploy \\\\
--dispatch-namespace vibe-sdk-build-default-namespace
`);
// Each app gets its own isolated Worker and unique URL
// e.g., https://my-app.example.com
return `https://${instanceId}.example.com`;
}
The AI Stack: Multi-Model and Observability Included
Different AI models excel at distinct tasks, so relying on a single LLM limits your platform. VibeSDK defaults to Google’s Gemini variants (gemini-2.5-pro, gemini-2.5-flash-lite, and gemini-2.5-flash) for planning, generation, and debugging, but its integration with AI Gateway allows for flexible routing across a provider mix. This setup delivers features critical to a production platform:
- Provider routing via a unified access point, panning across OpenAI, Anthropic, Google, and others.
- Response caching, minimizing inference costs by serving cached outputs for common queries.
- Full observability, unifying metrics for requests, token counts, and response latencies across providers.
- Cost tracking at a granular level per model and integration.
With the infrastructure pre-wired, developers can skip the months spent on plumbing and concentrate on adding value through customized prompts and workflows. This paves the way for companies to develop their own unique AI coding platforms, whether for internal productivity or a signature user-facing feature.



