Contents
In brief
Lovable moved lovable.dev (~400 routes, 850K+ lines, 42M+ monthly uniques) from Next.js on Vercel to TanStack Start on Lovable’s own platform. The win was not a cutover rewrite—it was months of dual-framework serving behind a proxy, a shared code folder, and staged rollouts by route group.
What happened
The marketing/product site ran on Next.js; Vercel fixed earlier scale pain, but Lovable already hosts user apps as Cloudflare workerd workers. Migration goals: dogfood the same serving path, shorten feedback loops, and feed learnings into the builder agent.
The project lasted ~six months while the codebase grew from ~350K to 850K+ lines. A front proxy chose Next.js or TanStack Start per route and feature flag. Hard navigations across frameworks cost ~5s median vs ~1.5s soft ones, so routes were batched by user journeys and shipped as groups. Cross-document View Transitions softened the flash.
Shared code lived under #shared/ with lint bans on next / TanStack imports. API gaps used TypeScript path adapters (@platform/router, etc.). Next.js-specific code fell to ~3%. Agents handled mechanical moves via reusable skills; one engineer owned review and traffic.
At 20% dashboard traffic an OOM on V8 isolates hit: a few extra MB of static data killed isolate reuse. Rollback in minutes, then lazy-load the heavy pieces.
Why it matters
Public write-ups of frontend migrations at tens of millions of users without a big bang are rare. The architectural claim: the framework is a thin shell; 90–95% should be portable. Then swapping stacks is adapters + rollout, not rewriting the product.
Operationally: deterministic flags for tests, one external percent rollout at a time, synthetic plus field web vitals, and fast rollback beat perfect prediction.
In practice
- Replace
next/image, fonts, auth, and i18n with portable libs before the framework swap. - Dual-run behind a proxy; migrate route groups that users traverse together.
- Enforce
#shared+ no-framework imports; default new features there. - Bridge APIs with module-alias adapters, not a mega context tree.
- Watch isolate bundle size and RSS—one “harmless” JSON blob can thrash edge workers.
Takeaway
Agents plus portability rules let one developer swap the web framework under a growing codebase. lovable.dev is now just another bundle among tens of millions of apps on the same platform.

