Migrate From Lovable to Your Own Supabase Project
Lovable provisions a shared Supabase project behind the scenes. Moving to your own project gives you full control over billing, backups, and security policies — but it requires a deliberate sequence: export the schema, dump the data, replicate RLS policies and edge functions, update connection strings, and handle the auth-hash limitation before cutting users over. This guide covers each step in order.
By Founder Name · Last verified: 2026-06-24
Before you start: what to inventory before migrating Supabase
The most common reason a Supabase migration fails is discovering mid-cutover that something was missed — a missing RLS policy, a Stripe secret not copied to the new project's edge function secrets, or a storage bucket that was not included in the data dump. Complete this inventory before touching the CLI.
- List all tables in your Lovable Supabase project — run: SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';
- List all RLS policies — run: SELECT tablename, policyname, cmd FROM pg_policies;
- List all edge functions — check supabase/functions/ in your GitHub repo.
- List all function secrets — in the Supabase dashboard go to Edge Functions → Manage secrets.
- Check whether your app uses Supabase Storage (file uploads) — these are NOT included in db dump.
- Note which auth providers are enabled (email, Google, GitHub, etc.) — you will need to re-enable them in the new project.
- Find your Lovable Supabase project reference in Project Settings → Supabase (the alphanumeric string before .supabase.co).
What does 'own Supabase project' give you that Lovable's shared instance doesn't?
Lovable's managed Supabase instance is convenient for prototyping but limits you in ways that matter for production: shared infrastructure, no direct backup access, no point-in-time recovery, and no control over database extensions or connection poolers. Owning the project unlocks those controls.
| Capability | Lovable shared Supabase | Your own Supabase project |
|---|---|---|
| Direct database access | Via Lovable editor only | Full psql / pgAdmin / TablePlus access |
| Backup and point-in-time recovery | None exposed | Supabase Pro: daily backups + PITR |
| Database extensions (pg_cron, pgvector, etc.) | Limited by Lovable config | Enable any supported extension |
| Connection pooler (PgBouncer / Supavisor) | Lovable-managed | Configure pool size and mode |
| Compliance and data residency | Lovable-chosen region | Choose your own region |
| Edge function secrets | Accessible in Lovable UI | Fully yours — manage in Supabase dashboard |
| Monthly cost | Bundled with Lovable plan | Supabase Free tier or Pro ($25/mo) |
| Storage (file uploads) | Supabase-managed via Lovable | Fully configurable buckets and policies |
How do I export my schema from the Lovable Supabase project?
You can export the database schema directly from the Supabase dashboard SQL editor, or use the Supabase CLI with supabase db dump to get a complete schema and data dump. The CLI approach is more reliable for large databases and preserves enum types, triggers, and function definitions that the SQL editor may truncate.
- Install the Supabase CLI: npm install -g supabase.
- Log in: supabase login.
- Link to your Lovable Supabase project: supabase link --project-ref <your-ref>.
- Dump the schema: supabase db dump --schema public > schema.sql.
- Dump the data: supabase db dump --data-only > data.sql.
- Review both files before importing — check for any references to Lovable-specific extensions.
How do I create a new Supabase project and import the schema and data?
Create a new Supabase project in your own organisation, then apply the schema dump followed by the data dump. The order matters: schema first to create tables and types, data second to populate them. Run both inside the Supabase SQL editor or via the CLI connected to the new project.
- Go to supabase.com → New project. Choose your organisation and region.
- Once the project is ready, open the SQL editor.
- Paste and run the contents of schema.sql first.
- Paste and run the contents of data.sql after the schema succeeds.
- Verify row counts: SELECT count(*) FROM each critical table.
- Update your app's VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY to the new project's values.
How do I migrate RLS policies to the new Supabase project?
Row-Level Security policies are included in the schema dump if you used supabase db dump with the default options. Confirm they exist after import by running SELECT * FROM pg_policies in the new project's SQL editor. Missing policies will allow all authenticated users to read each other's data — confirm this before going live.
- In the new Supabase project SQL editor: SELECT tablename, policyname, cmd, qual FROM pg_policies;
- Compare the output to the original project's policies.
- For any missing policy, write and run the CREATE POLICY statement manually.
- Test a row-level read using the new project's anon key before pointing any live traffic there.
How do I redeploy Supabase edge functions to the new project?
Edge functions live in your codebase under supabase/functions/. Redeploying them to the new Supabase project is a single CLI command — but you must also copy any secrets the functions use (such as Stripe webhook keys) from the old project's function secrets to the new one, or the functions will fail silently on first call.
- In your local repo: supabase link --project-ref <new-project-ref>.
- Deploy all functions: supabase functions deploy.
- In the old Supabase dashboard, note all secrets under Edge Functions → Manage secrets.
- In the new Supabase dashboard, add the same secrets under Edge Functions → Manage secrets.
- Invoke each function from the new project URL and confirm it returns the expected response.
What happens to auth users and password hashes?
Supabase does not export auth.users password hashes through any public API — the hashes are managed by the GoTrue server and intentionally withheld from exports. This means users cannot log in with their existing passwords after you move them to a new Supabase project. The only safe approach is to trigger a password-reset email for every user before the cutover date.
How do I migrate Supabase Storage buckets?
Supabase Storage file uploads are not included in the db dump and must be migrated separately. The safest approach is to download all files from the old bucket using the Supabase client or the dashboard, then upload them to the new project's bucket before DNS cutover. For large buckets, use a script to automate the transfer.
- In the old Supabase project, go to Storage and list all buckets and their contents.
- Use the Supabase client or supabase storage CLI to download files: supabase storage cp --experimental -r ss:///old-bucket/ ./local-backup/
- In the new Supabase project, create matching buckets with the same names and access policies.
- Upload files: supabase storage cp --experimental -r ./local-backup/ ss:///new-bucket/ (linking to the new project first).
- Verify file counts match between old and new buckets before cutover.
How do I roll back if the Supabase migration breaks?
Keep the old Supabase project running and your app pointing to it until the new project passes a full smoke test. The rollback plan is to revert your environment variables to the old project's URL and anon key — a change you can make in minutes in Vercel, Cloudflare, or Netlify without touching DNS.
- Keep both Supabase projects active until migration is confirmed stable.
- Store the old VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY somewhere accessible during cutover.
- If something breaks after switching env vars, restore the old values in your host's dashboard and trigger a redeploy.
- A redeploy with the old env vars typically takes 60–90 seconds on Vercel and Netlify — far faster than a DNS rollback.
- Do not delete the old Supabase project until the new one has been stable for at least two weeks.
Post-migration smoke test for Supabase
After switching your app to the new Supabase project, verify every data path and auth flow before considering the migration complete. A passing connection is not the same as correct data — RLS policies, storage bucket policies, and edge function secrets can all silently fail without returning an obvious error.
- Sign in with an existing user account — confirm session starts and persists.
- Read data from each critical table — confirm row counts and content match the old project.
- Write a row to a critical table — confirm the write succeeds and RLS allows it for the correct user.
- Try reading another user's data with the authenticated session — confirm RLS blocks it.
- Invoke each edge function and confirm it returns the expected response (not a 500 from a missing secret).
- If your app uses Storage, load a file from the new bucket and confirm it renders correctly.
- Confirm auth providers (email, OAuth) work by completing a full sign-up and sign-in flow.
Frequently asked questions
Will I lose data during the Supabase migration?
Can I migrate user profiles without migrating auth accounts?
How do I find my Lovable Supabase project reference?
Do I need to move Supabase storage buckets separately?
Do RLS policies migrate automatically with the schema dump?
How do I copy Supabase edge function secrets to the new project?
What auth providers do I need to re-configure in the new project?
Can I migrate to a self-hosted Supabase instead of Supabase Cloud?
How long does a Supabase migration take?
What is the safest order to run the schema and data imports into the new Supabase project?
Talk to a senior engineer — not a salesperson.
Book a free 30-minute audit call. We'll diagnose what's wrong and tell you exactly what it costs to fix.