/lovable-issues

Exporting Lovable Projects for Manual Deployment

Learn why exporting Lovable projects for manual hosting needs adjustments, plus export steps and best practices for seamless success.

Book a free  consultation
4.9
Clutch rating 🌟
600+
Happy partners
17+
Countries served
190+
Team members
Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

Why Exporting for Manual Hosting Requires Adjustments in Lovable

The exported app needs adjustments because Lovable provides an integrated runtime, secrets UI, and preview environment that are not identical to a manual host. Things that “just work” inside Lovable (injected secrets, serverless endpoints, routing, built-in preview features) often depend on Lovable’s platform behavior or hidden injection steps — so when you move the project to a generic host you must explicitly replace those platform conveniences with standard config, runtime endpoints, and build/runtime settings.

 

Key reasons exports need changes

 

  • Environment and secrets are injected in Lovable — Lovable’s Secrets UI and preview inject values at runtime. Manually hosting requires adding those env vars to your host or build system (or wiring a secrets manager).
  • Serverless vs full server differences — Lovable often uses serverless-style API files or platform functions. A manual host may need a different entry point, server framework, or separate function deployment.
  • Build/runtime config assumptions — Preview mode may set publicBase, rewrites, or headers. Exports must make those explicit (publicPath, base URL, router mode) so assets and SPA routing work.
  • Platform-only integrations — Integrations (e.g., Supabase keys, webhooks) may rely on Lovable-provided endpoints or callbacks; you must update URLs, CORS, and webhook targets when hosting elsewhere.
  • No terminal in Lovable — some adjustments require terminal work — If you need platform-specific adapters, native binaries, or custom deployments, those steps are outside Lovable and require GitHub export + terminal/CI.
  • Files & runtime expectations — Lovable Preview may tolerate dev-only imports or dynamic code paths. Exports should clean dev-only code, ensure package.json scripts match the target host, and include lockfiles.

 

Paste-into-Lovable prompts

 

  • Audit project for manual-hosting gaps
    // Please scan the repository root and produce a checklist of concrete export blockers.
    // Check these files/locations and explain why each might fail on a manual host:
    // - package.json scripts
    // - next.config.js or vite.config.js (if present)
    // - src/server/, api/, functions/, or pages/api/ (server-side handlers)
    // - any files that reference process.env or “Secrets” UI (list exact keys)
    // - public/, static asset paths and base routing assumptions
    // Mark each item as: “works as-is”, “needs config change in Lovable”, or “outside Lovable (terminal required)”. 
    // Output patch suggestions with exact file paths where Lovable can edit.
        
  • Flag terminal-required steps
    // From the audit above, produce a separate list of actions that cannot be executed inside Lovable
    // and must be done after exporting to GitHub / terminal. For each, describe the exact CLI commands,
    // where to run them (CI or local), and why they are required.
    // Label all such items explicitly: "outside Lovable (terminal required)".
        

 

Still stuck?
Copy this prompt into ChatGPT and get a clear, personalized explanation.

This prompt helps an AI assistant understand your setup and guide you through the fix step by step, without assuming technical knowledge.

AI AI Prompt

How to Export a Lovable Project for Manual Hosting

Create a production-ready export bundle inside the repo (Dockerfile, .dockerignore, package.json production scripts, .env.example, EXPORT.md), commit those changes, then use Lovable’s GitHub sync to push the branch. For final manual hosting (Docker / VPS / other), follow the EXPORT.md steps outside Lovable (terminal required).

 

What to ask Lovable to do (paste these prompts into Lovable Chat)

 

  • Prompt A — Detect project type and add export artifacts
// Prompt A: Detect framework and add production export files
// Please inspect the repository to detect the web framework (Next.js, Remix, Vite/React, Svelte, Astro, plain static, or Express/Koa backend).
// Then add these files and edits tailored to the detected framework. Make sensible defaults for others.
// Create or update these paths exactly:

// 1) /Dockerfile  (multi-stage, production build for detected framework)
// 2) /.dockerignore
// 3) /Procfile (simple "web: node server.js" only if a server is present)
// 4) /package.json — add or update scripts: "build", "start:prod"
// 5) /.env.example — list all environment variables referenced in code (leave placeholder values)
// 6) /EXPORT.md — step-by-step manual hosting checklist aimed at a user who will clone and run Docker or use a VPS
// Use comments in files to explain what to run outside Lovable (e.g., docker build/run commands).

// If you detect Next.js, produce a Next.js Dockerfile. If static site (build -> dist or out), produce a simple nginx Dockerfile.
// If a Node server exists (server.js, src/server, api/index.js), produce a Node Dockerfile that runs "npm run build && npm run start:prod".

// Example Dockerfile content for a generic Node app (only add the relevant one based on detection):
/*
 // Dockerfile
 FROM node:18-alpine AS builder
 WORKDIR /app
 COPY package*.json ./
 RUN npm ci
 COPY . .
 RUN npm run build

 FROM node:18-alpine AS runner
 WORKDIR /app
 COPY --from=builder /app/package*.json ./
 COPY --from=builder /app/node_modules ./node_modules
 COPY --from=builder /app/dist ./dist
 ENV NODE_ENV=production
 CMD ["node", "dist/server.js"] // // Adjust if your framework uses a different entry
*/

// After creating files, commit changes on a new branch named "export/manual-hosting"

 

  • Prompt B — Populate .env.example and create Secrets checklist
