afterbuild/ops
§ EX-03/nextjs-migration-expert
Next.js migration expert for AI-built apps

Next.js migration expert — App Router migration, Pages Router to App Router port and Vercel deployment migration from Lovable, Bubble, Base44 or Replit.

By Hyder Shah13 min readLast updated 2026-04-15
Quick verdict

Next.js migration expert engagements combine App Router migration, Pages Router to App Router refactors and Vercel deployment migration in one cutover. AI builders trap you: Lovable's GitHub export is one-way, Bubble and Base44 don't export cleanly, Replit Agent's infrastructure isn't portable. We port code and data into a Next.js 16 + Postgres stack on Vercel, keep URLs and sessions intact, and run a zero-downtime cutover. Typical migration: 4 to 6 weeks, $9,999+ fixed price.

Why AI builders ship broken Next.js migration

AI builders optimise for getting to a working prototype. They don't optimise for the day you outgrow the platform. Lovable's chat edits are not reproducible outside Lovable — once you export to GitHub, you can't push changes back. Bubble's visual logic doesn't translate to code at all; escape means rebuild. Base44 wraps Supabase in a proprietary layer; the export dumps raw schemas with no policies. Replit Agent couples your app to Replit's infrastructure — swap hosts and half the integrations break.

The migration itself has four hard parts, and AI-generated code makes each harder. First, data: schemas without migrations, arbitrary UUIDs in the dashboard, and no seed scripts. Second, URLs: AI builders use their own subdomains and internal routing that doesn't map to Next.js file-based routes. Third, auth: sessions signed with a secret that only lives in the AI builder's environment; sign users out and they complain. Fourth, integrations: Stripe webhooks pointing at the old host, OAuth redirects registered to the old domain, cron jobs running on the old infrastructure.

A Next.js migration expert plans all four in parallel. We build the Next.js app from the exported code, introduce Supabase CLI (or Drizzle + Neon/Supabase) migrations backfilled from your current schema, write a redirect map from old URLs to new, issue new session cookies server-side on first visit, and cut DNS over at a planned window. Your paying customers see no interruption. Your URLs still rank in Google. The next engineer you hire can read the code.

Source: Bubble forum — long thread on migration pain out of Bubble

§ MATRIX/ai-builder / failure-mode

Which AI builder shipped your broken Next.js migration?

The Next.js migration failure mode usually depends on the tool that shipped the code. Find your builder below, then read the matching problem page.

AI builderWhat breaks in Next.js migrationGo to
LovableGitHub export is one-way. Supabase tables ship without RLS. Chat history and prompts are lost. OAuth redirects hard-coded to lovable.app subdomain.Lovable migrate-out plan
Bolt.newCode is portable but has no migrations, no tests, and inline secrets. Deployment config non-portable.Bolt.new rescue
v0v0 output is already idiomatic Next.js — the easiest migration. Usually just a backend addition, not a rewrite.v0 to production
CursorCursor output is standard code; migration is mostly refactoring the architectural debt accumulated across 7+ files.Cursor refactor
Replit AgentInfrastructure lock-in: Replit's DB, cron, and object storage don't exist elsewhere. Full rebuild of the backend layer.Replit escape plan
Claude CodeAlready writes to your repo. Migration means imposing architecture across the files Claude touched inconsistently.Claude Code architecture fix
WindsurfPortable code; rarely needs migration unless you're leaving Windsurf-specific CI/CD.Windsurf migration
Base44Closed platform. Export dumps Supabase schema raw. Agent handlers rewritten as Next.js Server Actions.Base44 export plan
§ ANATOMY/next.js migration / failure

Anatomy of a Lovable-to-Next.js migration

A B2B SaaS founder reached us 16 months into building on Lovable. Revenue was $22k MRR, two engineers had tried to join, both quit within a week citing 'I can't work with this.' The Lovable GitHub export sat untouched in a repo; the app's source of truth was still Lovable's chat history. Every feature request from a customer triggered a new prompt. Every prompt regressed something. The founder described it in exactly the user-needs vocabulary: 'we're stuck in a loop, prompt, test, break, repeat.'

