What Breaks
The CLI handles the mechanical transformation, but some Lovable-specific patterns require manual fixes. Here’s what to watch for.Hardcoded API Calls
Lovable-Managed Endpoints
Lovable apps often have hardcoded references to Lovable’s managed backend:Supabase Client Configuration
Environment Variables
Lovable-Specific Variables
Lovable injects environment variables at build time that won’t exist in your Next.js app:.env.local:
Prefix changes:
- Vite uses
VITE_prefix - Next.js uses
NEXT_PUBLIC_prefix for client-side env vars
Missing Environment Variables
After conversion, your app won’t have access to Lovable’s injected variables. You’ll need to:- Create
.env.localfile - Add your Supabase credentials
- Update any hardcoded URLs
- Restart dev server
Route Structure Changes
React Router → Next.js App Router
The CLI converts React Router patterns, but you need to understand the new structure:app/ directory
Route Parameters
Data Fetching Patterns
Client-Side Fetching in useEffect
Realtime Subscriptions
Authentication Patterns
Client-Side Auth State
Database Queries
Hardcoded Table Names
Make sure your table names match your Supabase schema:RLS Policy Dependencies
If you’re still on Lovable’s backend temporarily:Styling Issues
Tailwind Classes
Most Tailwind classes work, but check for:Font Imports
Image Handling
Standard img Tags
External Images
Build Errors
”window is not defined”
Cause: Browser API used in Server Component“document is not defined”
Same fix as above - either add ‘use client’ or ensure code runs only in browser.”Cannot find module”
Cause: Old import paths from Vite structurePost-Conversion Checklist
1
Update environment variables
Create
.env.local with your Supabase credentials2
Update Supabase client config
Change from Lovable’s Supabase URL to your own
3
Update API endpoints
Change any hardcoded
/api/ calls to your own backend4
Review data fetching
Consider moving fetch calls to Server Components
5
Add middleware for auth
Protect routes at the edge instead of client-side
6
Test auth flow
Verify login/logout works with your Supabase
7
Update image components
Replace
<img> with Next.js <Image>8
Run the build
npm run build to catch any remaining issues9
Test in production mode
npm start after building to test the real thingCommon Error Messages
”Failed to fetch”
Cause: API endpoint doesn’t exist or CORS error Fix: Check that your Supabase URL is correct and accessible”Auth session missing”
Cause: Auth state not persisting or wrong Supabase project Fix: Verify you’re connecting to the right Supabase instance”Row level security violation”
Cause: RLS policies blocking your query Fix: Check RLS policies in your Supabase dashboard, or use service role for admin ops”relation does not exist”
Cause: Table name typo or schema mismatch Fix: Check exact table names in Supabase, case-sensitive!Still stuck? Check the Troubleshooting guide or use our Cloud Migration Extension to move your backend too.
