<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: sophon</title>
    <description>The latest articles on DEV Community by sophon (@_5d7082b6b929c6b75c9c8b).</description>
    <link>https://dev.to/_5d7082b6b929c6b75c9c8b</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4273767%2Fe71e1723-c669-4c85-bbca-2fbdecd0e41c.png</url>
      <title>DEV Community: sophon</title>
      <link>https://dev.to/_5d7082b6b929c6b75c9c8b</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/_5d7082b6b929c6b75c9c8b"/>
    <language>en</language>
    <item>
      <title>Running Cloudflare's VibeSDK as a real product: what the template doesn't cover</title>
      <dc:creator>sophon</dc:creator>
      <pubDate>Mon, 30 Nov 2026 08:56:13 +0000</pubDate>
      <link>https://dev.to/_5d7082b6b929c6b75c9c8b/running-cloudflares-vibesdk-as-a-real-product-what-the-template-doesnt-cover-4fjp</link>
      <guid>https://dev.to/_5d7082b6b929c6b75c9c8b/running-cloudflares-vibesdk-as-a-real-product-what-the-template-doesnt-cover-4fjp</guid>
      <description>&lt;p&gt;Cloudflare's &lt;a href="https://github.com/cloudflare/vibesdk" rel="noopener noreferrer"&gt;VibeSDK&lt;/a&gt; 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.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Disclosure:&lt;/strong&gt; VibeSDK is Cloudflare's open-source project. The product below started from it and is not affiliated with, endorsed by, or supported by Cloudflare. Everything here is our own operational experience, not official guidance.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  1. You cannot bundle inside the same isolate that serves the workspace
&lt;/h2&gt;

&lt;p&gt;Generated apps are built and deployed from inside a Durable Object, which has a hard 128 MB memory limit. A template that adds &lt;code&gt;better-auth&lt;/code&gt; plus &lt;code&gt;kysely&lt;/code&gt; 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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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, because 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.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Do not run npm install per app
&lt;/h2&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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 the auth module gets a 792 KB prebuilt file instead of a resolution graph. No &lt;code&gt;npm install&lt;/code&gt; at build time at all.&lt;/p&gt;