We scoped the migration as a fixed-price $9,999 platform escape. Week one: we froze Lovable edits, took a fresh GitHub export, introduced Supabase CLI migrations backfilled from the live schema, and stood up a parallel Next.js 16 app on Vercel in a staging subdomain. We mapped every Lovable route to its Next.js App Router equivalent and wrote a redirect map covering the 12 URLs that ranked in Google. Week two: auth. Supabase Auth stayed, but we wired `onAuthStateChange`, fixed the OAuth allowlist for the new domain, and tested every flow against a real email inbox. Week three: integrations. Stripe webhooks repointed to the new URL, idempotency added, subscription state reconciled. Week four: the cutover.

301 redirects from the legacy URLs carried SEO authority across per Google Search Central's documented handling.
Hyder Shah· Next.js migration rescue engineer

The cutover window was 22 minutes. Final Supabase data sync (there wasn't much drift because we'd run nightly syncs during build), DNS swap at the registrar, OAuth allowlist updated at Google, Stripe webhook endpoint swapped, sessions re-issued to all logged-in users via a one-time cookie reset (users logged back in once with the same credentials). 301 redirects from the legacy URLs carried SEO authority across per Google Search Central's documented handling. No customer data was lost. The founder could, for the first time, hire engineers who would stay.

Three months later the same app supports a team of four engineers, ships weekly releases, and has zero 'the AI broke working features' incidents — because there's no AI in the write path anymore. The migration was not an escape from Lovable as a product; the founder still uses Lovable for prototyping new UX experiments before porting the approved ones to Next.js. The migration was an escape from the AI-builder-as-source-of-truth architecture.

§ RESCUE/next.js migration / engagement

What a Next.js migration rescue engagement ships

From first diagnostic to production handoff — the explicit steps on every Next.js migration engagement.

  1. 01

    Free rescue diagnostic

    Share access to your AI builder project and your target stack preference (Vercel + Supabase is our default). In 24 hours we return a written migration plan with timeline and fixed price.

  2. 02

    Migration design doc

    We write a migration doc listing every URL, every integration (Stripe, OAuth, email, analytics), every data model, and the cutover plan. You approve it before code is written.

  3. 03

    Parallel build

    We build the Next.js app alongside your live AI-built app. Data syncs run nightly from source to target during the build. Nothing customer-facing changes until cutover.

  4. 04

    Cutover

    Planned maintenance window (usually under 30 minutes). Final data sync, DNS swap, OAuth redirect updates, Stripe webhook endpoint update, session re-issuance. Customers log back in once.

  5. 05

    Stabilisation and handoff

    Two weeks of monitoring on call. Delivery doc, Loom walkthroughs, runbooks for common ops (deploy, rollback, DB backup). Optional $3,499/mo retainer for ongoing engineering.

§ AUDIT/next.js migration / first-pass

Every Next.js migration rescue audit checks