// Prompt B: Scan the repo for process.env or import.meta.env usage and create /.env.example listing each variable.
// For each variable, add a one-line comment explaining where it's used (file path).
// Also create /EXPORT_SECRETS.md with instructions:
// // Use Lovable Secrets UI to add these keys before publishing, but for manual hosting, they should be set in the environment on the host.
// // For each variable include the exact key name and a short note like "required for DB connection".
// Save both files and commit to the same branch "export/manual-hosting".

 

  • Prompt C — Prepare GitHub export and final checklist
// Prompt C: Create a git commit on branch "export/manual-hosting" with the new/updated files.
// Then prepare an EXPORT.md (if not already) that contains exact external steps the operator must run outside Lovable:
// // Example external steps (label them "outside Lovable (terminal required)"):
// // - git clone <repo-url>
// // - docker build -t my-app:latest .
// // - docker run -e KEY=val -p 80:3000 my-app:latest
// // Also include alternative instructions for "deploy to a VPS" and "build locally (npm run build && npm run start:prod)".
// Then use Lovable's GitHub sync/export action to push branch "export/manual-hosting" to the connected GitHub repo and give me the GitHub URL.

 

Small notes about what happens next

 

  • Lovable will create and commit files into the project on a new branch. Use Preview to inspect changes before publishing.
  • Final hosting steps are outside Lovable: once the branch is on GitHub, cloning, docker build/run, or provider-specific deploys require a terminal—those steps are listed in EXPORT.md and marked "outside Lovable (terminal required)".

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Best Practices for Exporting and Hosting Lovable Projects

Best practice summary: prepare a portable build, clearly map Lovable Secrets to environment variables, include host-specific config files (optional) in the repo, avoid Lovable-only runtime assumptions, test with Preview, document required runtime steps in an EXPORT.md, and use GitHub export/sync when any step requires a terminal or provider CLI.

 

Prepare build and runtime files

 

  • Add standard build/start scripts and a .env.example so hosts know how to run your app.
  • Create an EXPORT.md that lists required env names, secrets, and host notes.

 

Paste into Lovable chat to implement (edits + file creation):

// Update package.json at root: add portable scripts
// If your project is Next/Vite/CRA adjust commands accordingly.
update package.json with this patch:
{
  "scripts": {
    "build": "vite build", // // replace if using next: next build
    "start": "vite preview --port $PORT" // // replace for next: next start -p $PORT
  }
}
// Create .env.example at project root
// List canonical env var names that hosts expect.
create file .env.example with content:
# Replace with your provider's values
DATABASE_URL=
SUPABASE_KEY=
ANOTHER_API_KEY=
// Create EXPORT.md at project root to document deployment requirements
create file EXPORT.md with content:
# Export / Hosting Notes

// Required env vars (map Lovable Secrets to these names)
DATABASE_URL -> set as DATABASE_URL
SUPABASE_KEY -> set as SUPABASE_KEY

// Build & start
// Use 'npm run build' then 'npm run start' or host's build setting.

 

Environment & Secrets in Lovable => Host mapping

 

  • Use Lovable Secrets UI for runtime secrets during development/Preview.
  • Record exact env var names in EXPORT.md and .env.example so downstream hosts and teammates set the same names.

 

Paste into Lovable chat to produce guidance file and reminders:

// Create a short Remind-Secrets file for contributors
create file .lovable/SECRETS_GUIDE.md with content:
# How to map Lovable Secrets to exported hosts

// In Lovable use Secrets UI to create secrets named exactly as below:
// DATABASE_URL, SUPABASE_KEY, ANOTHER_API_KEY

// When exporting to GitHub or other hosts, ensure the provider env names match the names above.

 

Host-specific config files (optional)

 

  • Add provider config files only if you plan to target those hosts (vercel.json, netlify.toml, static \_headers) so exports are drop-in friendly.

 

Paste into Lovable chat to create optional examples:

// Optional: create vercel.json if deploying to Vercel
create file vercel.json with content:
{
  // // minimal example for builds
  "builds": [{ "src": "package.json", "use": "@vercel/static-build" }],
  "routes": []
}
// Optional: create netlify.toml if deploying to Netlify
create file netlify.toml with content:
[build]
  command = "npm run build"
  publish = "dist"

 

When something requires a terminal or provider CLI

 

  • Use GitHub export/sync and create CI workflows in the repo (via Lovable file edits). Mark these steps in EXPORT.md as "outside Lovable (terminal required)".

 

Paste into Lovable chat to add a CI note:

// Add a short note for CI/CLI steps in EXPORT.md
append to EXPORT.md:
## Outside Lovable (terminal or provider UI required)
// If you need to run migrations, build Docker images, or use provider CLIs, export to GitHub and run CI or follow provider docs.

 

Test and iterate

 

  • Use Lovable Preview for a final check, and keep EXPORT.md and .env.example up to date as you iterate.

 


Recognized by the best

Trusted by 600+ businesses globally

From startups to enterprises and everything in between, see for yourself our incredible impact.

RapidDev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with.

They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

Arkady
CPO, Praction
Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost.

He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Donald Muir
Co-Founder, Arc
RapidDev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space.

They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Mat Westergreen-Thorne
Co-CEO, Grantify
RapidDev is an excellent developer for custom-code solutions.

We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Emmanuel Brown
Co-Founder, Church Real Estate Marketplace
Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 

This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Samantha Fekete
Production Manager, Media Production Company
The pSEO strategy executed by RapidDev is clearly driving meaningful results.

Working with RapidDev has delivered measurable, year-over-year growth. Comparing the same period, clicks increased by 129%, impressions grew by 196%, and average position improved by 14.6%. Most importantly, qualified contact form submissions rose 350%, excluding spam.

Appreciation as well to Matt Graham for championing the collaboration!

Michael W. Hammond
Principal Owner, OCD Tech

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We’ll discuss your project and provide a custom quote at no cost.Â