How to Export a Lovable Project to GitHub (and What Doesn't Come With It)
Lovable exports your app's code by syncing it to a GitHub repository. How to connect GitHub, how two-way sync works, how to run the code locally, and the parts that live outside the repo — database data, secrets, auth settings, storage — that you need to plan for if you want to leave or self-host.
Your app lives in Lovable, and you want the code somewhere you control — for backups, for a developer, for Claude Code, or to host it yourself. The way to do that is Lovable's GitHub integration, which syncs your project's code into a GitHub repository you own.
Lovable changes often; check Lovable's docs for the current menu names.
Step by step
- Create a GitHub account if you don't have one. (Git and GitHub for Beginners)
- In your Lovable project, open the GitHub option (in the project's top bar or settings) and choose Connect.
- Authorize the Lovable GitHub app, and choose your personal account or an organisation.
- Lovable creates a repository and pushes your code.
From then on it's a two-way sync on the default branch: changes you make in Lovable are pushed to GitHub, and commits pushed to GitHub show up in Lovable.
Run it on your own computer
git clone https://github.com/you/your-app.git
cd your-app
npm install
npm run dev
Lovable apps are typically React + Vite with TypeScript and Tailwind, so they run like any other Vite project. (What Is Vite?, npm run dev vs build)
What the repository doesn't contain
This is the part people miss. The code is portable; the things around it may not be in the repo:
| Thing | Where it lives |
|---|---|
| Database data (users, orders) | Lovable Cloud or your Supabase project — not GitHub |
| Database structure | Migration files in the repo, if your setup records them |
| Secrets and API keys | Lovable's secrets settings — not exported (good!) |
| Auth settings (providers, redirect URLs, email templates) | The backend's settings |
| Uploaded files | Storage buckets |
| Edge/serverless functions config | Partly in the repo, partly in backend settings |
So "export to GitHub" gives you the app, not the running business. If you plan to move hosting, you also need to export the database, recreate secrets, and update auth redirect URLs to your new domain. (Deploy a Lovable App to Production)
Keep the sync healthy
- Don't rewrite history on the synced branch (no force-pushes) — it can confuse the sync.
- Work on branches for bigger changes made outside Lovable, then merge.
- Add a
.gitignorefor.envfiles if you create any locally. (.gitignore Explained) - Watch for two Lovable projects using the same Supabase project — they can overwrite each other's secrets.
Why do it even if you're staying
- It's your backup and your undo button — every change is in git history. (Undo Almost Anything in Git)
- A developer or Claude Code can work on the code with normal tools.
- You can add CI, tests and code review. (Set Up CI With GitHub Actions)
The summary
- Connect GitHub in your Lovable project; it creates a repo and syncs both ways.
- The repo has your code, not your data, secrets or backend settings.
- Do it early, even if you never leave Lovable.
EasySpawn can take a Lovable app from its GitHub repo and run it on your own server with Postgres, HTTPS and backups — with Claude Code to keep building where Lovable left off. See how it works for AI-built apps or join the waitlist.
Related: What Is Lovable? · Hand Off an AI-Built App to a Client · Fork vs Clone · Supabase Row-Level Security Explained
Keep reading
How to Deploy a Lovable App to Production
Lovable's Publish button gets your app online in one click. Whether that's production-ready depends on your database security, your domain, and what happens when you outgrow the builder. The three deployment paths, and the checks to run before real users arrive.
What Is Vercel? What It Does, What It Costs You, and When to Use Something Else
Vercel is a hosting platform built around frontend frameworks, especially Next.js: push to GitHub and your site is live. What it actually does, what serverless functions mean for your app, where the limits are, and when a regular server is a better fit.