The diagnostic pass on every Next.js migration rescue. Each item takes under 10 minutes; together they cover the patterns that cause 90% of AI-built-app failures.

  1. 01
    Current Next.js (or not) baseline

    Lovable and Bolt export Next.js code; Bubble and Base44 don't. We map what needs to be ported vs. what needs to be rewritten.

  2. 02
    Database portability

    Supabase Postgres and Neon are portable. Replit's built-in DB and Base44's proprietary store are not. Escapes from those require a data layer rewrite.

  3. 03
    Auth provider carrying over

    Supabase Auth and Clerk port cleanly with user IDs preserved. Replit's built-in auth and Base44's wrappers require a provider swap and user migration.

  4. 04
    OAuth consent and redirect URIs

    We inventory every OAuth provider (Google, GitHub, Apple, Microsoft) and plan the redirect URI update during cutover.

  5. 05
    Stripe webhook endpoints

    Every Stripe environment (test, live, any custom) has a webhook endpoint we must update atomically at cutover.

  6. 06
    Cron and background workers

    Lovable and Bolt lack cron primitives; Replit has its own. We replace with Vercel Cron, Inngest, or Trigger.dev at migration time.

  7. 07
    Email sender domain and SMTP

    Production-quality email requires SPF, DKIM, DMARC on the sending domain. We set these up during migration.

  8. 08
    URL structure and SEO

    We map every legacy URL and write 301 redirects. Google's guidance confirms 301s carry full authority, usually recovered within days.

  9. 09
    Analytics, monitoring, error tracking

    We migrate PostHog, Sentry, or equivalents and verify every event fires from the new host.

  10. 10
    Environment variable inventory

    Full env var map — preview, production, and any custom environments — with secrets identified for rotation during cutover.

§ DIFF/next.js migration / before-after

Common Next.js migration patterns we fix

These are the shapes AI-generated code arrives in — and the shape we leave behind.

The chat-is-source-of-truth anti-pattern
✕ before · ai-shipped
tsx
01Lovable edits made via chat. GitHub export is read-only; changes go back into Lovable. No engineer can contribute.
The chat-is-source-of-truth anti-pattern
✓ after · afterbuild
tsx
01Git is source of truth. Lovable used only for prototyping. Accepted prototypes are ported manually. Regular engineers can work.
The chat-is-source-of-truth anti-pattern
The dashboard-only schema
✕ before · ai-shipped
tsx
01Schema edits made in Supabase dashboard with no migrations folder. Staging and production drift. No rollback.
The dashboard-only schema
✓ after · afterbuild
tsx
01Supabase CLI migrations backfilled from live schema. Future changes go through migrations. Staging reproduces production.
The dashboard-only schema
The hardcoded platform URL
✕ before · ai-shipped
tsx
01`const API_URL = 'https://myapp.lovable.app'` hardcoded across 15 files. Breaks immediately on cutover.
The hardcoded platform URL
✓ after · afterbuild
tsx
01URL read from env, typed, validated at boot. Deploy-time different per environment.
The hardcoded platform URL
The Replit cron leak
✕ before · ai-shipped
tsx
01A background job runs on a Replit-specific cron. Replit-only scheduling; migrates to nothing.
The Replit cron leak
✓ after · afterbuild
tsx
01Vercel Cron or Inngest with explicit schedule, logged, monitored, replayable.
The Replit cron leak
The SQLite in production
✕ before · ai-shipped
tsx
01Replit Agent's default SQLite. Single-file DB, no backups, no replication, data loss on container restart.
The SQLite in production
✓ after · afterbuild
tsx
01Neon or Supabase Postgres with automated backups, point-in-time recovery, proper connection pooling.
The SQLite in production
The Base44 opaque auth wrapper
✕ before · ai-shipped
tsx
01Base44's auth SDK hides Supabase. Export lands with raw RLS disabled and no policies.
The Base44 opaque auth wrapper
✓ after · afterbuild
tsx
01Policies written and tested explicitly. Auth wired through Supabase or migrated to Clerk. No opaque layer.
The Base44 opaque auth wrapper
The preview-URL Stripe webhook
✕ before · ai-shipped
tsx
01Stripe webhook endpoint pointed at the Lovable preview URL. Events stop firing the moment you cut DNS.
The preview-URL Stripe webhook
✓ after · afterbuild
tsx
01Webhook endpoint updated at cutover, signature secret rotated, event replay verified via Stripe CLI.
The preview-URL Stripe webhook
§ FLAGS/next.js migration / red-signals

Next.js migration red flags in AI-built code

If any of these are true in your repo, the rescue is probably worth more than the rewrite.

