Your Lovable app runs on Lovable Cloud, and you want the backend in a Supabase account of your own. You might need direct database access, a developer may want the service role key, or you simply want to own the place your data lives.
Neither Lovable nor Supabase offers a single button for this. Supabase’s help page confirms there’s no automated transfer of a Lovable Cloud backend into a Supabase account you control, and Lovable describes the move as a series of steps rather than one transfer (Supabase: Lovable Cloud or Supabase backend, Lovable: back up and export your database). The good news is that the steps are well defined. This guide puts them in order and flags the places where a move can go wrong.
Should you move at all?
On Lovable Cloud, Lovable runs the hosting, database, sign-in, file storage, and the AI and connector calls for you. Lovable’s own guide says to move a part of the app out when you have a concrete need it doesn’t meet, such as your own deployment pipeline, a compliance or data residency rule about where the app must run, or a company hosting policy (Lovable: deploying and hosting outside Lovable).
Weigh what you take on. Once the backend is yours, so are backups, uptime, row level security (RLS) rules, sign-in provider settings, OAuth credentials, secret rotation and security scanning. Lovable also says it can’t monitor or debug a backend it doesn’t run, and that its managed OAuth setup and automatic token refresh only work on its built-in backend.
On cost, keep both bills in mind during the move. Exporting code or moving a domain cancels nothing: your Lovable plan and any Cloud usage keep running until you change them, and Supabase bills you under its own plans.
Check which backend you have
Click the Cloud icon in the top bar of the Lovable editor. Supabase’s help page explains the two outcomes:
- If you see screens for managing database tables and users inside Lovable, the backend is Lovable Cloud. That Supabase instance belongs to Lovable, it doesn’t show up among your Supabase projects, and you can’t get its service role key or a direct database URL.
- If you see the Supabase logo, your project’s name and links to the Supabase dashboard, you’re already on your own Supabase project, and this guide doesn’t apply.
What comes across, and what you redo by hand
Lovable’s migration table splits the app into parts. In plain terms:
| Part of the app | How it moves |
|---|---|
| Tables and columns, plus indexes, triggers, functions and RLS policies | Migration files in your repo |
| Storage buckets and their access policies | Migration files in your repo |
| Table data | Database export (or CSV per table) |
| User accounts and password hashes | Database export |
| Files in storage | Download and upload by hand |
| Sign-in providers (Google, GitHub and so on) | Set up again |
| Secrets and API keys (Stripe, email and so on) | Set up again |
| Edge Functions | Deploy with the Supabase CLI |
| Scheduled jobs | Check after the restore, recreate what’s missing |
| App connectors and AI features | Replace with your own accounts |
Plan for the last row early. While your app uses the built-in backend, its connector calls and AI model calls go through Lovable. Those connections aren’t exported, so after the move each one needs its own provider account and code change (Lovable: deploying and hosting outside Lovable).
Step 1: Get the code into your own repository
Connect the project to GitHub, GitLab or Bitbucket with Git sync, which is on every plan. A one-time Download codebase zip is also available on paid plans. Either route gives you the source code, config and migration files. Neither one includes your table rows or your uploaded files.
If you haven’t done this before, follow our guide to exporting a Lovable app to GitHub and running it locally first. Running the app on your own machine shows you which environment variables it reads before you change any of them.
Step 2: Create the new Supabase project
Create a project in your own Supabase account, choose a region close to your users, and store the database password somewhere safe. Note the project URL, the project ID and the publishable (anon) key. You’ll need all three later.
Keep the live app on Lovable Cloud for now. Nothing in steps 2 to 7 touches what your users see.
Step 3: Rebuild the schema from your migrations
Look in the repo for one of these folders:
supabase/migrations/: run the files from oldest to newest, by the timestamp at the start of each file name. You can paste each one into the SQL editor and run it, or link the project with the Supabase CLI and push them all:
npx supabase login
npx supabase link --project-ref your-new-project-id
npx supabase db push
drizzle/migrations/: apply them in the sequence listed in thedrizzle/migrations/meta/_journal.jsonfile.supabase db pushdoesn’t run these, so apply them through the SQL editor.
If one fails, check the order first, then whether it depends on a table that a later file creates.
Step 4: Export the database and restore the data
Request the export in Lovable under More → Database → Manage → Settings. Click Export data, then Export on the Database card, then Start export. Lovable emails you when it’s ready, and you download it from More → Storage (Lovable: back up and export your database).
A few limits to know before you plan dates:
- One export every 24 hours.
- A database using more than 15 GB, or an export file bigger than 5 GB, is beyond self-serve export. Larger databases go through Lovable support.
- The database has to be running. If the project paused because your workspace hit its credit limit, resume it before exporting.
The file is a compressed PostgreSQL custom-format archive (.backup, with zstd compression), not a SQL script, so the SQL editor can’t run it. If the download arrives wrapped in a .zip, extract it first. It contains the schema and the data, including the auth schema where user accounts live. To load it:
- Install PostgreSQL client tools built with zstd support. Without it,
pg_restorecan list the archive’s contents but can’t restore the data. - Run
pg_restore --list lovable-export.backupto see what’s inside, and pick the objects and data you need. Your new project already has its own managed schemas and the tables from step 3, so restoring the whole archive over it can clash with them. - Restore the selected data, including sequence values, so new rows get fresh IDs.
- Check tables, row counts, relationships, and that the app can create new records.
Don’t reach for --clean to make conflicts go away until you’ve read what it does: it drops the objects it’s about to restore. If your migrations inserted seed rows, sort those out before importing the same rows from the export.
Step 5: Users and sign-in
Because the export carries each user’s password hash, users keep their passwords after a restore into Supabase. Sessions are a different matter. Each Supabase project signs login tokens with its own JWT secret, so anyone who is logged in when you switch must log in once more (Supabase: migrating auth users between projects). Tell your users before the switch.
Then set sign-in up again:
- In the new project, open Authentication → Sign In / Providers and enable each provider your app uses.
- In each OAuth app (Google Cloud Console, GitHub and so on), update the redirect URL to the new Supabase project URL.
- Add your app’s live domain to the allowed redirect URLs. If sign-in links start sending users to
localhost, see Supabase auth redirecting to localhost.
Step 6: Files, secrets, functions and scheduled jobs
Files. The database export doesn’t include storage. Download each bucket’s files from More → Storage in Lovable and upload them to the bucket of the same name in Supabase.
Secrets. Secrets saved in Lovable aren’t in any export. Add every key your functions read on the Edge Function Secrets page, or with the CLI: supabase secrets set NAME=value for one, or supabase secrets set --env-file <file> for several.
Edge Functions. You’ll find the code under supabase/functions/. With the project linked, run npx supabase functions deploy. If your app is a newer TanStack Start project, its server functions move with the frontend host instead.
Scheduled jobs. After the restore, compare the schedules in the new database with the ones you had. Recreate missing database jobs with cron.schedule, and set up a scheduler of your own for jobs that call your app. Don’t enable them on both sides at once, or each job runs twice.
Connectors and AI. Search the code for connector calls, AI calls and your old backend URL. Each one keeps going through Lovable, and using your workspace credits, until you replace it.
Step 7: Test on a separate deployment
Don’t touch the Lovable project yet. Deploy a second copy of the app (Vercel, Netlify or your own server) and point that copy at the new backend with environment variables:
VITE_SUPABASE_URL,VITE_SUPABASE_PUBLISHABLE_KEYandVITE_SUPABASE_PROJECT_ID. The build embeds these values, so run a fresh build once they’re set.- On a TanStack Start app, add
SUPABASE_URL,SUPABASE_PUBLISHABLE_KEYandSUPABASE_PROJECT_IDfor the server code.
On that copy, go through this list:
- The app opens cleanly, with nothing red in the browser console.
- Each main screen saves new records and shows existing ones.
- A migrated user can sign in with their old password.
- File uploads and downloads work.
- Every Edge Function answers, and each scheduled job has fired at least once.
If a table returns permission denied (error 42501) on the new project, check its grants: see Supabase “permission denied for table” (42501). If data shows up for the wrong users, or not at all, review the policies with Supabase RLS policies explained.
Step 8: The final switch
Anything written after your test export won’t be in it. So the switch needs a planned pause in writes:
- Time it on the test run. How long the export and restore took tells you how long the pause will be.
- Pause writes. Stop anything that changes data: users, scheduled jobs, webhooks and outside integrations.
- Take the final export (remember the limit of one export every 24 hours), copy over any files added or changed since the test run, and restore.
- Point the Lovable project at the new backend. In the Code view, update the three
VITE_SUPABASE_*values in.env(and the three server values for TanStack Start), and setproject_idinsupabase/config.tomlto the new project ID. Once saved, the preview and every later publish talk to your Supabase project, and the edit syncs to your repository. - Switch traffic and re-enable writes.
If your app can’t pause at all, Lovable’s guide points to copying changes incrementally with your own database tooling. That is a job for an engineer.
After the move: what you now own
You can keep building in the Lovable editor, since it now talks to your own Supabase project. A few things are now on you:
- Backups. Check what your Supabase plan includes, and test a restore before you need one.
- RLS. Policies came across with the schema, but new tables and changes are yours to review. Our security checklist covers what to test.
- Keys. You now hold the service role key. Keep it out of the frontend and out of the repo.
Don’t remove the Lovable Cloud database until you’ve downloaded and checked the export and your files. Removing it deletes the backend for good, including any exports saved in its storage. After that, it stops using credits.
When to bring in help
Lovable itself calls a backend move developer work. The parts that need extra care are the pg_restore into an already set-up project, the final switch, and replacing connector and AI calls.
If you’d rather have a vetted senior engineer plan the migration, run the restore and handle the switch, describe your app on /fix/lovable or /fix/supabase. Fixed price, agreed upfront.
FAQ
Is there an automatic way to move from Lovable Cloud to Supabase?
No. Both Lovable and Supabase say the move is manual: export the database, download the files, move the code with Git sync, then set up sign-in, secrets and outside services again.
Will my users need to reset their passwords?
No, as long as the export is restored into Supabase. Their password hashes travel with it. They will need to sign in again, because the new project signs sessions with its own key.
Can I keep using the Lovable editor afterwards?
Yes. Once .env and supabase/config.toml point at your project, the preview and your publishes use your Supabase backend.
Can I paste the export into the Supabase SQL editor?
No. It’s a compressed PostgreSQL archive, so you load it with pg_restore, which needs zstd support.
What if my credits run out in the middle of the move?
A project that pauses for credits can’t be exported until you resume it. Take your export and download your files early, and keep the project running until the final export is done.
My Lovable app still uses AI features. Do they move?
No. AI calls go through Lovable while you’re on the built-in backend. After the move, switch them to your own AI provider account.
Comments