You built something real in Lovable or Bolt, and now you want the code somewhere you control: as a backup, for a developer, or to host it yourself.
Both tools can sync your project with a GitHub repository in both directions. This guide covers each one, then running the code locally, environment variables, and what to check after you deploy.
Why get your code into your own repository
A repository in your own GitHub account gives you three things:
- A backup outside the builder, with the full history of every change.
- Something you can hand over. A developer can clone it and review pull requests without your Lovable or Bolt login.
- A choice of where it runs. Vercel and Netlify deploy straight from a GitHub repository.
Planning a cleanup? Get the code into your own repo first, then see vibe coding cleanup for the next step.
Lovable: connect GitHub
Lovable calls this Git sync. On github.com it’s available on all plans (Lovable GitHub docs).
Connect your account, then the project
There are two steps: a workspace connection, then a link for each project.
- Open Project settings → Git → GitHub (or Workspace settings → Git → GitHub) and click Add connection. You need to be a workspace owner or admin.
- In the GitHub popup, choose your account or organization, pick All repositories or Only select repositories, and click Install & Authorize.
- Back in the project’s GitHub settings, click Connect next to that connection.
Lovable then creates a new repository and starts two-way sync. The repository is private by default.
What the sync does, and what it doesn’t
From Lovable’s docs:
- Changes you make in Lovable are committed and pushed to GitHub.
- Commits pushed to the active branch (usually
main) sync back into Lovable. Commits on other branches don’t appear until you merge them or switch the synced branch. - Pushing to GitHub doesn’t publish your live site. That only changes when you publish from Lovable (Git sync overview).
- Git sync can’t attach to a repository that already exists. It always creates a new one.
Renaming the repository, your account or your organization keeps the sync running. Deleting the repository stops it. If you disconnect and reconnect later, Lovable creates a brand-new repository instead of re-linking the old one.
Just want a copy? Download codebase (paid plans)
For a one-time snapshot without GitHub, open the Code editor and click Download codebase at the bottom of the file tree, or use the Download codebase section in Project settings → Git. Lovable’s docs list this on paid plans; Git sync is available on all plans.
Bolt: connect GitHub, or download a ZIP
Bolt has its own built-in GitHub integration, with two-way sync, so you don’t need to download the project and push it by hand (Bolt GitHub docs).
Connect GitHub and create a repository
- Open your project and click the GitHub icon in the top-right corner.
- Click Log in to GitHub, then Authorize when GitHub asks you to let StackBlitz (Bolt’s parent company) access your account.
- Click Install the GitHub App, choose All repositories or Only select repositories, and click Install & Authorize.
- Click the GitHub icon again. On the Create a repository page, enter a name and click Create repository, then Start building.
The new repository starts as private, on a main branch.
How Bolt’s sync behaves
- Bolt commits automatically every time you make a change that doesn’t break the project.
- It checks GitHub every 30 seconds and pulls in changes made outside Bolt.
- If Bolt and GitHub update at almost the same moment, Bolt’s docs say it keeps its own changes and overwrites the GitHub version. Avoid pushing to the same branch while you’re also prompting in Bolt.
- You can create and switch branches from the GitHub icon, but merging happens on GitHub, not inside Bolt.
- The GitHub icon panel shows Syncing to GitHub or Synced to GitHub, plus the linked repository and branch.
Unlike Lovable, Bolt can also import an existing repository: on the Bolt homepage, click GitHub below the chatbox and pick a repository or paste its URL.
Be careful with Disconnect project. Bolt’s docs say it permanently removes the link, and you can’t reconnect the same repository yourself (you’d need Bolt support).
Download a ZIP instead
For a one-off copy, open the project, click the project title in the top left, and choose Download (Bolt: manage your projects). Unzip it, and you have the full project folder.
If you want that folder on GitHub without using Bolt’s integration, GitHub documents the steps (adding locally hosted code to GitHub). Create an empty repository on GitHub first (no README, license or .gitignore), then run:
cd your-project-folder
git init -b main
git add .
git commit -m "First commit"
git remote add origin https://github.com/YOUR-NAME/YOUR-REPO.git
git push -u origin main
Before git add ., check there’s no file holding real secrets. GitHub’s docs warn never to commit passwords or API keys.
Run it on your own computer
You need Node.js installed. Lovable’s hosting docs use Node.js 22 in their examples (Lovable: deploying outside Lovable).
Clone the repository (Lovable shows HTTPS, SSH and GitHub CLI clone URLs in the project’s GitHub settings; on GitHub, use the green Code button):
git clone https://github.com/YOUR-NAME/YOUR-REPO.git
cd YOUR-REPO
npm install
npm run dev
Bolt’s docs give the same pair of commands for a downloaded project: npm install && npm run dev.
Open the address the terminal prints. For Vite projects the default port is 5173, but Vite moves to the next free port if it’s taken (Vite server options).
Check package.json and the README for anything else the project expects. Lovable’s docs also note that if the repository only has bun.lock and no package-lock.json, you should use Bun, or run npm install and commit the package-lock.json it creates.
Lovable has two kinds of project
Projects created from May 13, 2026 use TanStack Start, which runs server code; older ones are React + Vite and build to static files. A TanStack Start project lists @tanstack/react-start in package.json. This matters when you deploy, and Lovable notes that in the newer stack its connector and AI calls fail locally, so test those in the Lovable preview.
Environment variables: what goes where
On Lovable’s built-in backend, the repository’s .env file holds the backend URL and publishable key, for example VITE_SUPABASE_URL and VITE_SUPABASE_PUBLISHABLE_KEY (Git sync overview).
Two warnings from Lovable’s docs:
- Your local app uses your real backend. With that
.env, records you create or delete locally change live data. Use test accounts. VITE_variables end up in the browser. Never put a Supabase service role key, a Stripe secret key or any other secret in aVITE_variable. Secrets belong in server-side code (Edge Functions or server functions), set on whatever runs that code. Secrets you stored in Lovable aren’t in the repository.
For Bolt projects, look for import.meta.env or process.env in the code to see which variables the app reads, and set those locally. The same rule applies: anything the browser can read is public.
Unsure whether a frontend key is secret? See the vibe-coded app security checklist.
Deploy to Vercel or Netlify
Bolt’s docs note that once your code is in GitHub you can publish with Bolt hosting, its Netlify integration, or another service. Lovable’s hosting guide gives the settings.
For an older Lovable React + Vite app on a Git-based host:
- Build command:
npm run build - Output directory:
dist - Node version: 22
- Environment variables: the values from
.env, such asVITE_SUPABASE_URLandVITE_SUPABASE_PUBLISHABLE_KEY - If opening a deep link directly returns a 404, add a rewrite so every route serves
/index.html
For a Lovable TanStack Start app, the host must run server code. Lovable’s docs say Vercel, Netlify and Cloudflare Pages are detected automatically. Use npm run build and Node.js 22, set the output directory to dist on Netlify and Cloudflare Pages (Vercel needs none), and set both the VITE_SUPABASE_* variables and the server-side SUPABASE_URL and SUPABASE_PUBLISHABLE_KEY, plus any secrets your server functions read.
VITE_ values are baked in at build time, so if you change one, redeploy.
The post-deploy checklist
After the first deploy, check:
- Sign-in redirects. Add the new URL to your auth provider’s allowed redirect URLs. On Supabase, that’s the Site URL and the Redirect URLs list. If login emails send people to localhost, see Supabase auth redirecting to localhost.
- OAuth providers. If you use Google or GitHub sign-in with your own credentials, check the provider’s settings too.
- Webhooks. If a payment provider or other service calls your app, make sure its webhook endpoint points at the backend your new deployment uses.
- Deep links and refresh. Open a nested page directly and reload it.
- Real reads and writes. Sign up a test user, create a record, upload a file.
Lovable’s docs suggest deploying to a temporary URL first and checking it against the Lovable version before you move your domain.
Keep building in the tool, or move off
With sync connected, you can keep prompting in Lovable or Bolt while a developer works in the repository. For Bolt, the sync notes above apply.
For Lovable, its docs recommend keeping Lovable on the synced branch (usually main) and doing your own work on a feature branch, then merging. Don’t force-push, rebase or squash commits already on the synced branch. If you do, Lovable saves a backup of its copy and replaces it with yours. To undo something, add a commit that reverts it. Lovable also doesn’t deploy changed Edge Functions or run new migration files when your commits sync. Ask Lovable in the chat to do that.
Moving off completely means you take over hosting, environment variables, the database, backups and security. Your database records and stored files aren’t in the repository.
Common problems after export
- Blank page locally or after deploy. Often a missing environment variable. Open the browser console. Check
.envlocally and the host’s environment settings in production, then rebuild. - 404 when you refresh a page. The host is missing the
index.htmlfallback (older React + Vite apps), or isn’t running the server part (TanStack Start apps). - Build fails on the host. Compare the Node version and install command with what works locally. A lockfile mismatch can cause this.
- Lovable doesn’t show your GitHub commits. Check you pushed to the branch Lovable is synced to. If the sync card says GitHub is ahead, Lovable’s docs suggest pushing a new commit, even an empty one (
git commit --allow-empty -m "Trigger Lovable sync"thengit push). - Lovable pushed to a
lovable-syncbranch. GitHub rejected the push (branch protection, or a conflicting change). Review that branch and merge it. - Bolt says Synced but a change is missing on GitHub. Bolt’s docs suggest reauthorizing the GitHub app.
For other symptoms, see Lovable app not working or Bolt “application error”.
If it’s still broken, a vetted senior engineer can review and fix it, working from your repo through a collaborator invite rather than your password. Fixed price, agreed upfront. See /fix/lovable, /fix/bolt or /fix/supabase, or read how to hire a developer to fix AI-generated code.
FAQ
Can I run a Lovable app locally?
Yes: connect Git sync, clone the repo, and run npm install and npm run dev, using test data.
Can I self-host a Lovable app?
Yes. Lovable documents Git-based hosts, containers and your own servers.
Can I import an existing repo back into Lovable?
Not through Git sync, which always creates a new repository. Lovable’s docs describe another route: download the repository as a ZIP from GitHub and import it with Upload code. That copies the code into a new project, and you can connect Git sync to it afterwards. (Bolt, by contrast, can import an existing GitHub repository directly.)
Will editing on GitHub break my Lovable project?
Not with normal commits to the synced branch; avoid rewriting its history or deleting the repo.
Do I need a paid plan to download the code?
For Lovable’s Download codebase button, yes: Lovable’s docs list it on paid plans. Git sync to github.com is available on all plans, and once your code is on GitHub you can download it from there. For Bolt, the help pages linked above describe Download and the GitHub integration without mentioning a plan requirement.
Comments