flag
signal
why it matters
Your GitHub export hasn't been pulled in 3+ months
Chat history is the real source of truth. Any engineer looking at the repo sees a snapshot months old.
Engineers you've tried to hire quit within two weeks
The codebase isn't workable by humans. The migration cost is paying itself back with every engineer who stays.
Your monthly platform bill is over $500 and climbing
Vercel + Supabase (or equivalent) would cost ~$70 at the same traffic. The delta funds the migration in 6-8 months.
A customer or investor asked to see the code
Chat-based builds aren't diligence-able. Migration is the prerequisite to the conversation.
You need cron jobs, background workers, or scheduled tasks
Most AI builders don't ship these. Migration to Next.js + Vercel Cron / Inngest is the standard path.
Regulatory requirements (SOC 2, HIPAA, GDPR with data residency) are on the roadmap
AI-builder-shared infrastructure doesn't meet these. Migration is the prerequisite to the audit.
Every feature prompt regresses a different working feature
The platform architecture can't sustain iteration. Real engineers on real code can; migration is the path out.
§ PRICING/next.js migration / fixed-price

Fixed-price Next.js migration engagements

No hourly meter. Scope agreed up front, written fix plan, delivered on date.

price
$0
turnaround
Free rescue diagnostic
scope
Written migration plan, timeline, and fixed price in 24 hours.
View scope
featured
price
$1,999
turnaround
Deploy to production
scope
If your code is already portable, we just need to ship it. Env vars, CI/CD, SSL, monitoring.
View scope
price
$3,999
turnaround
Break the fix loop
scope
Architectural refactor plus test coverage before migration. Stops the regression cycle.
View scope
price
$9,999+
turnaround
Platform escape
scope
Full code and data migration to Next.js + Postgres. Zero downtime, 4-6 weeks.
View scope
§ EXAMPLES/next.js migration / real-scopes

What Next.js migration rescues actually cost

Anonymized, representative scopes from recent Next.js migration rescues. Every price is the one we actually quoted.

Small rescue
$1,999

A founder with a clean v0 or Cursor-generated Next.js app that just needs a proper production deploy. Code is portable; the gap is env vars, monitoring, and domain.

Scope
Deploy-to-production pass: env vars, CI/CD, SSL, monitoring, rollback plan. No code migration required.
Duration
7 days
Medium rescue
$4,999

A seed-stage team on Bolt.new with a working app in Supabase, but no migrations, no tests, and inline secrets. Code is portable but needs hardening before it's production-safe.

Scope
Refactor pass + deploy-to-production. Migrations, tests, secret rotation, env var discipline, monitoring.
Duration
3 weeks
Large rescue
$9,999+

A growth-stage SaaS on Lovable, Bubble, Base44, or Replit Agent. Full platform escape with preserved URLs, users, and paying subscriptions.

Scope
Parallel Next.js build, Supabase or Neon migration, auth port, Stripe webhook update, staged cutover, 2 weeks of stabilization.
Duration
4-6 weeks
§ DECISION/next.js migration / migrate-or-patch

Migration, or optimize in place?

The honest answer for a surprisingly large share of AI-built apps is: don't migrate yet. If your Lovable or Bolt app has 50 beta users, a 2k-line codebase, and one engineer, migration is premature. Fix the RLS, harden the integrations, and run another 6 months on the platform. Migration costs $5k-$10k and 4-6 weeks; if the app is still proving its market, that capital and time is better spent on product.

Migration makes sense when three signals appear together. First: platform friction is measurable — a developer refused to work on your codebase, your AI builder regresses features weekly, or your AI bill has passed $500/month with no ceiling in sight. Second: revenue or traction justifies it — paying customers with SLAs, investors looking at the code, or enterprise buyers requesting diligence. Third: a feature your platform can't support is on the roadmap — cron, background workers, SOC 2, HIPAA, or region-specific data residency.

