How to Export Your Lovable Code to GitHub (and What It Does Not Include)
Exporting your Lovable code to GitHub takes one click: open Settings, connect your GitHub account, and Lovable creates a repo and pushes your full frontend and backend source. But the export only contains code. Your Supabase database, auth users, storage files, and secrets stay in Lovable-managed infrastructure — the repo alone will not run. Here is exactly how to export, and what you still own outside it.
By Founder Name · Last verified: 2026-06-25
How do I export my Lovable code to GitHub?
Open your project, click the GitHub button in the top-right of the editor (or Settings then GitHub), and authorize the Lovable GitHub app. Choose an account or organization, name the repository, and Lovable creates it and pushes your code. From that point on, every prompt you run commits to the connected repo automatically — the sync is two-way and continuous, not a one-time download.
- In the Lovable editor, click the GitHub icon in the top-right toolbar.
- Click Connect to GitHub and authorize the Lovable GitHub app for your account or organization.
- Choose the target account or org, then name the new repository.
- Click Create Repository — Lovable initializes it and pushes the current codebase.
- Open the repo on GitHub and confirm the latest commit matches your editor state.
- Optional: run git clone on the repo URL to pull the full source to your machine.
Related: import an existing GitHub repo into Lovable · fix a broken Lovable to GitHub sync
What exactly does the export include?
The export is your application source code: the React and TypeScript frontend, components, routing, styles, your Supabase edge function code, SQL migration files, and config like package.json and vite.config. It is a complete, buildable repository of everything Lovable generated. What it does not include is the running data and infrastructure behind that code — and that gap is where most self-migrations stall.
Think of it as the recipe, not the cooked meal. You get every line of code needed to rebuild the app, but not the live Supabase project the code points at. The frontend will compile, but on first run it will try to reach a backend it does not have credentials for.
| Asset | In the GitHub export? | Where it actually lives |
|---|---|---|
| Frontend code (React/TS, components, routes) | Yes — full source | Repo |
| Edge function source code | Yes — function .ts files | Repo (supabase/functions) |
| Database schema / SQL migrations | Usually — migration files only | Repo (supabase/migrations) |
| Live database rows (your users' data) | No | Supabase Postgres — not in repo |
| Auth users and password hashes | No | Supabase Auth (auth.users) — not in repo |
| Storage files (uploads, images) | No | Supabase Storage buckets — not in repo |
| Secrets and API keys (.env values) | No | Lovable/Supabase secret store — not in repo |
| Supabase project URL + anon key wiring | Partially — referenced, not provisioned | Managed Supabase instance |
Why won't my exported repo run after I clone it?
Because the code is only half the app. The repo references a Supabase URL, anon key, and edge-function secrets that are not committed — by design, since secrets do not belong in git. Clone it, run npm install and npm run dev, and the build succeeds, but the app cannot connect to a database. This is the most common surprise for builders exporting for the first time.
We call this the What-Breaks-on-Export gap: a buildable frontend pointed at a backend that does not exist in the repo. The code compiles cleanly and then fails at runtime the moment it tries to authenticate or query data, because the environment it expects was never part of the export.
A second trap is The Vanishing Env-Var — environment variables that exist inside the Lovable runtime but are absent from your local .env and from any new host you deploy to. The build passes, the deploy succeeds, and the app throws supabaseUrl is required or a 401 from every API call because the values silently never made it across.
Related: the full breakdown of what breaks when you export Lovable · how to run your Lovable app locally
What happens to my Supabase database and users on export?
Nothing — they stay exactly where they are, in the Supabase project Lovable provisioned for you. Exporting code does not copy a single row, user, or uploaded file. Your live data and auth users remain in the managed Supabase instance. To truly own your app, you migrate the database and auth separately: dump the schema and data, then move to a Supabase project you control.
This separation is the whole reason export-only is not migration. You can have your code in your own GitHub org and still be fully dependent on Lovable-managed infrastructure for the database, authentication, storage, and secrets that make the app actually function.
Moving the backend means provisioning your own Supabase project, applying the migration files from the repo, running a pg_dump and pg_restore of your real data, and re-creating auth users (password hashes can be migrated, but it requires care so existing logins keep working). This is the step where a botched export turns into lost users.
- Create a new Supabase project in an account you own.
- Apply the SQL migration files from the repo to recreate the schema.
- Run pg_dump on the Lovable-managed database and pg_restore into your own.
- Migrate auth.users including password hashes so existing logins keep working.
- Copy storage bucket contents and re-create bucket policies.
- Update the frontend env vars to point at your new Supabase URL and keys.
Will exporting expose my API keys and secrets?
Not if the export behaves correctly — secrets are deliberately kept out of git, and your repo should contain a .env.example, never real values. The risk runs the other way: builders who hardcoded keys into client-side code during prompting. Anything in a VITE_-prefixed variable or pasted into a component ships to the browser and lands in your public-readable repo on every commit.
Before you make a repo public, grep the committed code for live keys: search for sk_, service_role, secret, and any provider key prefixes. A leaked Stripe secret key or Supabase service_role key in client code is a misconfiguration that grants full backend access to anyone who reads the bundle — rotate any exposed key immediately and move it server-side.
The correct pattern is that public-safe values (the Supabase anon key, the project URL) can live in client env vars because Row Level Security protects the data, while privileged keys (service_role, Stripe secret, any third-party server key) live only in edge-function secrets that never reach the browser or the repo.
Is exporting to GitHub the same as migrating off Lovable?
No. Exporting gets your code into a repo you own; migrating means the app runs entirely on infrastructure you control, with no dependency on Lovable to function. Export is step one of maybe five. Many builders connect GitHub, see their code, assume they are free — then discover the app dies the moment Lovable-managed Supabase, secrets, or hosting are out of the picture.
Full migration off Lovable means: code in your GitHub, database and auth in your own Supabase, secrets in your own secret manager, the app deployed to your own host (Vercel, Netlify, Cloudflare), and a working CI build that does not touch Lovable at all. Export checks one box. The other four are the migration.
| Layer | Just exported? | Fully migrated? |
|---|---|---|
| Source code in your GitHub | Yes | Yes |
| Database in a Supabase you own | No | Yes |
| Auth users under your control | No | Yes |
| Secrets in your own secret store | No | Yes |
| Deployed on your own host | No | Yes |
| Builds with zero Lovable dependency | No | Yes |
Should I export and migrate myself, or get help?
If you are comfortable with git, pg_dump, Supabase auth migration, and re-wiring env vars on a new host, a clean export-and-migrate is a weekend project. If your app has live users you cannot afford to log out, real payment data, or storage you cannot lose, the safe move is to have an engineer do the cutover with a backup and a rollback plan so nothing drops.
The expensive failures we see are not the export itself — it is the data step: auth users migrated without working password hashes, RLS policies that did not come across, a storage bucket left behind, or a half-migrated app that points at two backends at once. We migrate the full stack, verify every row and user landed, and leave you with a repo and infrastructure you fully own — with a documented rollback path the whole way.
Related: our Lovable migration service · book a free migration audit call
Frequently asked questions
How do I export my Lovable project to GitHub?
Does exporting to GitHub include my Supabase database?
Why doesn't my exported Lovable app run when I clone it?
Is there a way to download my Lovable code without GitHub?
Will my API keys or secrets be exposed in the exported repo?
Does exporting to GitHub disconnect me from Lovable?
Can I edit my code in GitHub and push changes back to Lovable?
What's the difference between exporting and migrating off Lovable?
How do I move my Lovable database and users to my own Supabase?
Should I do the export and migration myself or hire someone?
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.