/lovable-issues

Instructing Lovable to Use Specific Frameworks or Libraries

Explore why clear framework preferences matter in Lovable prompts and learn how to specify frameworks and libraries effectively.

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 Framework Preferences Must Be Clearly Prompted in Lovable

Because Lovable has no terminal and generates, deploys, and previews from the project files and environment you provide, explicit framework preferences must be asked up front — otherwise the app will scaffold, install, or run using wrong assumptions and previews/publishes will break.

 

Why this matters

 

  • Build & runtime choices are baked into generated files — bundlers, polyfills, and package.json differ by framework. If Lovable guesses wrong, Preview will fail or produce an incompatible build.
  • No terminal to fix mismatches — you can’t run install/build commands inside Lovable to recover; fixes must be done by editing files or via GitHub export and a local terminal.
  • Secrets and environment wiring differ — integrations (Supabase, DBs, auth) require different env names and setup steps; explicit choices avoid missing or misnamed Secrets.
  • Team and CI reproducibility — when framework choices are recorded up front, everyone (and CI) sees the same expected stack and configuration, avoiding “works on my machine” surprises after GitHub sync.
  • Faster, clearer onboarding in Lovable — prompting lets Lovable produce correct files, helpful runtime checks, and clear next steps (e.g., set Secrets in Lovable Cloud) rather than guessing.

 

Lovable prompt to implement a clear framework-preference flow (paste into Lovable chat)

 

Please implement a clear onboarding flow that forces explicit framework preferences and fails early with helpful instructions when preferences are missing. Make these concrete edits:

- Create docs/LOVABLE_ONBOARDING.md with a short checklist that explains required choices and where to set them in Lovable Cloud (Project → Secrets) or after GitHub export.
- Add src/setup/framework-check.ts which reads three environment variables (LOVABLE_FRONTEND, LOVABLE_BACKEND, LOVABLE_DB), verifies they exist, and throws a clear, actionable Error listing what's missing and where to set them (Lovable Secrets UI or GitHub secrets after export).
- Import the check at the very top of the main server entry (update src/index.ts or src/main.ts — if both exist update both) so the app fails fast in Preview with the message.
- Update README.md root section to point to docs/LOVABLE_ONBOARDING.md and mention using Lovable Secrets UI.
- Commit changes.

Provide exact file contents as below.

File: docs/LOVABLE_ONBOARDING.md
// Basic onboarding for Lovable — required framework selections and where to put them
// Explain choices briefly and link to Lovable Secrets UI
Write clear paragraphs that ask the user to set LOVABLE_FRONTEND, LOVABLE_BACKEND, LOVABLE_DB in Lovable Cloud (Project → Secrets) before Preview or Publish. Explain that after GitHub export these become GitHub secrets and local developers should set matching env vars locally.

File: src/setup/framework-check.ts
// create this file
export function ensureFrameworkPrefs() {
  const missing = [];
  if (!process.env.LOVABLE_FRONTEND) missing.push('LOVABLE_FRONTEND');
  if (!process.env.LOVABLE_BACKEND) missing.push('LOVABLE_BACKEND');
  if (!process.env.LOVABLE_DB) missing.push('LOVABLE_DB');
  if (missing.length) {
    throw new Error(
      'Missing required project framework preferences: ' +
      missing.join(', ') +
      ".\nSet these in Lovable Cloud → Project → Secrets (or as GitHub secrets after export). See docs/LOVABLE_ONBOARDING.md for details."
    );
  }
}

File edits: src/index.ts (or src/main.ts)
// at the very top of the file add:
import './setup/framework-check';
// then leave the rest of the file unchanged

Update README.md root section
// add a short line: "Before Preview/Publish set LOVABLE_FRONTEND, LOVABLE_BACKEND, LOVABLE_DB in Lovable Cloud (see docs/LOVABLE_ONBOARDING.md)."

After these edits, open Preview so errors show up for missing selections. If any step requires actions outside Lovable (e.g., adding GitHub secrets after export), clearly label those steps in docs/LOVABLE_ONBOARDING.md as "outside Lovable (terminal/CI or GitHub settings)." 

 

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 Specify Frameworks and Libraries in Lovable Prompts

Paste one of the ready-to-use Lovable prompts below into your Lovable chat. Each prompt tells Lovable exactly which files to change, what to add to package.json, and where to put secrets (via the Lovable Secrets UI) so Lovable can implement framework/library choices without asking you to run terminal commands.

 