&lt;p&gt;The measurement that surprised us: adding auth and payments changed the build &lt;em&gt;time&lt;/em&gt; (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.&lt;/p&gt;

&lt;p&gt;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 false-positives on minified code (&lt;code&gt;t.from.froms&lt;/code&gt; reads as &lt;code&gt;from"..."&lt;/code&gt;). The platform's own artifacts have to be excluded from that scan, or every app that imports auth fails to build.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Reasoning chunks disappear with the wrong SDK
&lt;/h2&gt;

&lt;p&gt;Use &lt;code&gt;@ai-sdk/openai&lt;/code&gt; against an OpenAI-compatible endpoint and the streamed chunk schema has no field for reasoning. The model's thinking never reaches the UI — it is dropped silently, not errored. Switching to &lt;code&gt;@ai-sdk/openai-compatible&lt;/code&gt; fixes it. One-line change, an afternoon to diagnose, because the symptom is "the model seems dumb", not "the response is malformed".&lt;/p&gt;

&lt;h2&gt;
  
  
  4. WebSocket connections must not open before &lt;code&gt;initialize()&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. A Durable Object row tops out at 2 MB
&lt;/h2&gt;

&lt;p&gt;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 only arrives when a specific app gets big enough.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Every upstream fetch needs a timeout
&lt;/h2&gt;

&lt;p&gt;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 think forever, and no error is recorded. On a platform where users pay per build, a silent hang is worse than a visible error.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this means if you are starting from the template
&lt;/h2&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;Our honest read: &lt;strong&gt;if you enjoy this class of problem, start from the template — it is genuinely good.&lt;/strong&gt; If you want an app builder you do not have to operate, that is the part we sell.&lt;/p&gt;




&lt;p&gt;We build &lt;a href="https://minibuildai.com" rel="noopener noreferrer"&gt;minibuildai&lt;/a&gt; on this stack: 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. The first two hosted apps are free and a small app costs about $0.08.&lt;/p&gt;

</description>
      <category>cloudflare</category>
      <category>ai</category>
      <category>opensource</category>
      <category>webdev</category>
    </item>
    <item>
      <title>What AI crawlers actually see when your app is a React SPA</title>
      <dc:creator>sophon</dc:creator>
      <pubDate>Mon, 30 Nov 2026 08:54:01 +0000</pubDate>
      <link>https://dev.to/_5d7082b6b929c6b75c9c8b/what-ai-crawlers-actually-see-when-your-app-is-a-react-spa-1ljj</link>
      <guid>https://dev.to/_5d7082b6b929c6b75c9c8b/what-ai-crawlers-actually-see-when-your-app-is-a-react-spa-1ljj</guid>
      <description>&lt;p&gt;We build an AI app builder, and our own marketing site was a React single-page app. That made us a good test case for a question most AI products never check: when an AI crawler fetches your page, does it get content, or an empty &lt;code&gt;&amp;lt;div id="root"&amp;gt;&lt;/code&gt;?&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this stopped being a Google question
&lt;/h2&gt;

&lt;p&gt;Googlebot has executed JavaScript at scale for years. The crawlers behind AI answers have not. When someone asks ChatGPT, Claude or Perplexity about a product category, the retrieval step fetches pages and reads what comes back in the first HTML response. If the page is client-side rendered, that response is a script tag and nothing else.&lt;/p&gt;

&lt;p&gt;So a page can rank in Google and be completely invisible to the systems that increasingly decide what people hear about.&lt;/p&gt;

&lt;h2&gt;
  
  
  The test
&lt;/h2&gt;

&lt;p&gt;We requested our own URLs with each crawler's real User-Agent, stripped the HTML, and counted visible body text. Same URL, same server, different agents.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;URL&lt;/th&gt;
&lt;th&gt;Agent&lt;/th&gt;
&lt;th&gt;Visible body text&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Googlebot&lt;/td&gt;
&lt;td&gt;~7 KB of head, &lt;strong&gt;0 characters of body&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;GPTBot&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0 characters&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/pricing&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;ClaudeBot&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0 characters&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/pricing&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;PerplexityBot&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0 characters&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/discover&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Googlebot&lt;/td&gt;
&lt;td&gt;1,788 characters&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/discover&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Bytespider&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0 characters&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;/discover&lt;/code&gt; row is the interesting one: it had a server-rendered variant served only when our crawler regex matched the User-Agent. Googlebot matched. The AI crawlers did not — they were not in the regex at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three bugs, not one
&lt;/h2&gt;

&lt;p&gt;The naive explanation is "we were client-side rendered, so we server-rendered it". That is one of three separate faults, and fixing only that would have left two running.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. The body was empty for everyone
&lt;/h3&gt;

&lt;p&gt;Every route served the same &lt;code&gt;index.html&lt;/code&gt;, whose body was &lt;code&gt;&amp;lt;div id="root"&amp;gt;&amp;lt;/div&amp;gt;&lt;/code&gt;. Googlebot could render it. Nobody else could. The fix is to render real HTML for the pages that carry search value — not the whole app, just the public ones.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Our crawler allowlist omitted every AI crawler
&lt;/h3&gt;

&lt;p&gt;We had a regex that switched a request to the server-rendered path when the User-Agent looked like a crawler. It had &lt;code&gt;googlebot&lt;/code&gt;, &lt;code&gt;bingbot&lt;/code&gt;, &lt;code&gt;baiduspider&lt;/code&gt;, the social unfurlers — and no &lt;code&gt;gptbot&lt;/code&gt;, no &lt;code&gt;claudebot&lt;/code&gt;, no &lt;code&gt;perplexitybot&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Which is a strange kind of irony: we had published an &lt;code&gt;llms.txt&lt;/code&gt; specifically to help AI crawlers, while the same codebase served them an empty page.&lt;/p&gt;

&lt;p&gt;The fix is one regex, but the rule behind it matters: &lt;strong&gt;that list decides which HTML variant an agent gets. It is not a permission list.&lt;/strong&gt; Whether a bot may crawl is governed by &lt;code&gt;robots.txt&lt;/code&gt;. Conflating the two is how you end up blocking agents you meant to welcome.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. The canonical tag was hard-coded to the homepage
&lt;/h3&gt;

&lt;p&gt;The SPA shell carried &lt;code&gt;&amp;lt;link rel="canonical" href="https://example.com/"&amp;gt;&lt;/code&gt;. So every route — &lt;code&gt;/pricing&lt;/code&gt;, &lt;code&gt;/discover&lt;/code&gt;, all of them — told crawlers "the real version of this page is the homepage". Search Console eventually reported it back as a canonical mismatch on &lt;code&gt;/discover&lt;/code&gt;: Google had selected &lt;code&gt;/discover&lt;/code&gt;, the page had declared &lt;code&gt;/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A page that declares another URL as canonical is asking not to be indexed on its own. Three hundred pages doing that is a site telling Google it has one page.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we changed
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Server-rendered the pages that earn search traffic.&lt;/strong&gt; Homepage, pricing, terms, privacy, comparison pages, help chapters, blog. The product itself — the editor, the chat — stays client-side, because it never needed to be indexed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Extended the crawler pattern&lt;/strong&gt; to the AI agents: &lt;code&gt;gptbot&lt;/code&gt;, &lt;code&gt;oai-searchbot&lt;/code&gt;, &lt;code&gt;chatgpt-user&lt;/code&gt;, &lt;code&gt;claudebot&lt;/code&gt;, &lt;code&gt;claude-searchbot&lt;/code&gt;, &lt;code&gt;claude-user&lt;/code&gt;, &lt;code&gt;perplexitybot&lt;/code&gt;, &lt;code&gt;perplexity-user&lt;/code&gt;, &lt;code&gt;bytespider&lt;/code&gt;, &lt;code&gt;ccbot&lt;/code&gt;, &lt;code&gt;google-extended&lt;/code&gt;, &lt;code&gt;amazonbot&lt;/code&gt;, &lt;code&gt;meta-externalagent&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Derived canonical, title and description from the route&lt;/strong&gt; instead of inheriting the shell's, and added &lt;code&gt;FAQPage&lt;/code&gt; and &lt;code&gt;SoftwareApplication&lt;/code&gt; JSON-LD built from the same strings the page displays.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The same URLs, after
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;URL&lt;/th&gt;
&lt;th&gt;Before&lt;/th&gt;
&lt;th&gt;After&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;/&lt;/code&gt; (GPTBot)&lt;/td&gt;
&lt;td&gt;0 chars&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;3,927 chars&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;/pricing&lt;/code&gt; (ClaudeBot)&lt;/td&gt;
&lt;td&gt;0 chars&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2,377 chars&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;/discover&lt;/code&gt; (GPTBot)&lt;/td&gt;
&lt;td&gt;0 chars&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1,788 chars&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;/terms&lt;/code&gt; (Bytespider)&lt;/td&gt;
&lt;td&gt;0 chars&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;7,188 chars&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;/privacy&lt;/code&gt; (bingbot)&lt;/td&gt;
&lt;td&gt;0 chars&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4,420 chars&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;/&lt;/code&gt; (Chrome, human)&lt;/td&gt;
&lt;td&gt;SPA&lt;/td&gt;
&lt;td&gt;SPA — unchanged&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That last row is the constraint that shaped the fix: the homepage is the product entry point, so human visitors have to keep getting the app. Server-rendering it for everyone would have replaced the product with a brochure.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this did not fix
&lt;/h2&gt;

&lt;p&gt;Being readable is not the same as being found. Thirty days after the fix, Search Console showed roughly 65 impressions and 2 clicks across 21 pages — and the query dimension returned zero rows, because Google hides queries below a threshold we had not reached.&lt;/p&gt;

&lt;p&gt;Server rendering is necessary, not sufficient. It removes one reason for invisibility; distribution and links remove the others. Anyone who tells you SSR alone will grow a new site's traffic is selling something.&lt;/p&gt;

&lt;h2&gt;
  
  
  If you are shipping an AI-built app
&lt;/h2&gt;

&lt;p&gt;The same failure will happen to every app your users generate, and to your own site. Three checks, in order:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fetch your page with &lt;code&gt;GPTBot&lt;/code&gt; and &lt;code&gt;ClaudeBot&lt;/code&gt;, count the body text.&lt;/strong&gt; If it is zero, nothing else you do matters for AI visibility.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Look at what your canonical says on a subpage.&lt;/strong&gt; If it points home, you have told Google you only have one page.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Split your crawler list from your permission list.&lt;/strong&gt; One decides the HTML variant, the other lives in &lt;code&gt;robots.txt&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;I build &lt;a href="https://minibuildai.com" rel="noopener noreferrer"&gt;minibuildai&lt;/a&gt; — describe an app, get a Cloudflare project with a real database, deployed. The first two hosted apps are free. But the three failures above will bite any code-generation pipeline on Workers, whatever the product is.&lt;/p&gt;

</description>
      <category>seo</category>
      <category>ai</category>
      <category>react</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Why our AI app builder kept dying at 128 MB</title>
      <dc:creator>sophon</dc:creator>
      <pubDate>Mon, 30 Nov 2026 08:50:18 +0000</pubDate>
      <link>https://dev.to/_5d7082b6b929c6b75c9c8b/why-our-ai-app-builder-kept-dying-at-128-mb-23j4</link>
      <guid>https://dev.to/_5d7082b6b929c6b75c9c8b/why-our-ai-app-builder-kept-dying-at-128-mb-23j4</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://minibuildai.com/blog/ai-app-builder-128mb-memory-limit" rel="noopener noreferrer"&gt;minibuildai.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Every app built on minibuildai is compiled inside a Cloudflare Durable Object. Durable Objects have a hard 128 MB memory limit. Some of our templates needed more than that to compile — and the way we found out, and fixed it, says something useful about content-addressed caches in general.&lt;/p&gt;

&lt;h2&gt;
  
  
  The setup
&lt;/h2&gt;

&lt;p&gt;minibuildai turns a prompt into a working app and deploys it to Cloudflare. Generated apps come in three shapes: static pages, a small Hono backend with SQLite inside a Durable Object, and login/payments templates that add &lt;code&gt;better-auth&lt;/code&gt;, &lt;code&gt;kysely&lt;/code&gt; and a payment SDK.&lt;/p&gt;

&lt;p&gt;The build runs in the same isolate that serves the workspace. That keeps deploys fast and the architecture simple — until a template needs to install a real dependency tree.&lt;/p&gt;

&lt;h2&gt;
  
  
  The failure
&lt;/h2&gt;

&lt;p&gt;Login-template projects started failing with a single, unhelpful message: &lt;em&gt;"build needs more than the platform's 128 MB memory limit."&lt;/em&gt; The apps were tiny. The dependency tree was not. Installing and bundling &lt;code&gt;better-auth&lt;/code&gt; plus &lt;code&gt;kysely&lt;/code&gt; inside the isolate peaked at roughly 500 MB of heap — the isolate is reset mid-build, and no deployment row is ever written.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Path&lt;/th&gt;
&lt;th&gt;Peak memory&lt;/th&gt;
&lt;th&gt;Result inside a Durable Object&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Light template (Hono only)&lt;/td&gt;
&lt;td&gt;~37 MB&lt;/td&gt;
&lt;td&gt;Builds every time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Login template, live install + bundle&lt;/td&gt;
&lt;td&gt;~500 MB&lt;/td&gt;
&lt;td&gt;Isolate reset before deploy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Login template, prebuilt bundle&lt;/td&gt;
&lt;td&gt;&amp;lt; 10 MB&lt;/td&gt;
&lt;td&gt;Deploys in about a second&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  The first fix: prebuild the bundle
&lt;/h2&gt;

&lt;p&gt;If the isolate cannot afford to compile the dependency tree, don't compile it there. We build the login templates' deployment bundle once, offline, outside the 128 MB limit. The artifact (about 1.9 MB of modules) ships next to the template zip.&lt;/p&gt;

&lt;p&gt;At deploy time the platform hashes the exact bundler input — every file, the entry points, the asset config. If the hash matches a prebuilt artifact, the deploy copies the modules and skips npm and esbuild entirely. A miss falls back to the slow path, which is correct but cannot survive the memory limit for heavy templates.&lt;/p&gt;

&lt;h2&gt;
  
  
  The bug that made it fail twice
&lt;/h2&gt;

&lt;p&gt;For a while everything worked. Then every login-template project started failing again — including, oddly, projects that never changed a file.&lt;/p&gt;

&lt;p&gt;The prebuilt cache is keyed by the content hash of the template. Our deploy pipeline regenerates the template archives on every release (prompt files, lockfiles, metadata). The archives changed; the prebuilt artifacts were not rebuilt. Every hash missed. Every deploy fell back to the live install path. Every one of them hit 128 MB.&lt;/p&gt;

&lt;p&gt;What made this hard to spot: the fallback is silent by design. A cache miss is a valid state — it means "bundle it live" — so nothing logged a warning, nothing failed loudly. The product just looked like it was broken.&lt;/p&gt;

&lt;h2&gt;
  
  
  The diagnostic experiment
&lt;/h2&gt;

&lt;p&gt;We stopped guessing and ran one clean experiment: create a brand-new project from the untouched login template, deploy immediately, change nothing.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;New project from the &lt;strong&gt;login&lt;/strong&gt; template → same 128 MB failure within seconds.&lt;/li&gt;
&lt;li&gt;New project from the &lt;strong&gt;light&lt;/strong&gt; template → builds and deploys normally.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That ruled out accumulated workspace state, a degraded object, and bad generated code. The template itself could not deploy — which could only happen if the prebuilt artifact was never matching.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix
&lt;/h2&gt;

&lt;p&gt;Two changes, both small:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Rebuild the artifacts in the same step that regenerates the archives.&lt;/strong&gt; Template deployment now rebuilds and uploads the prebuilt bundles from the exact bytes production will serve, before the worker deploys.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Refuse to ship an artifact that cannot match.&lt;/strong&gt; The offline builder rebuilds the file map the same way the deploy path does, computes the hash, and verifies it against the deploy path's own logic before uploading.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After the fix, a pristine login-template project deploys in about a second, and the gallery's login app (a real registration-and-database app) builds and ships normally.&lt;/p&gt;

&lt;h2&gt;
  
  
  What generalizes
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;A content-addressed cache that silently misses is indistinguishable from a broken product.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you run a similar pipeline, three habits would have caught this on day one:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Instrument misses.&lt;/strong&gt; A cache miss that falls back to an expensive path should emit a warning with the hash and the file count, not just take the fallback.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Regenerate caches where you regenerate inputs.&lt;/strong&gt; Any step that rewrites source material must rebuild everything derived from it — in the same pipeline, not in someone's memory.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Assert the fast path in CI.&lt;/strong&gt; Build one pristine project per heavy template and require the deploy to report "prebuilt", not "live bundling".&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The bigger lesson about limits
&lt;/h2&gt;

&lt;p&gt;128 MB per isolate is a deliberate constraint: it keeps the platform cheap, predictable and fast to start. It is a good limit for serving code and a bad limit for installing arbitrary npm trees. The fix was not to fight the limit — it was to move the expensive, cacheable work outside it and keep the in-isolate path cheap.&lt;/p&gt;

&lt;p&gt;If you are building with AI on Cloudflare, the practical rules are the same: prefer no-build output, keep server dependencies small, and treat dependency installation as an offline step.&lt;/p&gt;




&lt;p&gt;Two more limits bit us the same month, both worth knowing before you start:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;new Function&lt;/code&gt; is unavailable in the Workers runtime.&lt;/strong&gt; The AI SDK's &lt;code&gt;jsonSchema()&lt;/code&gt; compiles a validator with ajv by default, which fails at import time — it looks like a bundler problem. Every hand-written tool schema now passes an explicit &lt;code&gt;validate&lt;/code&gt; function.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A Durable Object row tops out at 2 MB.&lt;/strong&gt; We store deployment modules in SQLite inside the DO; a component-heavy app blew past the row limit. Modules are now gzip BLOBs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want to see what comes out the other end, it is at &lt;a href="https://minibuildai.com" rel="noopener noreferrer"&gt;minibuildai.com&lt;/a&gt; — the first two hosted apps are free and a small app costs about $0.08 in credits. But the useful part of this post is the three limits above; they will bite anyone putting a code-generation pipeline on Workers, whatever the product is.&lt;/p&gt;

</description>
      <category>cloudflare</category>
      <category>workers</category>
      <category>ai</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
