You built an app on Lovable by talking to it, people use it every day, and now you want something Lovable won't hand you. Login emails from your own domain, maybe. A staging copy you can break. A developer who wants a real editor. A bill with your name on it. And you're nervous that moving means losing users, or their data.
You won't, if you move in the right order. A Lovable app is a standard React frontend sitting on a standard Postgres database. Nothing in it is locked to Lovable. This guide walks the move one phase at a time, and your app stays up the whole way.
If you only read three lines
- Download your database export before you remove anything. The export lives inside Lovable Cloud, and removing Cloud deletes it.
- Nothing gets removed until its replacement works. Build the new home next to the old one, check it, then switch.
- Your users' passwords don't come along. Write the reset email before you flip the switch, not after.
What you actually own
A Lovable app is three pieces.
- The frontend. A React app, written in TypeScript. Lovable hosts it for you.
- The backend. New projects run on Lovable Cloud. That is Supabase, run by Lovable on your behalf: a Postgres database, Supabase Auth for logins, Storage for uploaded files, and Edge Functions for the bits of code that have to run on a server.
- The builder. The chat box that writes the first two.
There is no custom server in between. Your app talks to Supabase directly, and rules in the database called Row Level Security decide who can read which rows. Think of each table as a filing cabinet with a lock on every drawer, and each lock only opens for the right person. Those locks live in the database, so they move with it.
Postgres is Postgres, and Supabase is open source. You are moving furniture, not rebuilding the house.
Maybe you don't need to move
Lovable has three buttons under Cloud > Overview > Advanced settings that cover the most common worries without a migration:
- Pause turns off a project you aren't using.
- Export project data gives you a full copy of your database. You can run it once every 24 hours and keep building on Cloud in the meantime.
- Remove takes Lovable Cloud off the project. That is the last step of a migration, not the first.
If a backup or a pause is the whole reason, you're done. Move when you need one of these:
| You want to... | Why that takes your own Supabase or hosting |
|---|---|
| Send login emails from your own domain | Cloud sends them from a Lovable address |
| Open the full Supabase dashboard | SQL editor, extensions, logs, monitoring |
| Use the service role key | Admin jobs and some server functions need it |
| Keep staging and production apart | Cloud gives you one database per project |
| Own the bill and the account | Your project, your organization, your card |
| Bring in a developer or another tool | They work in the repo, no chat required |
Three ways off, each one a step further
Path 1. Take the code, keep the backend. Connect GitHub, host the frontend yourself, leave Lovable Cloud as the database. The smallest change there is, for when the backend is fine and you just want the code on your own hosting.
Path 2. Move the backend to your own Supabase. Export the database, restore it into a Supabase project you own, then connect that project back to Lovable. You keep building in the chat, on a backend that belongs to you. Pick it for custom auth emails, the service role key, the full dashboard, or a staging database.
Path 3. Leave Lovable entirely. Path 2, then host the frontend yourself and work in your own editor. For when a developer or a team is taking over and wants pull requests, tests, and preview deploys.
You can stop at any of them. Most of what follows is Path 2, where the work is. Paths 1 and 3 are mostly hosting, covered near the end.
Rule one: nothing gets removed until its replacement works
Until the final step, your app keeps running on Lovable Cloud, untouched. The order:
- Export the database
- Download the export and your storage files
- Build the new Supabase project
- Test logins there
- Check that every count matches
- Remove Lovable Cloud
- Connect your Supabase to the Lovable project
Steps 1 through 5 can be thrown out and redone as many times as you like. Step 6 cannot.
Much of the detail below comes from Carol Monroe's Lovable Cloud migration playbook on GitHub, run start to finish on a real project this year. For every trap spelled out, read it too.
Phase 1: get your code into GitHub
Code is the easy part. In the Lovable editor, connect the project to GitHub through the GitHub integration. Lovable pushes the whole project to a repo you own and keeps them in sync both ways from then on.
Clone it and open the supabase/ folder. It holds:
migrations/: timestamped SQL files for every table, policy, function, and trigger Lovable builtfunctions/: the code for each Edge Functionconfig.toml: settings, including whether each function requires a logged-in user (verify_jwt)
Now take inventory. Write down how many tables, users, storage files, Edge Functions, cron jobs, and secrets the app has. It's counting boxes before the movers come. You count again at the other end, and nothing gets thrown away until the numbers agree.
Phase 2: export and download everything
Export the database. Go to Cloud > Overview > Advanced settings > Export project data and click Export data. Don't sit waiting on the email. After a minute or so, look under Cloud > Storage for a new bucket named something like database_export_03_10_26. The export is a .zip in there.
What you get is a normal pg_dump backup: schema, data, RLS policies, triggers, functions, sequences. It's capped at 5 GB, once a day. Bigger than that, email Lovable support with your project ID.
Download it before anything else. The export sits inside Lovable Cloud's own storage. Remove Cloud first and the export goes with it. Download the zip, unzip it, and make sure it reads:
pg_restore --list your-export.backup | head -50
pg_restore --list your-export.backup | grep -c "TABLE DATA"If pg_restore complains about zstd compression, your Postgres tools are too old or were built without it. On a Mac, brew install postgresql@18 and call that pg_restore by its full path. The version number on its own won't tell you.
Download your storage files. The database export carries the list of your files, not the files. It's a moving inventory with no boxes behind it. Pictures, PDFs, and uploads come down separately.
Make one local folder per bucket, keep the bucket names and subfolders exactly, and skip the database_export_* bucket. A handful of files you can pull from the Storage tab by hand. Hundreds, script it.
Phase 3: build the new home
Create a Supabase project. Sign up at supabase.com, make a project, pick a region near your users, and save the database password somewhere safe.
Get the right connection string. Click Connect in the dashboard and copy the Session pooler string:
postgresql://postgres.[project-ref]:[password]@[pooler-host]:5432/postgresSession pooler, not the direct connection. Direct connections are IPv6 only, and a lot of home internet can't reach them. If your password has special characters, encode them for a URL (! becomes %21).
Restore.
pg_restore --no-owner --no-privileges \
-d "postgresql://postgres.[project-ref]:[password]@[pooler-host]:5432/postgres" \
your-export.backup 2> restore-errors.logYou'll get a wall of errors. That's expected. The new project already has its own auth, storage, and cron setup, so the backup's attempts to recreate those fail with "already exists" or "permission denied," and your data lands around them. Judge the restore by the counts, not the log.
Check your users. In the SQL editor:
select
(select count(*) from auth.users) as users,
(select count(*) from auth.identities) as identities;If identities is lower than users, the restore loaded those tables in the wrong order and a foreign key turned some rows away. Run just that one table again:
pg_restore --data-only -n auth -t identities \
-d "<connection string>" your-export.backupThe two numbers should match each other, and match your inventory.
Phase 4: fix what the restore can't carry
A backup is a snapshot. A few things in a live app point outside the database, and those need a hand.
Passwords. Lovable's docs say user passwords don't come through the export in a usable form. Every email-and-password user will set a new one. Turn on password recovery in the new project, test it start to finish, and tell your users before the switch. One short email ("we moved to new servers, please reset your password") heads off a pile of support messages. Google and magic-link sign-ins aren't affected.
Cron jobs. Scheduled jobs are in the backup, but the restore isn't allowed to write them. They're alarms set on a clock you left in the old place. Turn on pg_cron under Database > Extensions and set each one again:
select cron.schedule('nightly-cleanup', '0 3 * * *', $$ delete from carts where updated_at < now() - interval '7 days' $$);Then hunt for jobs that call a URL on the old project. Those fail quietly, forever:
select jobid, jobname, command
from cron.job
where command like '%supabase.co%';Storage files. The restore brought over rows describing files that aren't there yet. Those ghost rows block uploads with "resource already exists." Clear them through the Storage dashboard or the CLI, not SQL, and delete the database_export_* bucket. Then upload:
supabase storage cp --recursive ./avatars ss:///avatars -p <project-ref>Open one picture in a browser to prove it landed.
Old URLs in your data. Any column holding a full URL still points at the old project. Find them and swap the project reference:
update products
set image_url = replace(image_url, '<old-ref>', '<new-ref>')
where image_url like '%<old-ref>%';One exception. Signed URLs, the ones ending in ?token=, are stamped with the old project's keys, like a ticket for a venue that closed. Rewrite them and you get links that look fine and don't work. Set them to null and let the app issue fresh ones.
Edge Functions and secrets. The function code is in your repo, so deploying it is one line:
supabase functions deploy --project-ref <new-ref> --workdir .The secret values don't travel. Your Stripe key, your email provider's key, whatever else the functions read: type each one in again under Edge Functions > Secrets, with the same names. Making fresh keys at each provider beats digging for the old ones. Don't copy any SUPABASE_* keys; the new project makes its own.
Lovable AI features. If the app uses Lovable's built-in AI, it calls Lovable's AI gateway with a LOVABLE_API_KEY. That key is a workspace secret and keeps working after Cloud is gone, but your own Supabase functions can't see it. On Path 2, ask the Lovable agent to move those calls into Lovable server functions, or copy the key into your function secrets. On Path 3, replace the gateway with a direct call to an AI provider and your own key.
Phase 5: the gate
Line the new project up against the inventory from Phase 1:
| Check | Old | New | OK? |
|---|---|---|---|
| Tables and row counts | |||
| Users and identities | |||
| Storage files per bucket | |||
| Edge Functions | |||
| Cron jobs | |||
| Secrets re-entered | |||
| Rows still pointing at the old project | 0 |
Then do three things a real user does:
- Reset the password on a migrated account and log in with it
- Open a real uploaded image
- Run one Edge Function, a test checkout, say
All green, move on. Anything red, stop and fix it. Lovable Cloud is still running and nothing is lost. There's no clock on this; sitting at a green gate for a few days is fine.
One catch. The backup is a picture of the database at the moment you exported. If people kept using the app after that, their new orders, signups, and edits aren't in the new copy. Export again right before you switch, or plan a short quiet window.
Phase 6: flip the switch
Remove Lovable Cloud. Go to Cloud > Overview > Advanced settings > Remove Lovable Cloud. Two checkboxes and the project name. This deletes the Cloud database and its storage, including any export you didn't download.
Connect your own Supabase. Once Cloud is gone, the Cloud tab changes. At the bottom, pick connect an existing Supabase project, authorize your organization, and choose the new project. Lovable rewrites your .env with the new URL and key.
The integration can also overwrite your Supabase client file with a template. On newer projects that render on the server, that can break the build. An error page right after connecting is that, not lost data. Give the Lovable agent a careful prompt:
Review my Supabase connection. Confirm the app points to my new Supabase
project, and check that auth, database queries, storage, and edge functions
all work against it. List anything still referencing the old backend.
Important: the database, users, storage files, and edge functions ALREADY
EXIST in the new project. Do NOT create tables, run migrations, re-seed data,
or rewrite files beyond the connection wiring. Fix wiring only.Leave off the "do not" lines and a bare "fix my connection" can send a keen agent off re-running migrations against your real data.
Final tidy.
- Google and other social logins: set each provider up again in the new project with the callback
https://<new-ref>.supabase.co/auth/v1/callback, and update it in Google's console too. - Site URL and redirect URLs under Authentication > URL Configuration.
- Delete the
.backupfile. It holds your users' personal data. Treat it like a password. - Rotate the database password if it was ever pasted into a chat, a script, or an AI tool.
- Delete temporary helpers in both places. GitHub sync runs both ways, so a helper you delete in Supabase comes back if it's still in the repo.
That's Path 2 done. Your app runs on a Supabase project you own, and you can keep building in Lovable.
Hosting the frontend yourself
Paths 1 and 3 need a new home for the frontend. Lovable projects are plain React apps, so any modern host does: Vercel, Netlify, Cloudflare Pages, or a server of your own.
Check which kind of app you have. Most Lovable projects are single-page apps built with Vite:
npm install
npm run build # outputs a static site to dist/A static host serves dist/ as is. Add a rewrite rule so every path serves index.html, or refreshing any page but the home page shows a 404.
Some newer Lovable projects render on the server. If package.json lists TanStack Start or something like it, you need a host that runs Node, not just static files. Check before you buy a plan.
Then set the same environment variables your .env uses, usually VITE_SUPABASE_URL and VITE_SUPABASE_PUBLISHABLE_KEY. Anything starting with VITE_ ends up in the browser, so only the public key belongs there, never the service role key.
Last, move your domain. Point DNS at the new host, wait for the certificate, and update the Site URL in Supabase Auth so login links and password resets land on the right domain.
Your first week on your own
Lovable was doing a few chores for you without saying so. Pick them up:
- Two projects, not one.
yourapp-devandyourapp-prod. Break things in dev. Never test against your real customers. - Migrations as save points. Every schema change is a file in
supabase/migrations/, committed, applied to dev first and prod second. - Backups you've restored once. Turn on daily backups or Point in Time Recovery, and once a month restore one to a scratch project to prove it works.
- Row Level Security on every table. Check that every table has it on. Then sign in as an ordinary user and try to read someone else's rows.
What it costs you
- On Path 3, the chat. Lovable's best trick is a change in seconds from one sentence typed in the chat. Off Lovable, a change is an edit, a commit, and a deploy. Plenty of teams keep Lovable for prototypes and run production elsewhere.
- Money. A small Supabase project runs free or near it. Production apps generally start on the Pro plan, which starts at $25 a month per organization. Frontend hosting for a small app is often free.
Where to start
Do the one step today that costs nothing and can't hurt: export your data and download the zip. You'll own a copy of your database by tonight, whether or not you go further.
If you would rather hand the whole move off, ask through pineywoodsweb.com/contact. We take the inventory, do the move, and hand it back with every count matched. We quote the price before any work starts.
Want this looked at on your own site? Send the business name and we will check it, no pitch.
