Discover why scoped, exportable projects are key in Lovable. Learn safe practices and top tips for delivering stellar client work.

Book a call with an Expert
Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.
Scoped, exportable projects are essential because client work must be handoff-ready, auditable, and runnable outside Lovable — and Lovable doesn’t include a terminal. Without a clearly scoped repo, explicit env/secret mapping, and export-friendly scripts/docs, you end up with surprises when developers or CI need to run, test, or deploy the app outside Lovable.
Keeping client projects scoped (one clear deliverable per repo) and exportable (complete runnable code + env mapping + docs) prevents the usual breakage when moving from Lovable to local machines, CI, or a client’s infrastructure.
// Prompt 1: Create scoped docs, env example, and secret mapping
// Paste this into Lovable chat to create/update files.
Please create or update these files exactly as described.
1) Create /CLIENT_SCOPE.md with:
# Client scope and deliverables
// Describe the single deliverable and what is excluded
Deliverable: The web app at / (single-page app) with endpoints under /api.
Included: UI, API endpoints implemented in src/api, tests for critical flows.
Excluded: Hosting setup outside Lovable, analytics beyond basic page views.
2) Create /LOVABLE_EXPORT_INSTRUCTIONS.md with:
# Export and local run instructions
// Clarify what to do inside Lovable and outside (terminal required)
Inside Lovable:
- Use Preview to verify UI and Secrets UI to set runtime secrets.
Outside Lovable (terminal required; use GitHub sync/export):
- git clone <repo>
- cp .env.example .env
- npm install
- npm run dev
Map Lovable Secrets to .env variables; see /secrets.map.json.
3) Create /.env.example with keys (do not include real secrets):
# Example env variables
DATABASE_URL=
SUPABASE_ANON_KEY=
NEXT_PUBLIC_API_BASE=/api
4) Create /secrets.map.json with:
{
// Map Lovable Secret names (left) to .env variable names (right)
"LOVABLE_SUPABASE_KEY": "SUPABASE_ANON_KEY",
"LOVABLE_DATABASE_URL": "DATABASE_URL"
}
4) Update /.gitignore to include:
node_modules
.env
/dist
// Prompt 2: Ensure package.json has standard scripts
// Paste this into Lovable chat to update /package.json (create if missing).
Open /package.json and ensure it includes these scripts under "scripts":
{
// keep existing fields; add or update "scripts"
"scripts": {
"dev": "next dev || vite", // // Use your project's dev command (adjust if not Next/Vite)
"build": "next build || vite build",
"start": "next start || node ./dist/index.js",
"test": "jest --passWithNoTests"
}
}
// If package.json is missing, create a minimal one with name, version, and the scripts above.
// Prompt 3: Add a README section explaining Secrets and GitHub sync
// Paste into Lovable chat to update /README.md.
Update /README.md to include a "Lovable Notes" section:
## Lovable Notes
// How Secrets and export work
- Runtime secrets are stored in Lovable Cloud via the Secrets UI. Names are documented in /secrets.map.json.
- To run locally or in CI, use the .env keys from .env.example and populate values manually or via CI secrets.
- For anything requiring a terminal (install, build, local dev), export or sync this repo to GitHub and run commands outside Lovable (terminal required).
This prompt helps an AI assistant understand your setup and guide you through the fix step by step, without assuming technical knowledge.
Use Lovable-native features: keep secrets out of code by adding a clear .env.example and runtime env checks, require the client project to set values in Lovable’s Secrets UI before Publish/Preview, create a small “delivery” scaffold (README, PUBLISH\_CHECKLIST.md, .gitignore) inside the Lovable workspace, and use GitHub export/sync when any terminal work (builds, migrations, provider CLIs) is required — all changes are done by pasting the prompts below into Lovable chat so Lovable edits files, creates the checklist, and prepares a safe, exportable repo.
Please create these files in the workspace exactly as described.
Create README.md with this content:
// Basic project README for client delivery
# Project Name
This repo is prepared for delivery via Lovable. Follow PUBLISH_CHECKLIST.md before sharing.
Create .env.example with these keys and comments:
// List environment variables that are required but do NOT include real secrets
CLIENT_DB_URL=
// CLIENT_API_KEY=
// NEXT_PUBLIC_ANALYTICS_KEY=
Create .gitignore:
// Ignore node environment and local secrets
node_modules/
.env
.DS_Store
Create PUBLISH_CHECKLIST.md with these steps:
// Checklist the client or dev must complete in Lovable before publishing
- Ensure all values from .env.example are added to Lovable Secrets (do not paste secrets in chat or files).
- Use Preview to verify app runs with Secrets set.
- Verify README and LICENSE are correct, then Publish or export to GitHub.
Commit these files.
Please create src/config.ts with the following content and ensure the app imports it on startup (e.g., top of server entry or index):
// src/config.ts
type Env = {
CLIENT_DB_URL: string;
CLIENT_API_KEY?: string;
NEXT_PUBLIC_ANALYTICS_KEY?: string;
};
// Throw clear, non-sensitive errors if required vars are missing
const required = ["CLIENT_DB_URL"];
const missing = required.filter(k => !process.env[k]);
if (missing.length) {
throw new Error("Missing required environment variables: " + missing.join(", ") + ". Add them via Lovable Secrets UI or in your deployment.");
}
export const ENV = {
CLIENT_DB_URL: process.env.CLIENT_DB_URL!,
CLIENT_API_KEY: process.env.CLIENT_API_KEY,
NEXT_PUBLIC_ANALYTICS_KEY: process.env.NEXT_PUBLIC_ANALYTICS_KEY,
} as Env;
Commit this file and import it in the app entry (if you don't know where, update src/index.tsx or server entry to `import "./src/config";`).
Please create docs/secrets-lovable.md with this content:
// docs/secrets-lovable.md
# Setting Secrets in Lovable
Open Lovable's Secrets UI and create the following secret keys (use the values the client provides):
- CLIENT_DB_URL
- CLIENT_API_KEY (optional)
- NEXT_PUBLIC_ANALYTICS_KEY (optional)
Do NOT put secrets into files or chat. After adding these, use Preview to confirm the app starts. If the app errors about missing envs, check PUBLISH_CHECKLIST.md.
Please create EXPORT_INSTRUCTIONS.md with this content:
// EXPORT_INSTRUCTIONS.md
# Steps outside Lovable (terminal required)
If you need to run database migrations, install local dev dependencies, or use provider CLIs, export or sync this repo to GitHub (use Lovable GitHub sync). Then on your machine:
- git clone <repo>
- npm install or yarn
- run migrations or provider CLIs as documented in project README
These steps cannot be done inside Lovable's editor because Lovable has no terminal.
Create a short, exportable project handoff inside the repo, add a .env.example plus explicit Secrets UI names, and a clear HANDOFF.md that explains how to preview in Lovable, how to Publish, and which steps require GitHub export or a terminal. This gives clients and engineers everything they need inside the project and avoids assumptions about local CLI access.
// Create a new file DELIVERY.md at the repository root with the following content:
// - short project summary and included features
// - runtime requirements (Node version, DB provider e.g., Supabase)
// - "What Lovable provides" (Preview, Publish, Secrets UI)
// - "What requires GitHub export/terminal" with exact commands to run outside Lovable
// Create .env.example at project root with placeholders and comments:
// NODE_ENV=production
// NEXT_PUBLIC_API_URL=https://example.com
// # Supabase example keys — actual values must be set in Lovable Secrets UI
// SUPABASE_URL=__SET_IN_SECRETS__
// SUPABASE_ANON_KEY=__SET_IN_SECRETS__
// Create HANDOFF.md at project root with the following checklist sections:
// - How to preview in Lovable (use Preview button; where to find preview URL)
// - How to add secrets in Lovable (exact names to create in Secrets UI matching .env.example)
// - How to publish from Lovable (Publish button and what it does)
// - How to export to GitHub (enable GitHub sync, then follow .github/CI instructions)
// - Which steps are outside Lovable (marked "outside Lovable (terminal required)") with the exact terminal commands to run
// Instruct Lovable to add a file SECRETS_HELP.md that lists each secret key and how to add it.
// Example entries:
// - SUPABASE_URL — add via Lovable Secrets UI (name: SUPABASE_URL)
// - SUPABASE_ANON_KEY — add via Lovable Secrets UI (name: SUPABASE_ANON_KEY)
// Also include: "After adding secrets, click Preview to see a live build that uses the secrets."
// Add .github/workflows/ci.yml with a basic workflow that runs tests and builds.
// In HANDOFF.md label these CI steps as "outside Lovable (requires GitHub sync/CI)".
// Include exact commands the engineer should run locally or in CI (npm install, npm run build, migrate:up).
Paste each prompt into Lovable chat to create the files and edits. Use Lovable's Preview to confirm the site, use the Secrets UI to add real secret values matching .env.example, and use GitHub export/sync only for CI or DB migrations (labelled "outside Lovable (terminal required)" in HANDOFF.md).
When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.