Pasteable Lovable prompts

 

  • Set framework and core libraries for a new project (React + TypeScript + Vite) — paste into Lovable:
// Project preference: use React + TypeScript + Vite as the app framework and bundler.
// Make explicit edits to files and package.json so the repo reflects this choice.
// Files to create/update:
//  - package.json: set name, scripts, and dependencies for react, react-dom, vite, typescript.
//  - tsconfig.json: add a basic TS config.
//  - index.html and src/main.tsx: minimal Vite React entry.
//  - src/App.tsx: basic component with a <Routes> placeholder.
// Please perform exact file changes below.

// update package.json (create if missing)
{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  },
  "dependencies": {
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
    "vite": "^5.0.0",
    "typescript": "^5.0.0",
    "@types/react": "^18.0.0",
    "@types/react-dom": "^18.0.0"
  }
}

// create tsconfig.json with a minimal config
// create index.html and src/main.tsx, src/App.tsx as Vite/React entry files
// update README.md to state: "Framework: React + TypeScript + Vite"

// Note: Do not attempt to run npm install here. Add these files and leave instructions in README
// for local/GitHub CI installation. If CI setup is desired, add .github/workflows/node-ci.yml.

 

  • Add Supabase client and secrets to an existing JavaScript/TypeScript app — paste into Lovable:
// Add Supabase to the project and wire in secrets via Lovable's Secrets UI.
// Changes to make:
//  - package.json: add "supabase-js": "^2.0.0" to dependencies.
//  - create src/lib/supabase.ts with a standard Supabase client initializer.
//  - update src/pages/Login.tsx (or src/App.tsx if Login doesn't exist): import the client and show a simple auth usage comment.
//  - update README.md with instructions: "Set SUPABASE_URL and SUPABASE_KEY in Lovable Secrets."

// update package.json dependencies (merge with existing)
"dependencies": {
  // ...existing deps...
  "supabase-js": "^2.0.0"
}

// create src/lib/supabase.ts
// // Supabase client wrapper
import { createClient } from "@supabase/supabase-js";

const supabaseUrl = process.env.SUPABASE_URL;
const supabaseKey = process.env.SUPABASE_KEY;

export const supabase = createClient(supabaseUrl || "", supabaseKey || "");

// update src/pages/Login.tsx or src/App.tsx to import { supabase } from "../lib/supabase"
// and add a small example comment demonstrating signIn/signUp usage.

// Instruction for Secrets:
// In Lovable Cloud, open the Secrets UI and add two Secrets:
//  - SUPABASE_URL (value: your Supabase project URL)
//  - SUPABASE_KEY (value: your anon/public key)

 

  • Swap routing library to React Router in an existing React app (edit specific files) — paste into Lovable:
// Replace/enable React Router usage. Make direct edits as follows:
//  - package.json: add "react-router-dom": "^6.8.0" to dependencies.
//  - update src/main.tsx or src/index.tsx to wrap <App /> in BrowserRouter.
//  - update src/App.tsx: replace current route handling with <Routes> and <Route> components.
//  - update any file that referenced the old router to use react-router-dom's useNavigate/useParams as needed.

// update package.json dependencies
"dependencies": {
  // ...existing deps...
  "react-router-dom": "^6.8.0"
}

// update src/main.tsx (replace where App is rendered)
// // wrap App with BrowserRouter
import { BrowserRouter } from "react-router-dom";
import App from "./App";

root.render(
  <BrowserRouter>
    <App />
  </BrowserRouter>
);

// update src/App.tsx in the <Routes> block
// // Example Routes
import { Routes, Route } from "react-router-dom";
import Home from "./pages/Home";
import About from "./pages/About";

function App() {
  return (
    <Routes>
      <Route path="/" element={<Home />} />
      <Route path="/about" element={<About />} />
    </Routes>
  );
}

export default App;

 

  • Major framework migration or anything that needs terminal (outside Lovable) — paste into Lovable:
// This migration requires running CLI commands (install/build/migrate). I want a Git-aware PR with changes plus a clear checklist for local or CI execution.
// Actions for Lovable:
//  - Create a branch named "migrate-next-to-vite" and modify files to reflect the target structure (package.json, tsconfig.json, vite config, src/*).
//  - Add .github/workflows/migrate-ci.yml that runs npm install and tests on push to this branch.
//  - Create README-MIGRATION.md with step-by-step commands the developer must run locally (marked "outside Lovable (terminal required)"), e.g. npm install, node scripts, etc.
// Do not attempt to run installs in Lovable; produce files and a migration checklist.

 

