Deploying a Lovable site on your own hosting
By Yash Garg · · 6 min read
To run a Lovable site on your own infrastructure, link your Lovable project to a private GitHub repository, export your data out of Lovable Cloud, and import that repository into Vercel, Netlify, or Cloudflare Pages. Git sync transfers your front-end application code automatically, but it will never transfer backend data, storage assets, or environment secrets. Once your repository is connected to your host, you must provide your database credentials manually in the hosting dashboard.
According to Vercel's Lovable integration guide, Lovable projects use TanStack Start as their underlying framework and use Nitro, deploying to Vercel with zero configuration. Both architectures run cleanly on external hosts once configured. After your infrastructure is live, you can set up options to let clients edit a Lovable site without code so non-technical team members can safely update content.
Step 1: Set up repository ownership and inspect your framework
Start by moving your application code into your own version control. In your Lovable project, open Settings, select Git, and authenticate with GitHub. Lovable creates a private repository on your account and pushes your code automatically.
As detailed in Lovable's GitHub integration guide, Lovable tracks and edits only one branch at a time, which defaults to your repository's default branch, usually `main`.
Check your `package.json` to identify how your application builds:
- Standard Vite SPA: Contains dependencies like `react-router-dom` and outputs static files to a `dist` directory via `npm run build`.
- TanStack Start SSR: Contains `@lovable.dev/vite-tanstack-config` and leverages a Nitro runtime server for server rendering, as noted in Vercel's Lovable documentation.
Keep file thresholds in mind before pushing large assets. Lovable restricts in-browser file edits to files under 10 MB. In addition, GitHub enforces a strict 100 MB limit per file, which will reject pushes containing uncompressed media. For a detailed breakdown of codebase transfers, read our guide on how to export a Lovable project to GitHub.
Step 2: Migrate backend data, auth, and storage buckets
If your site relies solely on mock data, you can move straight to hosting. If your app uses Lovable Cloud, you are running on a built-in backend that utilizes Supabase's open-source foundation, including a database, user authentication, storage, and edge functions, as outlined in Lovable's cloud documentation and Lovable's Supabase integration guide.
To migrate your database to an external, self-managed Supabase instance:
- Request a database snapshot: Navigate to Stack > Lovable Cloud > Advanced settings > Export data.
- Restore database tables and users: Create a project in your external Supabase dashboard. Restore the archive using the `pg_restore` command line tool or Supabase migration tooling. This restores your schema, tables, database triggers, Row Level Security (RLS) policies, and encrypted records inside `auth.users`.
- Transfer storage bucket assets: The `.backup` archive contains database schema and text rows only. Files, avatars, and documents uploaded to Lovable Cloud storage buckets are excluded. You must download these assets from Lovable storage and upload them into matching storage buckets in your new Supabase project.
- Deploy edge functions: Any custom backend logic located under `/supabase/functions/` in your repository must be deployed to your production instance using the Supabase CLI (`supabase functions deploy`).
Step 3: Deploy to Vercel, Netlify, or Cloudflare Pages
Once your database is running independently, point your Git repository to your hosting provider.
Vercel deployment
Import your private repository into Vercel. According to Vercel's Git deployment documentation, Vercel automatically generates deploy previews for every push and deploys the production branch when commits land on `main`. For TanStack Start SSR builds, ensure your `package.json` includes `@lovable.dev/vite-tanstack-config` version `^2.6.2` or higher, which enables zero-config SSR detection as documented in Vercel's integration guide.
Netlify deployment
Create a new site from your Git repository in Netlify. Set the build command to `npm run build` and the publish directory to `dist`. If you are deploying a client-side Vite SPA, client-side routing will break on reload unless you configure redirects. Place a plain text file named `_redirects` inside your `public` folder with the following single rule:
`/* /index.html 200`
If an unintended code push breaks production, Netlify deploy management allows you to instantly republish an earlier deploy without triggering a new build.
Cloudflare Pages and Workers
In Cloudflare's dashboard, navigate to Workers & Pages and connect your GitHub repository. Cloudflare's CI/CD builds documentation explains that Cloudflare connects directly to the repository to trigger automated builds on push. For client-side apps, build output is placed in the `dist` directory, as outlined in Cloudflare's React and Vite guide. If you are running an SSR application on Cloudflare, implement `@cloudflare/vite-plugin` to compile your server code for the Workers runtime, as explained in Cloudflare's Vite plugin documentation.
Hosting comparison
| Feature | Vercel | Netlify | Cloudflare Pages / Workers |
|---|---|---|---|
| Vite SPA build output | `dist` | `dist` | `dist` |
| SSR support | Native auto-detection with `@lovable.dev/vite-tanstack-config` | Configurable via framework build plugins | Requires `@cloudflare/vite-plugin` targeting Workers |
| SPA deep-link routing | Handled automatically | Requires `_redirects` rewrite rule | Requires Single Page App rewrite rule |
| Preview builds | Every pull request and non-production branch | Every branch deploy and pull request | Every pull request and branch push |
Step 4: Update environment variables, auth callbacks, and DNS
Your deployment will fail or present a blank screen if your client-side environment variables are missing. Git sync never exports secret keys.
Add your environment variables to your host's project settings:
- `VITE_SUPABASE_URL`: Your new external Supabase project URL.
- `VITE_SUPABASE_PUBLISHABLE_KEY` (or `VITE_SUPABASE_ANON_KEY`): Your public API key.
- Any external third-party public tokens (for example, payment processing or analytics keys).
Next, fix authentication redirection. Open your external Supabase project, navigate to Authentication, and open URL Configuration. Update the Site URL to your live production domain. Add the new URL to your authentication provider's allowed redirect URLs according to Lovable's external hosting tips. Omitting preview domains will cause user authentication loops.
Finally, reroute external webhooks. If you process payments or transactional messages, update your webhook endpoints in provider dashboards to point to your new Supabase edge functions instead of Lovable Cloud. Then point your domain's A or CNAME DNS records to your hosting provider's edge network.
Managing ongoing client edits without breaking production
Once your site is hosted externally, managing ongoing updates requires care. Lovable supports bi-directional synchronization, as documented in Lovable's git sync overview. However, if Lovable remains connected to your `main` branch, generating new prompts inside Lovable pushes commits directly to `main`, immediately triggering live builds.
To protect production, adjust your Git workflow:
- Change Lovable's connected branch to a dedicated `dev` or `staging` branch inside project settings.
- Merge updates into `main` using tested pull requests.
- If a bad prompt reaches production, use `git revert` to undo the changes with new commits, as described in the official git-revert documentation. You can learn more about protecting workflows in our guide to branch strategies for client content.
If your client only needs to update page text, images, or list items without changing layout logic, you do not need them prompting inside Lovable. TurnIntoCMS connects directly to your GitHub repository to provide a visual editing layer for sites built with React, Vite, or Next.js. Clients click on text or images on a live preview to edit them, and TurnIntoCMS writes the change back as a standard Git commit on your repository branch.
TurnIntoCMS is free for one project, and costs $1 USD once per additional project with no subscriptions. It only works with GitHub repositories and edits content stored directly in code or imported data files, not data residing in dynamic databases.
FAQ
Can I still prompt inside Lovable after deploying to my own host?
Yes. Lovable pushes commits to your linked repository whenever you update code through prompts. To prevent untested prompts from deploying straight to production, switch Lovable's sync branch to `staging` in project settings.
Do users need to reset their passwords when moving out of Lovable Cloud?
No. Exporting your database generates an archive that includes the complete Postgres `auth.users` table, including existing password hashes. Restoring this snapshot into an external Supabase project preserves all passwords, though users must sign in again to create active sessions.
Why does my Vite app return a 404 when refreshing deep pages on Netlify or Cloudflare?
Vite SPAs resolve routes in the browser using client-side JavaScript. When a browser requests a subpath like `/about` directly, static file servers return a 404 unless configured to serve `index.html`. On Netlify, add a `/* /index.html 200` rewrite to your `public/_redirects` file; on Cloudflare Pages, enable SPA fallback routing.
Can I export and deploy my code on the free Lovable plan?
Yes. GitHub repository synchronization is fully supported on the free plan, allowing you to connect a private repository and push to your own host. Direct one-click `.zip` codebase downloads, however, require an upgraded account.
Sources
- Sync your Lovable project code with GitHub, GitLab, or Bitbucket (docs.lovable.dev, checked November 23, 2026)
- Built-in backend (docs.lovable.dev, checked November 23, 2026)
- Deploy a Lovable app on Vercel (vercel.com, checked November 23, 2026)
- Vite plugin · Cloudflare Workers docs (developers.cloudflare.com, checked November 23, 2026)
- Deploying and hosting outside Lovable (docs.lovable.dev, checked November 23, 2026)
- React + Vite · Cloudflare Workers docs (developers.cloudflare.com, checked November 23, 2026)
- Connect to Supabase (docs.lovable.dev, checked November 23, 2026)
- Sync your Lovable project with GitHub (docs.lovable.dev, checked November 23, 2026)
- Deploying Git Repositories with Vercel (vercel.com, checked November 23, 2026)
- Manage deploys (docs.netlify.com, checked November 23, 2026)
- Builds · Cloudflare Workers docs (developers.cloudflare.com, checked November 23, 2026)
- Git - git-revert Documentation (git-scm.com, checked November 23, 2026)