Guide
Deploy a Lovable app to Vercel, Netlify or Cloudflare Pages (TanStack Start and older Vite apps)
Short answer: connect your Lovable project to GitHub with Git sync, import that repository into Vercel, Netlify or Cloudflare Pages, and build with npm run build on Node.js 22 (output folder dist on Netlify and Cloudflare Pages; Vercel needs no output setting).¹ The code moves in minutes. What the export leaves behind is what breaks: server secrets, sign-in redirect URLs, Stripe webhooks, DNS and, on older apps, the refresh-404 rewrite. This guide covers each one.¹ ²
Lovable says you're never locked in: you can export the code and deploy a copy to a host you already use, and the built-in backend can stay where it is while the frontend moves.² So whether you want your own deploy pipeline or an exit plan in case you leave Lovable, the steps are the same.
First, check which kind of Lovable app you have
Lovable builds apps on two stacks, and they need different hosting.¹
| Your app | What the host has to do | Notes |
|---|---|---|
| TanStack Start (new apps created from 13 May 2026) | Run server code: server-side rendering, server functions and API routes | The project builds through Nitro, which detects Vercel, Netlify and Cloudflare Pages automatically.¹ ³ A host that only serves static files can't run it |
| Older React + Vite | Serve static files from dist/, with a fallback to index.html for client-side routes |
Any static host works¹ |
To check, open package.json in Lovable's Code tab. A TanStack Start project lists @tanstack/react-start in its dependencies; an older React + Vite project doesn't. You can also ask Lovable in chat: "Which stack does this project use, older React + Vite or TanStack Start?"¹
Deploy it, step by step
1. Export the code to GitHub (5 minutes)
Use Git sync, which is on every Lovable plan. Open Project settings → Git → GitHub and click Connect next to your workspace's GitHub connection. Lovable creates a new repository (private by default) and keeps it in two-way sync with the project.⁴ You can't link an existing repository, and deleting the repository stops the sync.⁴
A one-off Download codebase .zip also exists, but it needs a paid plan, and hosts that deploy from Git need a repository anyway.¹ Neither option includes your database records or uploaded files. Those move separately, and only if you move the backend too.¹
Lovable recommends running the app on your own computer from a clone first, to confirm what it installs and which environment variables it reads.¹ Also check the lockfile, the file that pins exact package versions. If the repo has only bun.lock and no package-lock.json, either have the host install with Bun, or run npm install on your computer and commit the package-lock.json it creates.¹
2. Import the repository into your host (5 minutes)
- Vercel: add a new project and import the GitHub repository.
- Netlify: Add new project, then import from Git.
- Cloudflare Pages: Workers & Pages, then create a Pages project from your Git repository. A Git-connected Pages project can't be switched to Direct Upload later.⁵
Pick the branch you deploy production from. Lovable says that can be the branch it syncs, or a separate release branch you merge changes into after reviewing them.¹
3. Set the build settings
The host runs the build command on every deploy, turning your source code into the files (and, on TanStack Start, the server bundle) it serves. These are the settings Lovable documents for both stacks:¹
| Setting | Vercel | Netlify | Cloudflare Pages |
|---|---|---|---|
| Build command | npm run build |
npm run build |
npm run build |
| Output directory | Leave empty | dist |
dist |
| Node.js | 22 | 22 | 22 |
For a TanStack Start app, check that package.json lists a package named nitro. Without it the build doesn't package the app for a host.¹ Lovable also warns that older build configurations can skip Nitro outside Lovable or write to a different folder, so update an older project's build configuration first.¹ The easiest way is Lovable's own prompt: "Prepare this app for deployment outside Lovable. Inspect the framework, build configuration, server functions, and runtime dependencies. Keep the current backend. Explain the compatible hosting options and the environment variables and authentication URLs I need to configure. Preserve the existing Lovable preview workflow." Lovable can't test the result outside its own preview, so check it on the new host.¹
Netlify's and Cloudflare's own TanStack Start guides replace the Nitro build step with their own plugins (Netlify's publishes dist/client, and Cloudflare's targets Workers instead of Pages).⁶ ⁷ Lovable projects already build through Nitro, so keep the settings in the table above unless you deliberately rework the build.
If the first build fails, open that deployment's build log in your host's dashboard. The error near the end usually names the missing package, variable or setting.
4. Add environment variables and secrets (10 minutes)
Lovable splits these into two kinds:⁸
- Browser values start with
VITE_, such asVITE_SUPABASE_URLandVITE_SUPABASE_PUBLISHABLE_KEY(older apps on the built-in backend also useVITE_SUPABASE_PROJECT_ID).¹ They're baked into the JavaScript at build time and are safe to be public. Lovable keeps them in a committed.envfile, so you can copy them from the repo.⁸ That file should only ever hold these public values. - Server secrets, such as
STRIPE_SECRET_KEYorRESEND_API_KEY, live in Lovable's Secrets manager. They're not in the repository or the export, and they're write-only, so you can't read them back out of Lovable either.⁸ ¹ Copy or create fresh values in each provider's dashboard and paste them into the host.
Then add them on the host:
- TanStack Start on the built-in backend: set
VITE_SUPABASE_URLandVITE_SUPABASE_PUBLISHABLE_KEYfor the browser andSUPABASE_URLandSUPABASE_PUBLISHABLE_KEYfor the server, plus any secrets your server functions read.¹ - Older React + Vite apps: set the
VITE_values before the build. Secrets used by Supabase Edge Functions stay in the backend, not on your host.¹ ⁸
Where to add them: Vercel, Settings → Environment Variables; Netlify, Project configuration → Environment variables; Cloudflare Pages, Settings → Variables and Secrets. On all three, changes only apply to the next deployment, so redeploy after editing.¹⁰ ¹¹ ⁵ Never give a server secret a VITE_ name: it would ship to every visitor's browser.⁸
5. Fix the refresh-404 (older React + Vite apps only)
If opening /dashboard directly or refreshing it shows the host's 404 page, add a fallback that serves index.html for every route:¹
- Vercel: add a
vercel.jsonin the project root:¹²
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"rewrites": [{ "source": "/(.*)", "destination": "/index.html" }]
}
- Netlify: add a
_redirectsfile to thepublic/folder (so it lands indist/) with this line:¹³
/* /index.html 200
- Cloudflare Pages: usually nothing to do. If your build output folder (
dist/) has no404.htmlat its root, Pages already servesindex.htmlfor unknown paths. A404.htmlat the root ofdist/switches that off.¹⁴
TanStack Start apps don't need this, because the server handles routing. A 404 on refresh there usually means the host isn't running the server part.¹ Bolt apps hit the same problem: see the Bolt.new refresh-404 fix.
6. Add the new address to sign-in redirect URLs
If sign-in works on Lovable but fails on your new URL, a missing redirect URL is usually the reason.¹ ⁹
- Built-in backend: open More → Users → Settings → Advanced → Redirect URLs and add your new address ending in
/**, for examplehttps://app.yourdomain.com/**. Use a domain you own. Lovable adds its own addresses automatically, but not ones it doesn't serve.⁹ Managed Google, Apple and Microsoft sign-in still work for that address while the built-in backend stays connected.⁹ - Your own Supabase project: set the Site URL to your production address and add your redirect URLs in Supabase's URL Configuration page. The Site URL is the default after email confirmation and password reset.¹⁵ Supabase documents wildcard patterns for Vercel and Netlify preview URLs, but recommends exact URLs in production.¹⁵
- Google sign-in with your own OAuth credentials: the new domain also needs a redirect URI in Google Cloud Console.⁹
Our Supabase auth redirects to localhost guide covers the email-template side.
7. Check where your Stripe webhooks point
Moving the frontend can quietly break payments, because webhooks are tied to a URL.
- Your own Stripe account: Lovable doesn't set up webhooks by default. If you added one, its endpoint points at the webhook function's URL.¹⁶ If that's a Supabase Edge Function and you keep the backend, nothing changes. If the URL changes (a server route on your new host, or a new Supabase project), create a new endpoint in Stripe. Stripe gives each endpoint its own
whsec_signing secret, so store the new one where the handler reads it.¹⁷ Live-mode endpoints must use HTTPS.¹⁷ - Lovable's built-in payments: Lovable registers the endpoints itself, and your app's endpoint can sit on your
lovable.appaddress (/api/public/payments/webhook) or your backend. Lovable warns not to delete or disable those endpoints, because purchases still succeed but subscriptions never activate.¹⁸ Lovable's docs don't cover running built-in payments from another host, so ask Lovable support to check before you switch traffic, as its hosting FAQ suggests for each service you rely on.²
Our Stripe webhooks with Supabase guide covers signature errors.
8. Test on the host's temporary URL, then move DNS
Before touching your domain, Lovable says to test the new deploy against the Lovable version:¹
- open a page other than the homepage, like
/dashboard, directly in the address bar and refresh it, - sign in and sign out,
- run the reads, writes and uploads your app depends on,
- on TanStack Start, load a server-rendered page and trigger a server function.
Then add your domain in the new host and create the exact DNS records that host shows you. Don't copy them from another project.¹⁹ If your domain was connected to Lovable, remove the records that pointed it at Lovable at your DNS provider. Disconnecting the domain in Lovable doesn't cancel its registration.²⁰
Two things stay with Lovable: your lovable.app address keeps serving the version you last published there, and Lovable's Publish button still publishes only to Lovable hosting. If you keep Git sync on, each change Lovable pushes can deploy to your new host.¹ When you no longer want the old address live, unpublish it in Lovable from Project settings → Publishing → Unpublish project.²¹
What usually goes wrong
- A blank page after deploy. The
VITE_values weren't set before the build, or you changed them without redeploying.¹ ¹⁰ Our env vars guide walks through the browser console checks. - A TanStack Start app on a static-only setup. Object storage and CDN-only hosting serve files and don't run the server part, so SSR, server functions and API routes won't work there.¹
- Missing server secrets. Features that call Stripe, email or AI providers fail because secrets aren't in the export.⁸ ¹
- Sign-in sends people back to
lovable.appor errors. The new address isn't in the redirect URLs.⁹ - Payments succeed but nothing unlocks. The webhook still points at the old URL, or the handler is checking the wrong endpoint's signing secret.¹⁷ ¹⁸
- Refresh shows a 404 on an older app. No
index.htmlfallback, or a404.htmlat the root of the build on Cloudflare Pages.¹ ¹⁴ - Two live copies of your app. The
lovable.appaddress keeps serving your last Lovable publish until you unpublish.¹ - Expecting AI features or connectors to move with the code. While the built-in backend stays, they keep running through Lovable and use your workspace credits. If you move the backend, you replace them yourself.¹ ²
FAQ
Can I deploy a Lovable app to Vercel for free? Lovable's Git sync is available on every plan, including Free.² Vercel, Netlify and Cloudflare bill you under their own plans, and while your app still uses Lovable's built-in backend, AI features or connectors, those keep running through Lovable.²
Does the GitHub export include my database and secrets? No. Git sync and the codebase download include the source code and the database migration files, but not your database records, uploaded files or the values in Lovable's Secrets manager.¹ ⁸
Do I need to set up the refresh-404 rewrite for a TanStack Start app?
No. The server handles routing for TanStack Start apps. The index.html fallback is only for older React + Vite apps.¹
Can I keep editing in Lovable after deploying to Vercel or Netlify? Yes. Keep Git sync connected and let the host deploy from the repository. Lovable keeps editing and previewing the app while the host serves the live site.²
Should I use Cloudflare Workers instead of Cloudflare Pages? Nitro's docs call Workers the recommended Cloudflare target for new deployments, and Cloudflare's own TanStack Start guide targets Workers.³ ⁷ Lovable's deployment guide documents Cloudflare Pages with the settings above, so that's the simpler route for a Lovable project.¹
Moving hosts before a launch? Run a free Quick Check on the new URL for leaked keys, exposed .env files, deep-link refresh and HTTPS. For a fuller review before you point real DNS or take payments, see the $49 Launch Check.
Sources
- Lovable docs, Deploying and hosting outside Lovable (check your stack; Git sync vs Download codebase; TanStack Start via Nitro:
npm run build, Node.js 22,diston Netlify and Cloudflare Pages, none on Vercel, env vars; React + Vite:dist,VITE_build-time values, SPA fallback; verify before switching traffic; lovable.app keeps serving; what migrates): https://docs.lovable.dev/tips-tricks/external-deployment-hosting - Lovable docs, Deployment, hosting, and ownership options (no lock-in, hybrid setup, Git sync on all plans, services after moving, costs): https://docs.lovable.dev/tips-tricks/deployment-hosting-ownership
- Nitro docs, Deploy and Cloudflare (zero-config providers incl. Vercel, Netlify, Cloudflare; Workers recommended over Pages): https://nitro.build/deploy and https://nitro.build/deploy/providers/cloudflare
- Lovable docs, Sync your Lovable project with GitHub (Project settings → Git → GitHub, new private repository, limitations): https://docs.lovable.dev/integrations/github
- Cloudflare docs, Pages build configuration (presets, Variables and Secrets, changes on next deployment) and Git integration (no switch to Direct Upload): https://developers.cloudflare.com/pages/configuration/build-configuration/ and https://developers.cloudflare.com/pages/configuration/git-integration/
- Netlify docs, TanStack Start on Netlify (Netlify Vite plugin,
dist/client): https://docs.netlify.com/build/frameworks/framework-setup-guides/tanstack-start/ - Cloudflare docs, TanStack Start on Workers (Cloudflare Vite plugin, remove
nitro()): https://developers.cloudflare.com/workers/framework-guides/web-apps/tanstack-start/ - Lovable docs, Secrets (Secrets vs
VITE_variables, committed.env, write-only values): https://docs.lovable.dev/features/secrets - Lovable docs, Users and authentication (Site URL and redirect URLs, addresses outside Lovable, managed sign-in, Google redirect URIs): https://docs.lovable.dev/features/authentication
- Vercel docs, Environment variables (changes apply only to new deployments): https://vercel.com/docs/environment-variables
- Netlify docs, Get started with environment variables (changes require a build and deploy): https://docs.netlify.com/build/environment-variables/get-started/
- Vercel docs, Vite on Vercel (SPA deep-linking rewrite in
vercel.json): https://vercel.com/docs/frameworks/frontend/vite - Netlify docs, Rewrites and proxies (history pushState and single-page apps): https://docs.netlify.com/routing/redirects/rewrites-proxies/
- Cloudflare docs, Serving Pages (SPA fallback to
index.htmlwithout a top-level404.html): https://developers.cloudflare.com/pages/configuration/serving-pages/ - Supabase docs, Redirect URLs (Site URL, allow list, wildcards for Vercel and Netlify previews): https://supabase.com/docs/guides/auth/redirect-urls
- Lovable docs, Connect your own Stripe account (webhooks off by default, endpoint at the webhook function's URL, signing secret): https://docs.lovable.dev/integrations/stripe
- Stripe docs, Receive Stripe events in your webhook endpoint (
whsec_signing secret unique per endpoint, HTTPS in live mode): https://docs.stripe.com/webhooks - Lovable docs, Add payments to your app (built-in payments webhook endpoints, don't delete them): https://docs.lovable.dev/features/payments
- Vercel docs, Adding & configuring a custom domain (use the values shown for your project): https://vercel.com/docs/domains/working-with-domains/add-a-domain
- Lovable docs, Custom domains (disconnecting a domain, removing DNS records at your provider): https://docs.lovable.dev/features/custom-domain
- Lovable docs, Publish your project (unpublishing): https://docs.lovable.dev/features/publish