If only one or two signals apply, we usually recommend a targeted rescue instead of a migration. A $499 security audit plus a $799 integration fix solves the 80% case for under $1,500 without a platform change. If all three signals apply — and especially if an engineering hire is blocked by the codebase — migration is usually the cheapest long-term option. The diagnostic is free; we'll tell you honestly which bucket you're in.

Some platforms force migration: Replit Agent's infrastructure doesn't exist elsewhere, Base44's proprietary runtime requires a rewrite, and Bubble's visual logic doesn't translate to code. For those, 'stay and optimize' isn't an option — escape is the only path, and the question becomes when, not whether.

§ RUNBOOK/next.js migration / references

Next.js migration runbook and reference material

The documentation, CLIs, and specs we rely on for every Next.js migrationengagement. We cite, we don't improvise.

§ FAQ/next.js migration / founders-ask

Next.js migration questions founders ask

FAQ
Can a Next.js migration expert move my Lovable app without losing work?
Yes. Lovable's GitHub export is one-way but it's a complete snapshot — code, Supabase schema, and config. A Next.js migration expert takes the export, introduces migrations backfilled from your live schema, rewrites the parts that rely on Lovable's runtime (usually auth callbacks and env vars), and cuts DNS over in a planned Vercel deployment migration window. URLs, sessions, and paying customers are preserved. Typical 4 to 6 weeks.
How much does a Next.js migration expert engagement cost?
Our $0 diagnostic returns a fixed-price quote in 24 hours. Simple Vercel deployment migration where the code is already portable (most v0 and Cursor projects) starts at $1,999 for a deploy-to-production pass. Full App Router migration and platform escapes from Lovable, Bubble, Base44, or Replit Agent start at $9,999 and run 4 to 6 weeks. No hourly billing; scope and date agreed up front.
Will my customers need to log in again after the Vercel deployment migration?
Usually once, at cutover. We re-issue sessions using the same user IDs in Supabase or Clerk, so password reset, OAuth, and roles carry over. If we're also changing auth provider (e.g. Supabase Auth to Clerk), we migrate users via the provider's import API so the first login on the new provider is transparent.
What happens to my SEO during a Pages Router to App Router migration?
We preserve every URL. When a Pages Router to App Router migration changes paths (e.g. Lovable's /app/dashboard becomes /dashboard), we ship a redirect map that returns 301s for every legacy URL. Google treats 301s as a full authority transfer; rankings recover within days. We also carry over structured data, sitemaps, and robots.txt.
Can I keep using Lovable while the Next.js migration expert works in parallel?
Up to the cutover, yes. We run the App Router migration in parallel on a staging domain. You can keep prompting in Lovable right up to the final sync. At cutover, Lovable stops being the source of truth. Any changes you make in Lovable after that won't be in the new app.
What stack does an App Router migration target?
Default is Next.js 16 App Router on Vercel with Supabase (if you're already on Supabase) or Neon + Drizzle (if you want a portable Postgres with no vendor lock-in). We also do Clerk for auth where the original had Supabase Auth problems. For teams that want their own cloud, we deploy to Fly.io, Railway, or AWS ECS — the app is host-agnostic after the migration.
How long does it take to migrate a Base44 app to Next.js App Router?
Four to six weeks for most Base44 apps. Base44 exports the Supabase schema but wraps auth and agent handlers in a proprietary layer, so those get rewritten as Next.js App Router Server Actions or API routes during the migration. We've shipped three Base44 escapes; case study linked above.
What's the risk of skipping a Next.js migration expert engagement?
Three common failure modes. One, platform pricing eats your margin as you scale. Two, an AI builder regression takes the app down and no engineer can help because the code isn't portable. Three, an investor or acquirer walks away because the codebase isn't diligence-able. A planned Vercel deployment migration is insurance against all three.
Next step

Your AI builder shipped broken Next.js migration. We ship the fix.

Send the repo. We'll tell you exactly what's wrong in your Next.js migration layer — and the fixed price to ship it — in 48 hours.

Book free diagnostic →