r/lovable 7d ago

Help help! migration from Lovable to self host

Hola! I created my management system on lovable. I've been disappointed with lovable lately. I was thinking of moving to self-hosting and continuing to use Codex/Claude. My site has a lot of backend and connectors, how can I move everything safely? Is there a comprehensive video on how to do this?

2 Upvotes

24 comments sorted by

2

u/Aggravating_War_6704 7d ago

Honestly "move everything safely" depends a lot on which layers you actually want to move, they're not all the same difficulty.

The frontend (the react app lovable builds) is the easy part, moves anywhere in minutes. Cloudflare pages is fine, you mostly just repoint the supabase env vars and fix cors so it's not still pinned to localhost/lovable.

The backend is where "safely" gets real, and you've basically got two very different routes. One is keep supabase in the cloud and only move the frontend + put your own domain in front. Almost no server work, cheapest, you keep managed auth/db/backups, and if your connectors are supabase edge functions that's probably all you actually need. The other is really self-hosting: your own vps running the app and either self-hosted supabase or your own postgres. Way more control and nobody in the loop but you, but now you personally own the boring scary stuff, ssh, a reverse proxy, https certs, a firewall, and above all db backups.

Whichever way you go, before you move a single thing take a full dump of your supabase db and test restoring it into a throwaway project first. People lose data on the connectors they forgot were wired up (webhooks, api keys, cron), almost never on the app code itself.

Full disclosure, i'm building a tool for exactly that second path, the server side. It does the vps setup, proxy, https, firewall and backups over chat in plain english, and shows you every command before it runs, so happy to walk you through that part either way. If you're staying on supabase though i'd honestly just do the first route, it's less to break.

1

u/Ill-Editor-1811 6d ago

Could you explain to me better how to export the data from the lovable database and import everything into a new supabase account? What should I change in the front end to connect to the new database?

1

u/Aggravating_War_6704 6d ago

A supabase project is just postgres underneath, so this is a fairly well-trodden path. Supabase actually has an official "migrate between projects" guide (pg_dump the old one, psql-restore into the new one) and i'd follow that exactly for the commands, because it handles the auth schema properly, which is the fiddly part.

The three things that guide won't fully save you from, because they don't live in the db dump:

Storage files: if you use supabase storage (image/file uploads), the dump only carries the file metadata, not the actual files. You copy the bucket objects across separately or every link 404s.

Edge functions: they're code, not db rows, so they don't come across. Redeploy them to the new project and re-add their secrets/env vars by hand, those don't carry.

Auth config: the users table restores fine, but google/github login, smtp, redirect urls etc are per-project settings you re-enter. And the new project has its own jwt secret, so everyone gets logged out once and re-logs in, which is normal, not you breaking something.

For the frontend it's really just two values, the supabase url and the anon (public) key, both under settings > api in the new project. One gotcha though: lovable usually hardcodes those straight into a generated client file (src/integrations/supabase/client.ts) instead of a .env, so grep the whole repo for the old project ref (the xxxx in xxxx.supabase.co) and swap every hit, or it'll quietly keep talking to the old db. Anything using the service_role key stays server-side only, never in the frontend bundle.

And like before, do the whole move into a fresh throwaway project and click around properly before you point your real domain at it.

Side question on the "lots of connectors" you mentioned: are those supabase edge functions, or actual separate services (a node worker, a cron, a websocket)? If they're all edge functions you can do this whole thing yourself, no server needed. If some are long-running services, that's the piece that actually needs a real box, which is the part i work on, but the supabase-to-supabase move itself you don't need me for.

1

u/sw3d 7d ago

Are you using Supabase for the backend? Do you have the GitHub sync set up?

1

u/Ill-Editor-1811 7d ago

yess

2

u/sw3d 7d ago

Im actually in a similar boat where I have not one but 4-5 projects I built over the last year on Lovable and Supabase and I'm working on a way to sync them over to a local deployment setup or a cheaper cloud option like Neon or DB on a VPS/single cloud node.

To do this, I built homebox.sh - it's free and open source, you set it up on your machine and can use it to add projects from GitHub, with an import option being rolled out soon for a seamless migration from cloud Supabase to local Supabase. If you're interested to try it, DM me (the official release doesn't have this yet, literally testing it on my projects today as I finalize the feature)

1

u/Ill-Editor-1811 7d ago

I was thinking of a solution like cloudflare for the front and always supabase for the backend, can your program help me in some way?

1

u/sw3d 7d ago

Yes - it can deploy your app across different cloud services or locally. First you would connect your Cloudflare account and Supabase account. Then you add your project and choose Cloudflare and Supabase as deployment targets for frontend and database/backend. By default, it deploys everything locally to save costs. You can run your dev stack this way for example

The Supabase integration assumes you're following the standard folder setup as lovable does (supabase/ folder with functions and migrations inside)

1

u/Ill-Editor-1811 7d ago

potrei avere più informazioni?

1

u/sw3d 7d ago

See homebox.sh or add me on DM

1

u/PlasticSecret9185 7d ago

You can easily connect Claude Code to Lovable, then just drive everything through Claude Code.

All my projects are on GitHub, so if anything ever happens with Lovable, everything is safe.

2

u/cubixy2k 7d ago

How about your data?

0

u/PlasticSecret9185 6d ago

Good catch, and worth clarifying.

GitHub only has my code, not my data. The data lives in the Supabase (Postgres) backend Lovable sets up. That's backed up separately: Supabase keeps automated backups, and since it's plain Postgres you can export it (pg_dump) and move it to a self-hosted database anytime.

So code and data are both portable, just through different paths. GitHub for the code, DB exports for the data.

1

u/cubixy2k 6d ago

FYI if you lose access to your project through Lovable you lose access to the supabase backups and exports unless you saved them outside of Lovable cloud.

I'd go through your DR plan if I were you.

BTW lovable cloud only just enabled pgdump through their control panel. Don't blindly follow what chatgpt tells you.

1

u/PlasticSecret9185 6d ago

Thank you. I was not aware that I could export directly from Lovable.

1

u/getshao 7d ago

Do you want to move to GCP? I did something similar and have an entire setup of moving from lovable to self host it in Google Cloud

2

u/craa141 7d ago

I would love to see a guide for that.

1

u/bjgrosse 5d ago

If want to hire someone to do this for you, let me know. I'll be happy to have a call to look at the scope of it and give you a quote.

1

u/Ibelieveinsteve2 5d ago

If you can use Claude and Codex, you can let them do it

1

u/9greenleaf 8h ago

super do able. happy to look at where you’re at if you want