DEV Community

Ricardo N.
Ricardo N.

Posted on Fully Autonomous

Moving a Lovable app from Lovable Cloud to your own Supabase (with users keeping their passwords)

If your app runs on Lovable Cloud and you want your own Supabase project (direct database access, your own backups, a region you choose, or clean ownership before handing the app over), there is no one-click transfer. Lovable's external deployment guide lists what moves, but the tricky parts are left to you.

This is the order I follow. I rehearsed it end to end on a local Supabase before doing it for anyone, and the scripts are open source (link at the end).

A date to know first: December 1, 2026

Lovable retired the Test/Live split on October 23, 2026. Every project now runs on one database. Detached Test databases can still be restored on request, but on December 1, 2026 they are deleted for good (Lovable docs). If anything you need lives only in Test, ask Lovable to restore it before then. If you want separate development and production databases again, that is one more reason to own your Supabase setup.

1. List what only works inside Lovable

Before moving anything, write down the features that depend on Lovable itself. Typical ones:

  • Lovable AI calls (you will need your own model provider key)
  • emails sent by the platform
  • Google sign-in configured through Lovable (you will need your own Google OAuth client)
  • scheduled jobs

Each of these needs a replacement on your side. Finding out after the switch is the expensive way.

2. Create the schema in the new project

Apply your migrations in order (supabase/migrations, or your ORM's migration folder). Two things to watch:

  • some migrations insert sample or seed rows. If you import your real data afterwards, you get duplicates or key conflicts. Check for INSERT statements in migrations.
  • extensions used by your schema must be enabled in the new project first.

3. Import the data with triggers switched off

Most Lovable apps have a trigger on auth.users that creates a profile row for each new user. If it fires during the import, every user gets a second profile, or the import fails on a unique key.

Import in replica mode so triggers do not run:

psql "$NEW_DB_URL" -v ON_ERROR_STOP=1 \
  -c "SET session_replication_role = replica" \
  -f data.sql
Enter fullscreen mode Exit fullscreen mode

In my rehearsal, the same import without replica mode fails. That is the control that shows the step matters.

4. Users keep their passwords

Supabase stores bcrypt hashes in auth.users (and the provider links in auth.identities). Move both tables with your data and users sign in on the new project with their old passwords. No reset emails.

One honest caveat: the new project has a different JWT secret, so everyone who is currently signed in has to sign in again once. Passwords stay the same.

5. Fix the sequences

After a bulk import, serial ids still start at 1 and the next insert fails with a duplicate key. Set each sequence to the current maximum:

select setval(pg_get_serial_sequence('public.orders', 'id'),
              coalesce(max(id), 1))
from public.orders;
Enter fullscreen mode Exit fullscreen mode

Repeat for every table with a serial or identity column.

6. Storage files, same paths

Download the files from each bucket and upload them to buckets with the same names, keeping the exact object paths. Your rows usually store paths, not full URLs, so keeping paths means nothing in the data has to change. Recreate the storage policies too, then test that a user can read their own file and not someone else's.

7. Compare before and after

Do not trust "it ran without errors". Count things on both sides and compare:

  • rows per table
  • RLS enabled per table, and the number of policies
  • functions and triggers
  • users and identities
  • files per bucket

If any number differs, stop and find out why before switching.

8. Switch the app

  • freeze writes in the old app while you export, or data written after the export is lost
  • point the app at the new project (in Lovable apps this is usually VITE_SUPABASE_URL and the publishable/anon key)
  • redeploy edge functions and set their secrets in the new project
  • sign in with a real user and use the main features
  • keep Lovable Cloud for a few days as a fallback before removing it. Removal cannot be undone.

Remember that on your own Supabase, backups, monitoring and backend security are your job now.

The scripts

Everything above is in a small, tested toolkit: a plan generator that reads your repo, a data extractor for Lovable's export, a storage uploader and the before/after counts: github.com/ricardonldev/lovable-cloud-to-supabase. The rehearsal runs on a local Supabase with made-up users and checks old passwords, RLS isolation, storage policies, sequences and special characters.

If you would rather have it done for you, I offer it as a fixed-price service on Fiverr.

Not affiliated with Lovable or Supabase. Written with AI assistance (Claude); the steps and scripts are tested by me.

Top comments (0)