Extra notes (short)

 

  • Secrets must be set via the Lovable Secrets UI — include that instruction in the prompt whenever a library needs keys.
  • If a change needs a terminal, tell Lovable to create GitHub workflow files and a migration README labeled "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 Specifying Framework Preferences in Lovable

The simplest, most reliable approach in Lovable is to record explicit framework preferences in repository files and in Lovable’s UI (Secrets) so the chat agent and reviewers always know the exact framework, version, package manager, build and dev commands, runtime (Node) version, and any SSR vs CSR expectations — then surface those in package.json and a small repo manifest so Lovable previews and exports behave predictably. Do this entirely with Chat Mode edits (create/update files), the Preview, and the Secrets UI; use GitHub sync/export only for actions that truly require a terminal.

 

Core best practices (short)

 

  • Create a repo manifest (file the project can read) that lists framework, version, package manager, build/dev commands, ports, and SSR/CSR decision.
  • Make package.json authoritative — add engines, explicit scripts, and a comment-like section in a manifest file so Lovable can edit confidently.
  • Use Lovable Secrets UI for all sensitive environment variables and document the names in the manifest.
  • Pin major versions and state fallback commands (e.g., NODE_VERSION, BUILD_CMD env var) to avoid “it works locally” surprises.
  • When a terminal is required, note that in the manifest and trigger GitHub sync/export — do not ask users to run commands inside Lovable.

 

Lovable prompts to paste (use these in Chat Mode)

 

Paste each prompt into Lovable chat separately. They tell Lovable exactly what files to create or update.

  • Create a framework manifest file:
    Prompt for Lovable: \`\`\` // Create a new file at .lovable/framework-preferences.md // Content should be plain markdown describing project preferences. // Include these headers and values (replace examples with actual project choices): // // Framework: Next.js // FrameworkVersion: 14.x // SSR: true // PackageManager: pnpm // NodeVersion: 20 // BuildCommand: pnpm build // DevCommand: pnpm dev -- -p 3000 // DevPort: 3000 // CSSFramework: TailwindCSS // Database: Supabase // Auth: Supabase Auth // EnvSecrets: SUPABASE_URL, SUPABASE_KEY // Notes: "If a terminal is required for local tasks, add a CI job in .github/workflows and mark here." // // Save exactly to .lovable/framework-preferences.md \`\`\`
  • Patch package.json to be explicit:
    Prompt for Lovable: \`\`\` // Update package.json at root: add an "engines" field and explicit scripts. // If engines exists, merge values. Example additions: // // "engines": { // "node": ">=20 <21" // }, // "scripts": { // "dev": "pnpm dev -- -p 3000", // "build": "pnpm build", // "start": "pnpm start" // } // // Apply the change as a patch/diff to /package.json \`\`\`
  • Document environment secrets and guide to set them:
    Prompt for Lovable: \`\`\` // Update .lovable/framework-preferences.md (append) to include a "How to set secrets in Lovable" section: // - List each secret name (SUPABASE_URL, SUPABASE_KEY) // - Explicitly instruct: "Open Lovable Secrets UI -> Create secret with name SUPABASE\_KEY -> paste value." // - Note that secrets are required for Preview and Publish and that values must be set before Publish. // Save edits to .lovable/framework-preferences.md \`\`\`
  • Add a README snippet so reviewers know what to expect:
    Prompt for Lovable: \`\`\` // Update README.md: add a short "Framework Preferences" section near the top including the same fields as .lovable/framework-preferences.md // Example line: "This project uses Next.js 14 (SSR), Node >=20, pnpm. See .lovable/framework-preferences.md for full details." // Apply as an edit to /README.md \`\`\`
  • When terminal-only steps are required:
    Prompt for Lovable: \`\`\` // If any step requires running a CLI (e.g., migrating DB, seeding), append a "Local / CI steps" section to .lovable/framework-preferences.md // Include exact commands and mark them as "outside Lovable (requires terminal):" so the repo consumer knows to run them locally or in CI. // Save edits to .lovable/framework-preferences.md \`\`\`

 

Why this works in Lovable

 

  • Files and explicit scripts let Lovable edit and Preview reliably — no CLI required inside Lovable.
  • Secrets UI is used for runtime-only values; manifest points to those names so the agent and reviewers won’t guess.
  • GitHub sync/export is only recommended when a terminal/CI job must be added and run outside Lovable.

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev 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.

CPO, Praction - Arkady Sokolov

May 2, 2023

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!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev 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.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-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.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

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!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022