minibuildai
ENGINEERING NOTE

Running Cloudflare's VibeSDK as a Real Product: What the Template Doesn't Cover

· 860 words · about 4 min read · minibuildai engineering

Cloudflare's VibeSDK is an open-source AI app builder: a model writes an app, it gets deployed, users see it running. You can have the demo working in an afternoon. Turning it into something strangers pay for took us three months, and almost none of that time went into features.

Disclosure: VibeSDK is Cloudflare's open-source project. minibuildai started from it and is not affiliated with, endorsed by, or supported by Cloudflare. Everything below is our own operational experience, not official guidance.

1. You cannot bundle inside the same isolate that serves the workspace

Generated apps are built and deployed from inside a Durable Object, which has a hard 128 MB memory limit. A template that adds better-auth plus kysely peaked around 500 MB while installing and bundling. The isolate is reset mid-build and no deployment row is ever written, so the failure looks like a broken product rather than an out-of-memory kill.

What worked: build the heavy templates' bundles offline, store them in R2 keyed by a content hash of the exact bundler input, and stream the artifact in at deploy time. A hash hit never touches npm or esbuild. A miss falls back to the live path, which is correct but cannot survive the limit.

The trap that cost us a second outage: our release pipeline regenerated the template archives on every deploy, so every hash missed, and the fallback is silent by design — a cache miss is a valid state. The product just looked broken. The fix was to rebuild the artifacts in the same step that regenerates the archives, and to refuse to ship an artifact whose hash cannot match.

2. Do not run npm install per app

The default mental model is "each generated app has its own dependencies". At scale that means a dependency tree per build, inside an isolate, every time.

We compile the platform's own libraries — auth and payments — into single-file ESM bundles that ship with the repo, with zero bare imports. A generated app that imports vibe-auth gets a 792 KB prebuilt module instead of a resolution graph. No npm install at build time at all.

The measurement that surprised us: adding auth and payments to a build changed the time (0.5s → 2.4s) but not the peak memory (63.1 MB → 62.9 MB → 62.7 MB). Peak memory is dominated by the bundler runtime, not the dependency count. If you are sizing an isolate, measure the runtime, not the package list.

One guard you cannot skip: a client-side import of a server-only module must be rejected at build time. Prebuilt bundles are compressed single files, so a naive bare-import scanner will false-positive on minified code (t.from.froms reads as from"..."). The platform's own artifacts have to be excluded from that scan, or every app that imports auth fails to build.

3. Reasoning chunks disappear with the wrong SDK

If you use @ai-sdk/openai against an OpenAI-compatible endpoint, the streamed chunk schema has no field for reasoning, so the model's thinking never reaches the UI — it is silently dropped, not errored. Switching to @ai-sdk/openai-compatible fixes it. This is a one-line change that costs an afternoon to diagnose, because the symptom is "the model seems dumb", not "the response is malformed".

4. WebSocket connections must not open before initialize()

The client and the Durable Object exchange state during initialization. If the socket connects first, messages arrive before the agent has a session and are dropped without an error. Same class of bug: correct behaviour, wrong order, no log line.

5. A Durable Object row tops out at 2 MB

Deployment modules live in SQLite inside the DO. A component-heavy app exceeded the row limit. Modules are now stored as gzip BLOBs. Any field that can grow with user content — module lists, file trees, chat history — needs this arithmetic done before it hits production, because the error arrives only when a specific app gets big enough.

6. Every upstream fetch needs a timeout

Model providers stall. Without a response-header timeout and a stream idle timeout, a stalled request hangs the build indefinitely and never trips your failover path — the agent appears to be thinking forever, and no error is recorded. On a platform where users pay per build, a silent hang is worse than a visible error.

What this means if you are starting from the template

None of the six are VibeSDK defects. They are the difference between a demo and a product with paying users: memory ceilings, dependency strategy, streaming semantics, connection order, storage limits and failure visibility.

Our honest read: if you enjoy this class of problem, start from the template — it is genuinely good. If you want an app builder you do not have to operate, that is the part we sell: prepaid credits instead of a subscription, a real database per app, code and SQL out on every plan, and the option to redeploy into your own Cloudflare account.

Try minibuildai free — no card Compare with Lovable

Written by the minibuildai engineering team. Measured on Cloudflare Workers and Durable Objects; memory figures are observed peak RSS during builds, not vendor documentation.