# Convert Command
Source: https://docs.nextlovable.com/cli/convert
Convert individual React files to Next.js format
The `convert` command consumes **1 file conversion credit** per file.
Each new account starts with **10 free conversion credits**, and every migration credit purchased grants **10 additional conversion credits**.
## Basic Usage
```bash theme={null}
next-lovable convert [options]
```
## Examples
### Simple Conversion
Convert a single file:
```bash theme={null}
next-lovable convert src/components/Header.tsx
```
### Preview Changes First
See what will change without modifying the file:
```bash theme={null}
next-lovable convert src/components/Header.tsx --dry-run --show-diff
```
### Convert with Specific Transformations
Apply only specific transformation types:
```bash theme={null}
next-lovable convert MyComponent.tsx --transform router,client
```
### Save to Different Location
Keep the original file intact:
```bash theme={null}
next-lovable convert src/Header.tsx --output converted/Header.tsx
```
## Command Options
The React file you want to convert. Supports `.tsx`, `.ts`, `.jsx`, and `.js` files.
Output file path. If not specified, the original file is overwritten.
**Examples:**
* `--output ./converted/MyComponent.tsx`
* `-o ../next-version/Header.tsx`
Comma-separated list of transformations to apply. Available options:
* `router` - React Router to Next.js navigation
* `helmet` - React Helmet to Next.js Head
* `client` - Auto-detect and add 'use client' directive
* `context` - React Context provider migration
* `all` - Apply all transformations (default)
**Examples:**
* `--transform router`
* `--transform router,client`
* `-t helmet,context`
Preview changes without modifying any files. Great for testing.
**Example:**
```bash theme={null}
next-lovable convert Header.tsx --dry-run
```
Show a detailed before/after comparison. Must be used with `--dry-run`.
**Example:**
```bash theme={null}
next-lovable convert Header.tsx --dry-run --show-diff
```
List all available transformations and exit.
**Example:**
```bash theme={null}
next-lovable convert --list
```
Show help information for the convert command.
## Transformation Types
### router
Converts React Router usage to Next.js navigation:
```tsx Before theme={null}
import { Link, useNavigate, useLocation } from 'react-router-dom';
const MyComponent = () => {
const navigate = useNavigate();
const location = useLocation();
return (
Dashboard
Current: {location.pathname}
);
};
```
```tsx After theme={null}
'use client';
import Link from 'next/link';
import { useRouter, usePathname } from 'next/navigation';
const MyComponent = () => {
const router = useRouter();
const pathname = usePathname();
return (
Dashboard
Current: {pathname}
);
};
```
### helmet
Converts React Helmet to Next.js Head:
```tsx Before theme={null}
import { Helmet } from 'react-helmet';
const PageMeta = ({ title, description }) => (
{title}
);
```
```tsx After theme={null}
import Head from 'next/head';
const PageMeta = ({ title, description }) => (
{title}
);
```
### client
Automatically detects when a component needs the `'use client'` directive:
```tsx Before theme={null}
import React, { useState } from 'react';
const Counter = () => {
const [count, setCount] = useState(0);
return (
);
};
```
```tsx After theme={null}
'use client';
import React, { useState } from 'react';
const Counter = () => {
const [count, setCount] = useState(0);
return (
);
};
```
**Client directive is added when the component uses:**
* React hooks (`useState`, `useEffect`, etc.)
* Event handlers (`onClick`, `onChange`, etc.)
* Browser APIs (`window`, `document`, `localStorage`)
* Third-party libraries that require client-side execution
### context
Migrates React Context providers and consumers:
```tsx Before theme={null}
import React, { createContext, useContext } from 'react';
const ThemeContext = createContext();
export const ThemeProvider = ({ children }) => {
const [theme, setTheme] = useState('light');
return (
{children}
);
};
```
```tsx After theme={null}
'use client';
import React, { createContext, useContext } from 'react';
const ThemeContext = createContext();
export const ThemeProvider = ({ children }) => {
const [theme, setTheme] = useState('light');
return (
{children}
);
};
```
## Common Use Cases
### Testing Before Full Migration
Before migrating an entire project, test key components:
```bash theme={null}
# Test your main App component
next-lovable convert src/App.tsx --dry-run --show-diff
# Test navigation components
next-lovable convert src/components/Navigation.tsx --dry-run
# Test components with routing
find src -name "*.tsx" -exec next-lovable convert {} --dry-run \;
```
### Batch Processing
Convert multiple files at once:
```bash theme={null}
# Convert all files in a directory
next-lovable convert src/components/*.tsx
# Convert with specific transformations only
next-lovable convert src/pages/*.tsx --transform router
```
### Incremental Migration
Gradually migrate your codebase:
```bash theme={null}
# Step 1: Convert routing components
next-lovable convert src/App.tsx src/components/Navigation.tsx --transform router
# Step 2: Convert components with state
next-lovable convert src/components/Form.tsx --transform client
# Step 3: Convert metadata components
next-lovable convert src/components/SEO.tsx --transform helmet
```
## Output Examples
### Dry Run Output
```bash theme={null}
$ next-lovable convert Header.tsx --dry-run
✓ Analyzed Header.tsx
✓ Found React Router usage - will convert to Next.js navigation
✓ Detected client-side hooks - will add 'use client' directive
✓ No changes needed for imports
Summary:
- 3 transformations will be applied
- File size will change from 1.2KB to 1.3KB
- No breaking changes detected
Use --show-diff to see detailed changes
```
### Diff Output
```bash theme={null}
$ next-lovable convert Header.tsx --dry-run --show-diff
--- Header.tsx (original)
+++ Header.tsx (converted)
@@ -1,4 +1,6 @@
+'use client';
+
import React from 'react';
-import { Link, useNavigate } from 'react-router-dom';
+import Link from 'next/link';
+import { useRouter } from 'next/navigation';
@@ -6,7 +8,7 @@
const Header = () => {
- const navigate = useNavigate();
+ const router = useRouter();
return (
- Dashboard
+ Dashboard
);
};
```
## Tips & Best Practices
Use `--dry-run --show-diff` to see changes before applying them
Use `--transform` to apply specific changes and understand what each does
Use `--output` to save converted files separately when testing
Begin with simple components before tackling complex files
## Error Handling
The convert command includes robust error handling:
* **Syntax errors**: The tool will report and skip files with syntax errors
* **Unsupported patterns**: Complex patterns are reported for manual review
* **File permissions**: Clear error messages for permission issues
* **Invalid options**: Helpful suggestions for incorrect command usage
## What's Next?
Explore [real-world conversion examples](/0.0.7/examples/basic-conversion)
Ready for complete project migration? See the [migrate command](/0.0.7/commands/migrate)
Check out our [best practices guide](/0.0.7/guides/best-practices)
# CLI Overview
Source: https://docs.nextlovable.com/cli/index
Stop waiting for Lovable to export. Get your React code converted to Next.js in minutes.
# The Gateway Drug
A smart CLI tool that automatically converts your React Router applications to Next.js 14+ using the new App Router. Escape Lovable's ecosystem and own your code.
## What You're Buying
**Not a service. A tool.** You pay once, you own the conversion. Convert FROM Lovable TO Next.js. No monthly fees, no vendor lock-in.
## What Exactly Gets Converted
* `useNavigate()` → `useRouter()`
* `` → ``
* `useLocation()` → `usePathname()` + `useSearchParams()`
* `useParams()` → Next.js `useParams()`
* `useState`, `useEffect`, custom hooks preserved
* Context providers maintained
* Automatic 'use client' directive detection
* Tailwind CSS classes preserved
* CSS Modules support
* Styled-components detection
* Functional components converted
* Props interfaces maintained
* TypeScript types preserved
## What Breaks
These require manual intervention after conversion
Lovable injects proprietary components that don't exist outside their platform:
* Custom UI libraries with Lovable-specific props
* Pre-built authentication components
* Managed form components
**Fix**: Replace with standard React components or shadcn/ui
Lovable apps often have hardcoded references to their managed APIs:
* `/api/lovable/*` endpoints
* Internal service URLs
* Managed auth endpoints
**Fix**: Update to your own API endpoints or Supabase
Lovable-specific env vars won't work:
* `VITE_LOVABLE_*` variables
* Managed database connection strings
* Platform-specific config
**Fix**: Create your own `.env.local` with correct values
## The 1-Credit Escape
```bash theme={null}
npm install -g next-lovable
```
```bash theme={null}
next-lovable convert MyComponent.tsx --dry-run --show-diff
```
Single file conversions are free. No account needed.
```bash theme={null}
next-lovable convert src/components/*.tsx
```
Each file consumes 1 conversion credit.
```bash theme={null}
next-lovable migrate ./my-app ./my-next-app
```
Full migrations require authentication and 1 migration credit.
## When to Use CLI vs Cloud Migration
**Use when:**
* You just want the code
* You're fine staying on Lovable's backend for now
* You have your own database solution
* You want to test the conversion first
**What you get:**
* Next.js App Router codebase
* React Router converted to Next.js navigation
* TypeScript preserved
**What stays the same:**
* Database (still on Lovable's Supabase)
* Auth (still using Lovable's managed auth)
* Storage (still on their buckets)
**Use when:**
* You want complete independence
* You need your own Supabase project
* You want to own your data
* You're ready for production
**What you get:**
* Everything from CLI
* Your own Supabase project
* Migrated data, auth users, RLS policies
* Storage bucket reconfiguration
## Real-World Example
```tsx Before (React Router) theme={null}
import { Link, useNavigate, useLocation } from 'react-router-dom';
export const Navigation = () => {
const navigate = useNavigate();
const location = useLocation();
return (
);
};
```
```tsx After (Next.js) theme={null}
'use client';
import Link from 'next/link';
import { useRouter, usePathname } from 'next/navigation';
export const Navigation = () => {
const router = useRouter();
const pathname = usePathname();
return (
);
};
```
## Quick Command Reference
| Task | Command | Credits |
| ---------------------- | ----------------------------------------- | -------------- |
| Test single file | `next-lovable convert file.tsx --dry-run` | Free |
| Convert file | `next-lovable convert file.tsx` | 1 per file |
| Preview full migration | `next-lovable migrate ./app --dry-run` | Shows estimate |
| Full migration | `next-lovable migrate ./app ./next-app` | 1 credit |
## Next Steps
Get the tool installed in 2 minutes
Convert your first file
Migrate an entire project
**Need to migrate your backend too?** Check out [Cloud Migration](/cloud-migration) for the complete escape plan.
# Installation
Source: https://docs.nextlovable.com/cli/installation
How to install and set up next-lovable CLI
## System Requirements
Version 18.x or higher
npm, yarn, or pnpm
## Installation Methods
### Global Installation (Recommended)
Install next-lovable globally to use it from anywhere:
```bash npm theme={null}
npm install -g next-lovable
```
```bash yarn theme={null}
yarn global add next-lovable
```
```bash pnpm theme={null}
pnpm add -g next-lovable
```
Global installation allows you to run `next-lovable` from any directory on your system.
## Verify Installation
Check if next-lovable is installed correctly:
```bash theme={null}
next-lovable --version
```
You should see the version number displayed.
## Account Setup (For Full Migrations)
Go to [nextlovable.com](https://nextlovable.com) and create an account
**Free Tier Available**: Single file conversions don't require an account or API key. Only full project migrations require authentication.
## Updating
To update to the latest version:
```bash npm theme={null}
npm update -g next-lovable
```
```bash yarn theme={null}
yarn global upgrade next-lovable
```
```bash pnpm theme={null}
pnpm update -g next-lovable
```
## Troubleshooting
If you get permission errors on macOS/Linux, try:
```bash theme={null}
sudo npm install -g next-lovable
```
Or better yet, configure npm to use a different directory:
```bash theme={null}
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
```
If `next-lovable` command is not found after installation:
1. Restart your terminal
2. Check if the npm global bin directory is in your PATH:
```bash theme={null}
npm config get prefix
echo $PATH
```
3. Add npm global bin to your PATH if missing
If you encounter Node.js version compatibility issues:
1. Check your Node.js version: `node --version`
2. Update Node.js to 18.x or higher
3. Consider using a Node.js version manager like nvm
## What's Next?
Learn the basics with a simple example
Try the free file conversion feature
# Migrate Command
Source: https://docs.nextlovable.com/cli/migrate
Complete project migration from React to Next.js using version 0.0.7+
The `migrate` command performs **full project migrations** and requires **authentication and credits**. For free single file conversions, use the [`convert` command](/0.0.7/commands/convert).
## Basic Usage
```bash theme={null}
next-lovable migrate [target-directory] [options]
```
## Examples
### Basic Migration
Migrate to a new directory:
```bash theme={null}
next-lovable migrate ./my-react-app ./my-next-app
```
### In-Place Migration
Migrate in the same directory (be careful!):
```bash theme={null}
next-lovable migrate ./my-react-app
```
### Preview Changes First
See what will change without making modifications:
```bash theme={null}
next-lovable migrate ./my-react-app --dry-run
```
### Automated Migration
Skip confirmations and install dependencies:
```bash theme={null}
next-lovable migrate ./my-react-app ./my-next-app --yes --install
```
## Command Options
Path to your React application directory. Must contain a `package.json` file with React and React Router dependencies.
**Examples:**
* `./my-react-app`
* `/path/to/react-project`
* `../frontend`
Directory where the new Next.js project will be created. If omitted, migration happens in-place in the source directory.
**Examples:**
* `./my-next-app`
* `/path/to/next-project`
* `../next-frontend`
**Note:** Directory will be created if it doesn't exist.
Simulate the migration without making any actual changes. Shows you exactly what files will be created, modified, or removed.
**Example:**
```bash theme={null}
next-lovable migrate ./my-app --dry-run
```
**Output includes:**
* List of files to be converted
* New file structure
* Dependencies to be added/removed
* Configuration changes
* Estimated credit consumption
Skip all confirmation prompts and proceed with migration automatically.
**Example:**
```bash theme={null}
next-lovable migrate ./my-app ./next-app --yes
```
**Use with caution** - this will proceed without asking for confirmation.
Automatically install dependencies after migration completes.
**Example:**
```bash theme={null}
next-lovable migrate ./my-app ./next-app --install
```
Equivalent to running `npm install` in the target directory after migration.
Comma-separated list of transformations to apply during migration. Available options:
* `router` - React Router to Next.js navigation
* `helmet` - React Helmet to Next.js Head
* `client` - Auto-detect and add 'use client' directive
* `context` - React Context provider migration
* `all` - Apply all transformations (default)
**Examples:**
* `--transform router,client`
* `--transform all`
* `-t helmet,context`
Show help information for the migrate command.
**Example:**
```bash theme={null}
next-lovable migrate --help
```
## Migration Process
### What Happens During Migration
* Scans source directory for React components
* Identifies React Router usage patterns
* Analyzes component dependencies and structure
* Detects client vs server component requirements
* Estimates transformation complexity
* Creates Next.js app directory structure
* Sets up layout.tsx and page.tsx files
* Organizes components appropriately
* Creates necessary configuration files
* Preserves assets and public files
* Converts React Router to Next.js navigation
* Transforms routing components to pages
* Adds 'use client' directives where needed
* Updates import statements and paths
* Converts React Helmet to Next.js Head
* Generates next.config.js
* Updates package.json with Next.js scripts
* Configures TypeScript settings (if used)
* Sets up ESLint and other development tools
* Migrates environment variables
### File Structure Transformation
```bash Before (React + Vite) theme={null}
my-react-app/
├── src/
│ ├── App.tsx
│ ├── main.tsx
│ ├── components/
│ │ ├── Header.tsx
│ │ └── Navigation.tsx
│ ├── pages/
│ │ ├── Home.tsx
│ │ ├── About.tsx
│ │ └── Contact.tsx
│ ├── hooks/
│ │ └── useAuth.ts
│ └── styles/
│ └── index.css
├── public/
├── package.json
└── vite.config.js
```
```bash After (Next.js App Router) theme={null}
my-next-app/
├── app/
│ ├── layout.tsx
│ ├── page.tsx
│ ├── about/
│ │ └── page.tsx
│ ├── contact/
│ │ └── page.tsx
│ └── globals.css
├── components/
│ ├── Header.tsx
│ └── Navigation.tsx
├── hooks/
│ └── useAuth.ts
├── public/
├── package.json
└── next.config.js
```
## Code Transformations
### React Router to App Router
```tsx Before (React Router) theme={null}
// src/App.tsx
import { BrowserRouter, Routes, Route } from 'react-router-dom';
import { Link, useNavigate, useLocation } from 'react-router-dom';
import Home from './pages/Home';
import About from './pages/About';
import Contact from './pages/Contact';
function App() {
return (
} />
} />
} />
);
}
function Navigation() {
const navigate = useNavigate();
const location = useLocation();
return (
);
}
```
```tsx After (Next.js App Router) theme={null}
// app/layout.tsx
import Navigation from '../components/Navigation';
import './globals.css';
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
{children}
);
}
// components/Navigation.tsx
'use client';
import Link from 'next/link';
import { useRouter, usePathname } from 'next/navigation';
function Navigation() {
const router = useRouter();
const pathname = usePathname();
return (
);
}
// app/page.tsx (Home)
export default function Home() {
return
Home Page Content
;
}
// app/about/page.tsx
export default function About() {
return
About Page Content
;
}
// app/contact/page.tsx
export default function Contact() {
return
Contact Page Content
;
}
```
### Package.json Migration
```json Before theme={null}
{
"name": "my-react-app",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"lint": "eslint src --ext ts,tsx"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.8.0",
"react-helmet": "^6.1.0"
},
"devDependencies": {
"@vitejs/plugin-react": "^3.1.0",
"vite": "^4.1.0",
"typescript": "^4.9.0"
}
}
```
```json After theme={null}
{
"name": "my-next-app",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"next": "^13.5.0"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "^13.5.0",
"typescript": "^5"
}
}
```
## Differences from v0.0.6
v0.0.7+ uses `migrate` subcommand vs direct command in v0.0.6
Choose specific transformations with `--transform` option
Improved error messages and recovery options
Faster processing and more efficient API usage
## Command Comparison
| Feature | v0.0.6 | v0.0.7+ |
| --------------- | ----------------------- | ------------------------------- |
| Command | `next-lovable ` | `next-lovable migrate ` |
| Free tier | ❌ No | ✅ Single file conversions |
| Transformations | All or nothing | Granular control |
| Error recovery | Limited | Enhanced |
| Dry run detail | Basic | Comprehensive |
## Error Handling & Troubleshooting
### Pre-Migration Validation
**Problem**: Cannot authenticate or invalid API key
**Solutions**:
1. Re-run authentication: `next-lovable auth`
2. Verify API key from nextlovable.com dashboard
3. Check network connectivity to api.nextlovable.com
4. Ensure account has sufficient credits
**Problem**: Tool doesn't detect React Router project
**Solutions**:
1. Verify package.json contains React and React Router dependencies
2. Check that components actually use React Router hooks/components
3. Ensure project structure follows standard React conventions
4. Try running from the project root directory
**Problem**: Cannot create or access target directory
**Solutions**:
1. Check write permissions in parent directory
2. Ensure sufficient disk space available
3. Try using a different target location
4. Avoid special characters in directory names
### During Migration
**Problem**: Process hangs or stops with errors
**Solutions**:
1. Check network connectivity
2. Verify API rate limits aren't exceeded
3. Try smaller project or exclude large files temporarily
4. Use `--dry-run` to identify potential issues first
**Problem**: Migration fails due to invalid source code
**Solutions**:
1. Fix TypeScript/JavaScript errors first
2. Run linting and fix issues
3. Remove or fix experimental language features
4. Ensure all imports resolve correctly
**Problem**: Migration uses more credits than expected
**Solutions**:
1. Use `--dry-run` to estimate credits first
2. Remove unused files and components
3. Consider migrating in phases
4. Optimize complex routing patterns
### Post-Migration
**Problem**: `npm run dev` fails in migrated project
**Solutions**:
1. Run `npm install` to ensure all dependencies
2. Check for TypeScript compilation errors
3. Clear Next.js cache: `rm -rf .next`
4. Verify next.config.js is valid
5. Check for missing environment variables
**Problem**: Pages don't load or navigation broken
**Solutions**:
1. Verify App Router structure (app/page.tsx files)
2. Check that page components export default functions
3. Ensure 'use client' directives are added where needed
4. Verify Link components use `href` instead of `to`
**Problem**: Type errors in migrated code
**Solutions**:
1. Install missing type packages: `@types/react`, `@types/node`
2. Update tsconfig.json for Next.js compatibility
3. Fix component prop types
4. Address Next.js-specific type requirements
## Best Practices
Use `--dry-run` to preview all changes and estimate credits
Commit to git or create backups before migration
Test converted components individually before full deployment
Check converted components for any needed manual adjustments
## Migration Checklist
* [ ] Backup original project (git commit or copy)
* [ ] Verify authentication: `next-lovable auth`
* [ ] Run dry-run: `next-lovable migrate ./app --dry-run`
* [ ] Review estimated credit usage
* [ ] Check disk space and permissions
* [ ] Monitor terminal output for errors
* [ ] Ensure stable network connection
* [ ] Don't interrupt the migration process
* [ ] Note any warnings or issues reported
* [ ] Install dependencies: `npm install`
* [ ] Test development server: `npm run dev`
* [ ] Verify all routes work correctly
* [ ] Check for TypeScript/linting errors
* [ ] Test build process: `npm run build`
* [ ] Review and test all converted components
## Advanced Usage
### Selective Transformations
Apply only specific transformations:
```bash theme={null}
# Only convert routing, skip client directive detection
next-lovable migrate ./my-app ./next-app --transform router
# Convert routing and helmet, skip context providers
next-lovable migrate ./my-app ./next-app --transform router,helmet
# Apply all transformations (default)
next-lovable migrate ./my-app ./next-app --transform all
```
### Batch Processing
Migrate multiple projects:
```bash theme={null}
# Using a loop
for dir in project1 project2 project3; do
next-lovable migrate ./$dir ./migrated-$dir --yes
done
# With parallel processing (be careful with API limits)
find ./projects -name "package.json" -exec dirname {} \; | \
xargs -I {} -P 3 next-lovable migrate {} {}-next --yes
```
### Integration with CI/CD
```yaml theme={null}
# Example GitHub Actions workflow
name: Migrate to Next.js
on: workflow_dispatch
jobs:
migrate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install next-lovable
run: npm install -g next-lovable
- name: Authenticate
run: echo "${{ secrets.NEXTLOVABLE_API_KEY }}" | next-lovable auth
- name: Run migration
run: next-lovable migrate ./react-app ./next-app --yes --install
- name: Test build
run: cd next-app && npm run build
```
## What's Next?
Thoroughly test all routes and functionality in your new Next.js app
Review and optimize server/client components for better performance
Deploy your new Next.js app to your preferred hosting platform
Monitor the app in production and make necessary adjustments
Free single file conversions
Common issues and solutions
Tips for successful migrations
## Need Help?
Report bugs and request features
Get help from the community
# Quick Start
Source: https://docs.nextlovable.com/cli/quick-start
Get up and running with next-lovable in 5 minutes
**New to next-lovable?** This guide will walk you through your first conversion in just a few minutes.
## Your First File Conversion (Free)
Let's start with converting a single React component - no account needed!
### Step 1: Create a Sample Component
Create a file called `Navigation.tsx`:
```tsx Navigation.tsx theme={null}
import React from 'react';
import { Link, useNavigate, useLocation } from 'react-router-dom';
export const Navigation = () => {
const navigate = useNavigate();
const location = useLocation();
const handleLogout = () => {
navigate('/login');
};
return (
);
};
```
### Step 2: Preview the Conversion
See what changes will be made without modifying the file:
```bash theme={null}
next-lovable convert Navigation.tsx --dry-run --show-diff
```
Expected output
You'll see a diff showing:
* React Router imports → Next.js imports
* `useNavigate()` → `useRouter()`
* `useLocation()` → `usePathname()`
* `` → ``
* Addition of `'use client'` directive
### Step 3: Apply the Conversion
Convert the file:
```bash theme={null}
next-lovable convert Navigation.tsx
```
### Step 4: Review the Result
Your file is now converted to Next.js format! Open `Navigation.tsx` to see the changes.
```tsx Before theme={null}
import { Link, useNavigate, useLocation } from 'react-router-dom';
export const Navigation = () => {
const navigate = useNavigate();
const location = useLocation();
// ... rest of component
```
```tsx After theme={null}
'use client';
import Link from 'next/link';
import { useRouter, usePathname } from 'next/navigation';
export const Navigation = () => {
const router = useRouter();
const pathname = usePathname();
// ... rest of component
```
## Common Patterns
### Testing Multiple Files
You can test several files at once:
```bash theme={null}
# Test all components in a directory
next-lovable convert src/components/*.tsx --dry-run
# Test specific transformation types only
next-lovable convert MyComponent.tsx --transform router,client --dry-run
```
### Saving to Different Location
Keep your original files intact:
```bash theme={null}
next-lovable convert src/Navigation.tsx --output converted/Navigation.tsx
```
### Available Transformations
React Router → Next.js navigation
React Helmet → Next.js Head
Auto-detect client components
React Context migration
List all available transformations:
```bash theme={null}
next-lovable convert --list
```
## What's Next?
Convert other components in your React app to get familiar with the tool
Ready for a complete project migration? Check out our [migration guide](/0.0.7/commands/migrate)
See more [real-world examples](/0.0.7/examples/basic-conversion)
**Important**: Always backup your code before running conversions, especially when working with important files!
## Need Help?
Detailed CLI documentation
Common issues and solutions
Tips for successful migrations
# Troubleshooting
Source: https://docs.nextlovable.com/cli/troubleshooting
Common issues and solutions when using next-lovable
## Common Issues
### Installation Problems
**Problem**: After installation, running `next-lovable` shows "command not found"
**Solutions**:
1. **Restart your terminal** - This refreshes the PATH
2. **Check if npm global bin is in PATH**:
```bash theme={null}
npm config get prefix
echo $PATH
```
The npm prefix path should be in your PATH
3. **Add npm global bin to PATH** (if missing):
```bash theme={null}
# For bash/zsh
echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
# For fish shell
set -U fish_user_paths (npm config get prefix)/bin $fish_user_paths
```
4. **Use npx as alternative**:
```bash theme={null}
npx next-lovable convert MyComponent.tsx
```
**Problem**: Getting permission errors during global installation
**Solutions**:
1. **Configure npm to use a different directory** (recommended):
```bash theme={null}
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
npm install -g next-lovable
```
2. **Use sudo** (less secure):
```bash theme={null}
sudo npm install -g next-lovable
```
3. **Use a Node.js version manager** like nvm, which handles permissions better
**Problem**: Errors about Node.js version being too old
**Solutions**:
1. **Check your Node.js version**:
```bash theme={null}
node --version
```
You need 18.x or higher
2. **Update Node.js**:
* Visit [nodejs.org](https://nodejs.org/) for official installer
* Or use a version manager like nvm:
```bash theme={null}
nvm install node # installs latest
nvm use node
```
3. **For Ubuntu/Debian**:
```bash theme={null}
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
```
### Conversion Issues
**Problem**: Error reading the file you're trying to convert
**Solutions**:
1. **Check file path is correct**:
```bash theme={null}
ls -la src/components/MyComponent.tsx
```
2. **Use absolute path**:
```bash theme={null}
next-lovable convert /full/path/to/MyComponent.tsx
```
3. **Check file permissions**:
```bash theme={null}
chmod 644 MyComponent.tsx
```
4. **Make sure file extension is supported**:
* Supported: `.tsx`, `.ts`, `.jsx`, `.js`
* Not supported: `.vue`, `.svelte`, etc.
**Problem**: Tool reports syntax errors in your React component
**Solutions**:
1. **Fix syntax errors first**:
```bash theme={null}
# Use your editor's linter or
npx tsc --noEmit MyComponent.tsx # for TypeScript
npx eslint MyComponent.tsx # for ESLint
```
2. **Check for unsupported syntax**:
* Experimental JavaScript features
* Non-standard JSX patterns
* Mixing TypeScript and JavaScript incorrectly
3. **Simplify complex patterns**:
* Extract complex logic to separate functions
* Break down large components
* Remove experimental decorators
**Problem**: The converted code doesn't work as expected
**Solutions**:
1. **Use dry-run first to preview**:
```bash theme={null}
next-lovable convert MyComponent.tsx --dry-run --show-diff
```
2. **Apply transformations incrementally**:
```bash theme={null}
# Test each transformation separately
next-lovable convert MyComponent.tsx --transform router --dry-run
next-lovable convert MyComponent.tsx --transform client --dry-run
```
3. **Check for complex routing patterns**:
* Dynamic routes with complex parameters
* Nested routing with custom logic
* Route guards and middleware
4. **Manual review needed for**:
* Custom hooks that depend on React Router internals
* Complex state management patterns
* Third-party library integrations
**Problem**: Component uses client-side features but no directive was added
**Solutions**:
1. **Manually apply client transformation**:
```bash theme={null}
next-lovable convert MyComponent.tsx --transform client
```
2. **Check for these patterns that need 'use client'**:
* React hooks (`useState`, `useEffect`, etc.)
* Event handlers (`onClick`, `onChange`, etc.)
* Browser APIs (`window`, `document`, `localStorage`)
* Third-party client libraries
3. **Add manually if needed**:
```tsx theme={null}
'use client';
import React from 'react';
// rest of component
```
### Migration Issues
**Problem**: Cannot authenticate for full project migration
**Solutions**:
1. **Check your API key**:
```bash theme={null}
next-lovable auth --check
```
2. **Re-authenticate**:
```bash theme={null}
next-lovable auth
```
Enter your API key from nextlovable.com dashboard
3. **Verify account status**:
* Log into nextlovable.com
* Check if your account is active
* Verify you have credits remaining
4. **Check network connection**:
```bash theme={null}
curl -I https://api.nextlovable.com/health
```
**Problem**: Full project migration stops with errors
**Solutions**:
1. **Use dry-run first**:
```bash theme={null}
next-lovable migrate ./my-app --dry-run
```
This identifies issues before making changes
2. **Check for blocking issues**:
* Syntax errors in source files
* Permission issues with target directory
* Insufficient disk space
* Network connectivity issues
3. **Try incremental approach**:
```bash theme={null}
# Convert critical files individually first
next-lovable convert src/App.tsx
next-lovable convert src/components/Navigation.tsx
# Then run migration
```
4. **Clean up and retry**:
```bash theme={null}
rm -rf target-directory
next-lovable migrate ./my-app ./clean-target --yes
```
**Problem**: The migrated project has errors when running `npm run dev`
**Solutions**:
1. **Install dependencies**:
```bash theme={null}
cd migrated-project
npm install
# or
yarn install
```
2. **Check Next.js configuration**:
```bash theme={null}
cat next.config.js
```
Look for any obvious configuration issues
3. **Review error messages**:
* Missing dependencies
* Import path issues
* TypeScript errors
* CSS/styling conflicts
4. **Common fixes**:
```bash theme={null}
# Update Next.js to latest
npm install next@latest react@latest react-dom@latest
# Fix TypeScript issues
npm install --save-dev @types/react @types/react-dom
# Clear Next.js cache
rm -rf .next
npm run dev
```
## Performance Issues
**Problem**: Converting files or projects takes a long time
**Solutions**:
1. **Check file size**:
```bash theme={null}
ls -lh MyComponent.tsx
```
Very large files (>100KB) take longer
2. **Break down large files**:
* Split large components into smaller ones
* Extract utility functions
* Separate types and interfaces
3. **Check network (for migrations)**:
* Full migrations require API calls
* Slow internet affects migration speed
* Use `--dry-run` for local-only testing
4. **System resources**:
* Close other applications
* Check available RAM and CPU
* Use faster storage (SSD vs HDD)
**Problem**: Tool uses too much memory during conversion
**Solutions**:
1. **Process files individually**:
```bash theme={null}
# Instead of: next-lovable convert src/**/*.tsx
# Use: find src -name "*.tsx" -exec next-lovable convert {} \;
```
2. **Close other applications** to free up memory
3. **Increase Node.js memory limit**:
```bash theme={null}
node --max-old-space-size=4096 $(which next-lovable) convert MyComponent.tsx
```
4. **Break down large projects** into smaller batches
## Getting Help
### Debug Information
When reporting issues, include this information:
```bash theme={null}
# Next-lovable version
next-lovable --version
# Node.js version
node --version
# npm version
npm --version
# Operating system
uname -a # Linux/macOS
# or
systeminfo # Windows
# File you're trying to convert (if small)
cat MyComponent.tsx
```
### Log Files
Enable verbose logging for detailed error information:
```bash theme={null}
next-lovable convert MyComponent.tsx --verbose
```
### Support Channels
Report bugs and feature requests
Get help from the community
Browse all documentation
## Frequently Asked Questions
**Short answer**: Only if you have backups.
**Best practices**:
1. Always use `--dry-run` first
2. Use `--output` to save to different location
3. Commit to git before converting
4. Use version control to track changes
Some routing patterns are too complex for automatic conversion:
* Custom route guards
* Dynamic imports with complex logic
* Nested routing with conditional rendering
* Integration with state management libraries
These require manual migration.
The tool focuses on converting React/Router code, not build configurations.
For Vite → Next.js migration:
* Next.js handles most bundling automatically
* Custom webpack configs may need manual porting
* Most Vite plugins have Next.js equivalents
Custom hooks using React Router internals need manual conversion:
```tsx theme={null}
// Before
const useAuth = () => {
const navigate = useNavigate();
// ... logic
};
// After (manual conversion needed)
'use client';
const useAuth = () => {
const router = useRouter();
// ... updated logic
};
```
## Report a Bug
Found a bug? Please report it with:
1. **Clear description** of the problem
2. **Steps to reproduce** the issue
3. **Expected vs actual behavior**
4. **Sample code** that causes the issue
5. **System information** (OS, Node.js version, etc.)
[Report on GitHub →](https://github.com/Remote-Skills/next-lovable-cli-issues/issues/new?labels=v0.0.7)
# What Breaks
Source: https://docs.nextlovable.com/cli/what-breaks
Patterns that require manual intervention after conversion
# 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:
```tsx theme={null}
// ❌ Hardcoded Lovable endpoints (these won't work outside Lovable)
const fetchData = async () => {
const response = await fetch('/api/projects');
// This endpoint is Lovable's managed API
};
const uploadImage = async (file) => {
const response = await fetch('/api/upload', {
method: 'POST',
body: file,
});
// This goes to Lovable's storage
};
```
**Fix**: Update to your own API or Supabase:
```tsx theme={null}
// ✅ Your own Supabase instance
const fetchData = async () => {
const { data, error } = await supabase
.from('projects')
.select('*');
if (error) throw error;
return data;
};
const uploadImage = async (file) => {
const { data } = await supabase
.storage
.from('images')
.upload(`public/${file.name}`, file);
return data;
};
```
### Supabase Client Configuration
```tsx theme={null}
// ❌ Hardcoded Lovable Supabase client
import { createClient } from '@supabase/supabase-js';
const supabase = createClient(
'https://lovable-project.supabase.co', // Lovable's instance
'public-anon-key'
);
```
**Fix**: Update to your own Supabase project:
```tsx theme={null}
// ✅ Your own Supabase project
import { createClient } from '@supabase/supabase-js';
const supabase = createClient(
process.env.NEXT_PUBLIC_SUPABASE_URL, // Your project URL
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY
);
```
## Environment Variables
### Lovable-Specific Variables
Lovable injects environment variables at build time that won't exist in your Next.js app:
```bash theme={null}
# ❌ Won't work outside Lovable
VITE_SUPABASE_URL=https://lovable-project.supabase.co
VITE_SUPABASE_ANON_KEY=lovable-anon-key
```
**Fix**: Create your own `.env.local`:
```bash theme={null}
# ✅ Your own variables (Next.js format)
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
```
**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:
1. Create `.env.local` file
2. Add your Supabase credentials
3. Update any hardcoded URLs
4. 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:
```tsx theme={null}
// ❌ React Router setup (your old code)
const router = createBrowserRouter([
{
path: '/',
element: ,
children: [
{ path: 'dashboard', element: },
{ path: 'profile/:id', element: },
],
},
]);
```
**Becomes**: File-based routing in `app/` directory
```bash theme={null}
app/
├── page.tsx # / (home)
├── layout.tsx # Root layout
├── dashboard/
│ └── page.tsx # /dashboard
└── profile/
└── [id]/
└── page.tsx # /profile/:id
```
### Route Parameters
```tsx theme={null}
// ❌ React Router params
import { useParams } from 'react-router-dom';
const Profile = () => {
const { id } = useParams();
// id comes from URL
};
```
```tsx theme={null}
// ✅ Next.js App Router params
// File: app/profile/[id]/page.tsx
export default function Profile({ params }: { params: { id: string } }) {
const { id } = params;
// id comes from params prop
}
```
## Data Fetching Patterns
### Client-Side Fetching in useEffect
```tsx theme={null}
// ⚠️ Works but not optimal
'use client';
const Dashboard = () => {
const [data, setData] = useState([]);
const [loading, setLoading] = useState(true);
useEffect(() => {
fetch('/api/data')
.then(res => res.json())
.then(setData)
.finally(() => setLoading(false));
}, []);
if (loading) return
Loading...
;
return
{data.map(...)}
;
};
```
**Optimization**: Use Server Components for data fetching:
```tsx theme={null}
// ✅ Server Component (no 'use client')
// Direct data fetching on the server
const Dashboard = async () => {
const data = await fetch('https://api.example.com/data', {
// This happens server-side, API key stays hidden
headers: { 'Authorization': `Bearer ${process.env.API_KEY}` }
});
return
;
};
```
**Better**: Use middleware for route protection:
```tsx theme={null}
// middleware.ts
import { createMiddlewareClient } from '@supabase/auth-helpers-nextjs';
import { NextResponse } from 'next/server';
export async function middleware(req) {
const res = NextResponse.next();
const supabase = createMiddlewareClient({ req, res });
const { data: { session } } = await supabase.auth.getSession();
// Protect dashboard routes
if (!session && req.nextUrl.pathname.startsWith('/dashboard')) {
return NextResponse.redirect(new URL('/login', req.url));
}
return res;
}
export const config = {
matcher: ['/dashboard/:path*']
};
```
## Database Queries
### Hardcoded Table Names
Make sure your table names match your Supabase schema:
```tsx theme={null}
// ❌ May not work if table names differ
const { data } = await supabase
.from('Projects') // Case sensitive!
.select('*');
// ✅ Use exact table names from your schema
const { data } = await supabase
.from('projects') // lowercase, matching your migrations
.select('*');
```
### RLS Policy Dependencies
If you're still on Lovable's backend temporarily:
```tsx theme={null}
// ⚠️ RLS policies on Lovable may block requests
const { data, error } = await supabase
.from('private_data')
.select('*');
// Check if RLS is blocking you
if (error && error.code === 'PGRST301') {
console.log('RLS policy blocking access');
}
```
**Fix**: Either migrate to your own Supabase with proper RLS, or use service role key for admin operations.
## Styling Issues
### Tailwind Classes
Most Tailwind classes work, but check for:
```css theme={null}
/* ❌ Custom Lovable classes may not exist */
.bg-lovable-primary { /* Won't work */ }
/* ✅ Replace with standard Tailwind or your config */
.bg-blue-600 { /* Standard Tailwind */ }
```
### Font Imports
```css theme={null}
/* ❌ Remove Lovable-specific font imports */
@import url('https://lovable-fonts.example.com/custom-font.css');
/* ✅ Use standard font imports */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');
```
## Image Handling
### Standard img Tags
```tsx theme={null}
// ⚠️ Works but not optimized
```
**Better**: Use Next.js Image component:
```tsx theme={null}
// ✅ Optimized with Next.js Image
import Image from 'next/image';
```
### External Images
```tsx theme={null}
// ❌ External images need domain config
// ✅ Add to next.config.js
// next.config.js
module.exports = {
images: {
domains: ['external-site.com'],
},
};
```
## Build Errors
### "window is not defined"
**Cause**: Browser API used in Server Component
```tsx theme={null}
// ❌ This fails in Server Component
const width = window.innerWidth;
```
**Fix**: Add 'use client' or use dynamic import:
```tsx theme={null}
// ✅ Option 1: Make it a Client Component
'use client';
const MyComponent = () => {
const width = window.innerWidth;
// ...
};
```
```tsx theme={null}
// ✅ Option 2: Dynamic import with ssr: false
import dynamic from 'next/dynamic';
const ClientComponent = dynamic(() => import('./ClientComponent'), {
ssr: false,
});
```
### "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 structure
```tsx theme={null}
// ❌ Old Vite paths may not resolve
import { Button } from '@/components/ui/button';
// If @ alias isn't configured in Next.js
```
**Fix**: Update tsconfig.json or next.config.js:
```json theme={null}
// tsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./*"]
}
}
}
```
## Post-Conversion Checklist
Create `.env.local` with your Supabase credentials
Change from Lovable's Supabase URL to your own
Change any hardcoded `/api/` calls to your own backend
Consider moving fetch calls to Server Components
Protect routes at the edge instead of client-side
Verify login/logout works with your Supabase
Replace `<img>` with Next.js `<Image>`
`npm run build` to catch any remaining issues
`npm start` after building to test the real thing
## Common 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](/cli/troubleshooting) guide or use our [Cloud Migration Extension](/cloud-migration) to move your backend too.
# What Gets Converted
Source: https://docs.nextlovable.com/cli/what-gets-converted
Detailed breakdown of React patterns transformed to Next.js
# What Gets Converted
The CLI handles the mechanical transformation of React patterns to Next.js equivalents. Here's the comprehensive breakdown.
## React Router → Next.js Navigation
```tsx React Router theme={null}
import { useNavigate } from 'react-router-dom';
const MyComponent = () => {
const navigate = useNavigate();
const handleClick = () => {
navigate('/dashboard');
};
};
```
```tsx Next.js theme={null}
'use client';
import { useRouter } from 'next/navigation';
const MyComponent = () => {
const router = useRouter();
const handleClick = () => {
router.push('/dashboard');
};
};
```
```tsx React Router theme={null}
import { Link } from 'react-router-dom';
About
```
```tsx Next.js theme={null}
import Link from 'next/link';
About
```
```tsx React Router theme={null}
import { useLocation } from 'react-router-dom';
const MyComponent = () => {
const location = useLocation();
const searchParams = new URLSearchParams(location.search);
return (
```
The CLI also preserves:
* Tailwind configuration (copies `tailwind.config.js`)
* Custom utility classes
* `@apply` directives in CSS
```tsx theme={null}
// Before
import styles from './Button.module.css';
// After (unchanged)
import styles from './Button.module.css';
```
Detected and preserved with 'use client' directive:
```tsx theme={null}
// Before
import styled from 'styled-components';
const Button = styled.button`
background: blue;
`;
// After
'use client';
import styled from 'styled-components';
const Button = styled.button`
background: blue;
`;
```
Requires `styled-components` configuration in `next.config.js` for SSR compatibility.
## React Helmet → Next.js Head
```tsx React Helmet theme={null}
import { Helmet } from 'react-helmet';
const Page = () => (
<>
My Page Title
Content
>
);
```
```tsx Next.js theme={null}
import Head from 'next/head';
const Page = () => (
<>
My Page Title
Content
>
);
```
## Context Providers
React Context is preserved with automatic 'use client' detection:
```tsx React theme={null}
import { createContext, useContext, useState } from 'react';
const ThemeContext = createContext();
export const ThemeProvider = ({ children }) => {
const [theme, setTheme] = useState('light');
return (
{children}
);
};
export const useTheme = () => useContext(ThemeContext);
```
```tsx Next.js theme={null}
'use client';
import { createContext, useContext, useState } from 'react';
const ThemeContext = createContext();
export const ThemeProvider = ({ children }) => {
const [theme, setTheme] = useState('light');
return (
{children}
);
};
export const useTheme = () => useContext(ThemeContext);
```
## File Structure Transformation
The CLI restructures your project from Vite/React Router conventions to Next.js App Router:
```bash Before (React + Vite) theme={null}
src/
├── App.tsx
├── main.tsx
├── components/
│ ├── Header.tsx
│ └── Navigation.tsx
├── pages/
│ ├── Home.tsx
│ ├── About.tsx
│ └── Contact.tsx
├── hooks/
│ └── useAuth.ts
└── styles/
└── index.css
```
```bash After (Next.js App Router) theme={null}
app/
├── layout.tsx
├── page.tsx # Home
├── about/
│ └── page.tsx
├── contact/
│ └── page.tsx
└── globals.css
components/
├── Header.tsx
└── Navigation.tsx
hooks/
└── useAuth.ts
```
## Automatic 'use client' Detection
The CLI analyzes your code and adds the 'use client' directive when needed:
* React hooks (`useState`, `useEffect`, etc.)
* Event handlers (`onClick`, `onChange`)
* Browser APIs (`window`, `document`, `localStorage`)
* Third-party client libraries
* Pure presentational components
* Data fetching
* Async components
* No browser APIs used
## TypeScript Preservation
All TypeScript types are maintained:
* Interface definitions
* Generic types
* Type aliases
* Prop types
* Return types
* Import types
## What's Not Converted (By Design)
These remain unchanged and work as-is:
* API calls (fetch, axios, etc.)
* State management libraries (Redux, Zustand, etc.)
* UI libraries (shadcn/ui, Material-UI, etc.)
* Form libraries (React Hook Form, Formik, etc.)
* Date libraries (date-fns, moment, etc.)
* Testing code (Jest, Testing Library, etc.)
Want to see what **breaks**? Check out [What Breaks](/cli/what-breaks).
# Cloud Migration Overview
Source: https://docs.nextlovable.com/cloud-migration/index
Infrastructure independence from Lovable's managed backend. Migrate to your own Supabase project using our Chrome Extension.
# The Escape Hatch
Use our Chrome Extension to migrate from Lovable's proprietary Supabase instance to your own Supabase project. Full data ownership, custom RLS policies, and production-ready infrastructure. Self-service migration completes in under 5 minutes.
## Two Tiers: Choose Your Complexity
**Best for: MVPs, side projects**
* Up to 50 tables
* Standard auth only
* Automatic migration via Chrome Extension
* DIY troubleshooting
* Completes in under 5 minutes
**Best for: Production apps**
* Unlimited complexity
* External APIs & webhooks (Stripe, OpenAI, etc.)
* Complex RLS policies
* We handle edge cases
* Custom SQL triggers
* Priority support
## Quick Check: Which Tier Fits You?
* [ ] I have fewer than 50 tables
* [ ] No complex external integrations (Stripe, OpenAI, etc.)
* [ ] I can handle manual fixes if needed
**All checked?** → **Self-Service (\$99)**
**Any unchecked?** → **White-Glove (€850+)**
## Prerequisites
Not sure if your project is "simple" or "complex"?
**If you have 100+ tables** or integrations with Stripe, OpenAI, or other external APIs, **skip to the White-Glove option**.
Create a new Supabase project at [supabase.com](https://supabase.com) if you haven't already.
You'll need these credentials (used locally only):
**Location**: Supabase Dashboard → Settings → General
Looks like: `abc123def456`
**Location**: Supabase Dashboard → Account → Access Tokens
Used for authentication with the Extension
**Location**: Supabase Dashboard → Settings → API → Project API Keys
The `anon` public key
**Location**: Supabase Dashboard → Settings → API → Project API Keys
The `service_role` key. **Keep this secret!**
**Your credentials are used locally only** — they're never sent or stored anywhere. Complete privacy guaranteed.
## The Migration Process
Install the **Lovable Cloud to Supabase** Chrome Extension and connect your credentials.
[Install Extension →](https://chromewebstore.google.com/detail/lovable-cloud-to-supabase/ekleklhofagefcgokjlgcjkkmlkbdlnp)
Once connected, the extension clones your Lovable Cloud setup and deploys it to Supabase automatically.
**What's migrated:**
* **Database Schema** — Tables & rows
* **Edge Functions** — Serverless logic
* **Authentication** — Users & permissions
**Complexity Check:**
Standard schemas migrate automatically. Custom SQL triggers or complex RLS policies may need manual review.
**Migration typically completes in under 5 minutes.** You'll receive a notification when it's ready.
Your project is now running on Supabase with all your data, functions, and users migrated successfully.
## What's Included
Every table, every row, every relationship:
* PostgreSQL schema recreation
* Data integrity validation
* Index and constraint preservation
* Enum and custom type migration
Serverless logic preserved:
* Function code migration
* Environment variables
* Secrets management
* Trigger reconfiguration
User accounts transferred:
* Email/password accounts
* User metadata preservation
* OAuth provider identities (reconfiguration required)
* Password reset flow guidance
## What's NOT Included (Manual Steps)
These require manual action after migration:
**Storage is NOT automatically migrated.**
After migration, you'll need to:
* Create new storage buckets in your Supabase
* Upload files manually or via script
* Update file references in your database
[Learn more about Storage Migration](/cloud-migration/post-migration#storage)
Standard RLS policies migrate automatically.
**Complex policies may need manual review:**
* Policies with custom SQL functions
* Multi-table policy dependencies
* Complex permission logic
Third-party services require manual reconfiguration:
* Stripe webhooks
* OpenAI API keys
* Custom payment processors
* External auth providers
## Post-Migration Checklist
After migration completes, complete these steps to go live:
If your project uses AI features:
* Move to OpenRouter (recommended) or your preferred provider
* Update your API key in Supabase environment variables
Copy your environment variables from Lovable to Supabase:
* Go to Supabase Dashboard → Settings → API
* Add all required env vars
OAuth providers need reconfiguration:
* Google, GitHub, Apple, etc.
* Update callback URLs to your Supabase project
* Test login flow
Move files to Supabase Storage:
* Create buckets matching your old structure
* Upload files
* Update database references
[Storage Migration Guide →](/cloud-migration/post-migration#storage)
## Need Help with Complex Logic?
If your project has:
* 100+ tables
* Stripe, OpenAI, or other external integrations
* Complex custom SQL
* Custom RLS policies
We handle it all for you.
[Book a Consultation →](https://cal.com/chiheb-nabil/next.js-migration-help-done-for-you-service)
## Next Steps
Start your \$99 Self-Service migration
Book consultation for complex migrations
Complete your migration setup
**Just need the frontend code?** Start with the [CLI](/cli) to convert your React app to Next.js first.
# Migration Process
Source: https://docs.nextlovable.com/cloud-migration/migration-process
Step-by-step walkthrough of the Cloud Migration process
# Migration Process
Here's exactly what happens during your Cloud Migration. No surprises, no black boxes.
## Pre-Migration Phase
**Before we start, we understand your app:**
* Table count and complexity
* RLS policy overview
* Auth configuration
* Edge Functions
* Custom requirements
* Timeline expectations
**Deliverable**: Migration plan document
**You provide secure access:**
* Lovable project details (read-only access)
* Supabase credentials (from your new project)
* Any special configurations
* Emergency contact information
**Security**: All credentials encrypted, access logged, rotated post-migration
**We create safety nets:**
* Full database dump from Lovable
* Auth user export
* Configuration snapshots
**These backups stay with you** for 30 days post-migration
## Migration Execution
**Deep dive into your database:**
1. **Table inventory**
* List all 370 tables (or however many you have)
* Document relationships
* Identify circular dependencies
* Map foreign key chains
2. **Constraint mapping**
* Primary keys
* Foreign keys
* Unique constraints
* Check constraints
* Exclusion constraints
3. **Index audit**
* All indexes documented
* Usage patterns analyzed
* Performance critical indexes flagged
4. **Dependency graph**
* Visual map of table relationships
* Migration order determined
* Risk points identified
**Deliverable**: Schema documentation with ER diagram
**Practice run on subset:**
1. **Create test tables** (10-20 representative tables)
2. **Migrate test data** (1000-5000 rows)
3. **Verify constraints** (foreign keys, uniqueness)
4. **Test RLS policies** (security validation)
5. **Check data integrity** (row counts, checksums)
6. **Document issues** (edge cases, problems)
**Why test first?** Catch problems before touching production data
**Recreate database structure:**
```sql theme={null}
-- Example of what we generate
CREATE TABLE public.profiles (
id uuid DEFAULT uuid_generate_v4() PRIMARY KEY,
user_id uuid REFERENCES auth.users(id) ON DELETE CASCADE,
full_name text,
avatar_url text,
created_at timestamp with time zone DEFAULT now(),
updated_at timestamp with time zone DEFAULT now()
);
CREATE INDEX idx_profiles_user_id ON public.profiles(user_id);
```
**Order matters**:
1. Extensions and custom types
2. Base tables (no foreign keys)
3. Junction/link tables
4. Tables with foreign keys (dependency order)
5. Indexes
6. Triggers
7. Functions
**Validation**: Every table created, every constraint applied
**The heavy lifting:**
**Strategy by table size**:
| Table Size | Method | Time |
| ------------- | -------------------------------- | --------- |
| \< 10K rows | Single INSERT | Minutes |
| 10K-100K rows | Batched INSERT (1000 row chunks) | 15-30 min |
| 100K-1M rows | COPY command + validation | 1-2 hours |
| > 1M rows | Parallel streams + checkpointing | 2-4 hours |
**Process**:
1. Extract from Lovable (read-only, no downtime)
2. Transform (data type conversions if needed)
3. Load into your Supabase
4. Verify (row counts, sample checks)
5. Repeat for next batch
**Handling issues**:
* Foreign key violations → Fix order or temporarily disable
* Data type mismatches → Convert/transform
* Timeout errors → Reduce batch size
* Connection drops → Resume from checkpoint
**Security model transfer:**
```sql theme={null}
-- Extract from Lovable
SELECT * FROM pg_policies WHERE schemaname = 'public';
-- Recreate in your project
CREATE POLICY "Users can view own profile"
ON public.profiles FOR SELECT
USING (auth.uid() = user_id);
```
**Steps**:
1. Extract all policies from source
2. Analyze policy logic
3. Recreate in target (in dependency order)
4. Enable RLS on all tables
5. Test each policy with real queries
6. Document any logic changes
**Testing approach**:
* Sign in as test users
* Attempt SELECT/INSERT/UPDATE/DELETE
* Verify access is correctly restricted
* Check edge cases (null users, deleted records)
**User account transfer:**
**What transfers**:
* User IDs (UUIDs preserved)
* Email addresses
* Email confirmation status
* User metadata (JSONB)
* OAuth identities
* Account creation dates
**What doesn't** (technical limitation):
* Passwords (hashed, can't decrypt)
* Active sessions
* MFA settings
**Process**:
1. Export user list from Lovable
2. Import users to your Supabase
3. Preserve OAuth identities
4. Set up password reset flow
5. Configure email templates
6. Test sign-in with sample accounts
**Communication plan**:
* Pre-migration email: "We're upgrading our infrastructure"
* Post-migration email: "Please reset your password"
* FAQ page for common questions
**Serverless logic migration:**
**Edge Functions**:
1. Extract function code
2. Resolve dependencies
3. Update environment variables
4. Deploy to your project
5. Test execution
**Database Triggers**:
1. Extract trigger definitions
2. Migrate trigger functions
3. Recreate triggers in dependency order
4. Test trigger execution
5. Verify business logic
**Validation**:
* Functions execute without errors
* Environment variables resolved
* Secrets properly configured
* Triggers fire correctly
## Post-Migration Phase
**Comprehensive verification:**
**Data integrity checks**:
* [ ] Row counts match for every table
* [ ] Sample data verified (100+ random rows)
* [ ] Foreign keys resolve correctly
* [ ] No orphaned records
* [ ] Constraints enforced
**Security validation**:
* [ ] All RLS policies active
* [ ] Policies tested with real users
* [ ] No unauthorized access possible
**Functionality testing**:
* [ ] User sign-up works
* [ ] User sign-in works
* [ ] OAuth providers connect
* [ ] Realtime subscriptions work
* [ ] Edge functions execute
**Performance baseline**:
* [ ] Query performance measured
* [ ] Index usage verified
* [ ] Slow queries identified
**Complete migration package:**
You receive:
* **Migration Report**: What was migrated, validation results
* **Schema Documentation**: ER diagram, table descriptions
* **RLS Policy Summary**: All security rules documented
* **Connection Details**: All URLs and keys
* **Environment File**: Ready-to-use `.env.local`
* **Testing Results**: Validation logs
* **User Communication Templates**: Email copy for your users
* **Rollback Instructions**: How to revert if needed
**We stay on standby:**
* Monitor error logs
* Watch for performance issues
* Provide hotfixes if needed
## Timeline Summary
| Phase | Duration | Cumulative |
| --------------- | ----------- | ---------- |
| Pre-migration | 1 day | Day 1 |
| Schema analysis | 4 hours | Day 1-2 |
| Test migration | 8 hours | Day 2 |
| Full migration | 12-24 hours | Day 3-4 |
| Validation | 4 hours | Day 4 |
| Handoff | 1 hour | Day 4 |
| Monitoring | 48 hours | Days 4-6 |
**Total: 4-6 days from kickoff to completion**
## Communication During Migration
You'll receive updates at each milestone:
* ✅ Schema analysis complete
* ✅ Test migration successful
* 🔄 Full migration in progress (progress %)
* ✅ Data migration complete
* ✅ RLS policies migrated
* ✅ Auth system ready
* ✅ Validation passed
* 📋 Documentation delivered
# Supabase Setup
Source: https://docs.nextlovable.com/cloud-migration/supabase-setup
Preparing your new Supabase project for migration
# Supabase Setup
Before we begin the migration, you need a Supabase project ready to receive your data. Here's how to set it up.
## Step 1: Create Your Supabase Account
Go to [supabase.com](https://supabase.com) and create an account.
**Recommendation**: Use the same email as your Lovable account for easier tracking.
Check your email and click the verification link.
Choose your plan:
* **Free Tier**: Good for testing (500MB database, 1GB storage)
* **Pro (\$25/month)**: Production-ready (8GB database, 100GB storage)
* **Team/Enterprise**: Contact Supabase for larger needs
## Step 2: Create a New Project
From your Supabase dashboard, click the "New Project" button.
**Organization**: Your company or personal org
**Project Name**: Choose something descriptive
* Good: `myapp-production`
* Good: `crm-migrated`
* Avoid: `test`, `new-project`
**Database Password**:
* Generate a strong password
* Save it in your password manager
* You'll need this for direct database access
**Region**:
* Choose closest to your users
* Consider data residency requirements
* Common choices: US East (N. Virginia), EU (Frankfurt), Asia (Singapore)
Supabase will create your project. This takes 2-3 minutes.
You'll see a loading screen—don't close it.
## Step 3: Gather Connection Information
Once your project is created, we need these details:
**Location**: Project Settings → API
**Format**: `https://[project-ref].supabase.co`
**Example**: `https://abc123def456.supabase.co`
**We need this for**: API calls, storage access
**Location**: Project Settings → API → Project API Keys
**Format**: `eyJhbGciOiJIUzI1NiIs...`
**We need this for**: Client-side authentication
**Location**: Project Settings → API → Project API Keys
**⚠️ Keep this secret!** Never expose in client code.
**We need this for**: Admin operations during migration
**You created this** during project setup.
**We need this for**: Direct PostgreSQL access
**Share securely**: Send these credentials via encrypted channel (1Password, secure email, or scheduled call). Never post in public channels.
## Step 4: Configure Your Project
### Enable Required Extensions
Go to **Database → Extensions** and enable these (if your app uses them):
* `uuid-ossp` - UUID generation (most apps need this)
* `pgcrypto` - Cryptographic functions
* `pg_trgm` - Trigram matching for search
* `postgis` - Geographic data
* `pgvector` - Vector similarity search
* `pg_stat_statements` - Query performance
### Set Up Authentication Providers
If you use social login:
Enable the providers your app uses (Google, GitHub, Apple, etc.)
For each provider:
* Create OAuth app in provider console
* Add callback URL: `https://[project-ref].supabase.co/auth/v1/callback`
* Copy Client ID and Secret to Supabase
We'll verify OAuth works during migration testing.
### Configure Storage (Optional)
If you want specific storage settings:
Default policies are created automatically, but you can customize.
For client-side uploads from specific domains.
Supabase provides CDN by default. Contact them for custom domains.
## Step 5: Prepare for Migration
* [ ] Supabase account created
* [ ] New project provisioned
* [ ] Region selected (close to users)
* [ ] Required extensions enabled
* [ ] Auth providers configured (if using OAuth)
* [ ] Service role key secured
* [ ] Database password saved
* [ ] Project URL documented
## Security Checklist
**Before sharing credentials with us:**
We'll set this up during migration, but verify it's available.
Go to **Database → Tables** and check that new tables will have RLS.
* **Anon key**: Safe for client-side code
* **Service role key**: NEVER in client code, only server-side
Supabase automatically backs up Pro+ projects.
Go to **Database → Backups** to verify schedule.
Protect your Supabase dashboard access.
Go to **Account Settings → Security**.
## What Happens Next
Once you've completed setup:
1. **Send us your credentials** (securely)
2. **We'll schedule the migration** (usually within 48 hours)
3. **We'll run a test migration** on a subset of data
4. **You'll review the results** and approve
5. **We'll execute the full migration**
6. **You'll update your app** with new connection strings
7. **We'll monitor for 48 hours** to ensure stability
## Post-Migration Connection Details
After migration, you'll need to update your app with these values:
```bash theme={null}
# Your new Supabase project details
NEXT_PUBLIC_SUPABASE_URL=https://[your-project-ref].supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGci...
SUPABASE_SERVICE_ROLE_KEY=eyJhbGci...
# Direct database connection (if needed)
DATABASE_URL=postgresql://postgres:[password]@db.[project-ref].supabase.co:5432/postgres
```
**Questions about setup?** Contact us at [support@nextlovable.com](mailto:support@nextlovable.com) or check [Supabase's documentation](https://supabase.com/docs).
# What's Included
Source: https://docs.nextlovable.com/cloud-migration/what-included
Complete breakdown of what's migrated from Lovable's Supabase to your own
# What's Included
Every component of your Lovable backend is migrated to your own Supabase project. Here's the complete breakdown.
## Database Migration
**All database objects recreated:**
* Tables (all 370 of them, if that's your case)
* Columns with correct data types
* Primary keys
* Foreign key relationships
* Unique constraints
* Check constraints
* Default values
* Auto-increment sequences
**What stays identical:**
* Table names
* Column names
* Data types
* Relationships
**What we validate:**
* Row counts match
* Foreign keys resolve correctly
* Constraints are enforced
**Data transferred with validation:**
* All rows migrated
* Binary data preserved (images, files metadata)
* JSON/JSONB fields intact
* Arrays maintained
* Timestamps converted correctly
* UUIDs preserved
**Validation process:**
* Row count verification
* Sample data checks
* Relationship integrity tests
* Constraint validation
Complex types handled correctly:
* `uuid` → Preserved
* `timestamp with time zone` → Maintained
* `json` / `jsonb` → Intact
* Arrays (`text[]`, `int[]`) → Preserved
* Custom enums → Recreated
* `geometry` (PostGIS) → Migrated with extension
Database performance preserved:
* B-tree indexes
* GIN indexes (for JSON/text search)
* GiST indexes (for PostGIS)
* Composite indexes
* Partial indexes
* Index names maintained
## Row Level Security (RLS)
Every RLS policy from your Lovable database is ported to your new Supabase project.
### What Gets Ported
**Complete policy recreation:**
* Policy names
* Target tables
* Operation types (SELECT, INSERT, UPDATE, DELETE)
* Using expressions (the `USING` clause)
* With check expressions (the `WITH CHECK` clause)
* Policy roles
```sql theme={null}
-- Example policy that gets migrated
CREATE POLICY "Users can only see their own data"
ON public.profiles
FOR SELECT
USING (auth.uid() = user_id);
```
Custom functions referenced in policies:
* `auth.uid()` calls
* `auth.role()` references
* Custom security functions
* Helper functions for complex logic
**We verify every policy works:**
* Test queries as different users
* Verify access restrictions
* Check insert/update permissions
* Validate delete protections
* Document any edge cases
## Authentication Migration
**Important**: User sessions cannot be migrated. Password resets required.
### What Transfers
**Account metadata migrated:**
* User IDs (UUIDs preserved)
* Email addresses
* Email confirmation status
* Phone numbers (if used)
* User metadata (custom fields)
* Account creation timestamps
* Last sign-in timestamps
* OAuth provider identities
**What doesn't transfer:**
* Passwords (hashed, cannot be decrypted)
* Current sessions
* Refresh tokens
* MFA settings (must be reconfigured)
**Social auth preserved:**
* Google OAuth links
* GitHub connections
* Apple sign-in
* Any other configured providers
**What we do:**
* Recreate OAuth app configurations
* Update callback URLs
* Test provider connections
* Verify identity linking
**Seamless transition strategy:**
* Pre-migration email to users
* Post-migration reset trigger
* Magic link option for immediate access
* Clear communication templates
## Edge Functions
**Serverless functions transferred:**
* Function code
* Environment variables
* Secrets/keys
* Import maps
* Dependencies
**What we handle:**
* Code extraction
* Dependency resolution
* Environment setup
* Deployment to your project
* Testing and validation
**Database triggers preserved:**
* Insert triggers
* Update triggers
* Delete triggers
* Function bindings
* Trigger conditions
## Database Functions
**Custom functions migrated:**
* Function definitions
* Parameters and return types
* PL/pgSQL logic
* SQL functions
* Trigger functions
```sql theme={null}
-- Example function that gets migrated
CREATE OR REPLACE FUNCTION update_updated_at_column()
RETURNS TRIGGER AS $$
BEGIN
NEW.updated_at = NOW();
RETURN NEW;
END;
$$ language 'plpgsql';
```
**PostgreSQL extensions:**
* `uuid-ossp` (UUID generation)
* `pgcrypto` (cryptographic functions)
* `postgis` (geographic data)
* `pg_trgm` (trigram matching)
* Any other enabled extensions
## Realtime Subscriptions
* Publication settings
* Table subscriptions
* Event filters
* Broadcast configuration
* Channel setup
* Event handlers
* Reconnection logic
* Filter policies
## Post-Migration Deliverables
After migration completes, you receive:
* [ ] **Migration Report**: Complete audit of what was migrated
* [ ] **Schema Documentation**: ER diagrams and table descriptions
* [ ] **RLS Policy Summary**: All security rules documented
* [ ] **Connection Strings**: Database, API URLs
* [ ] **Environment Variables**: Complete `.env` file for your app
* [ ] **Testing Results**: Validation that everything works
* [ ] **User Communication Templates**: Password reset emails
* [ ] **Rollback Plan**: Instructions if you need to revert
## What's NOT Included
Be aware of these limitations:
Cannot be migrated (hashed, one-way encryption).
**Workaround**: Password reset flow
Current user sessions don't transfer.
**Workaround**: Users sign in again
Any proprietary Lovable services.
**Workaround**: Replace with standard alternatives
External services not part of Supabase.
**Workaround**: Migrate separately or keep separate
## Validation Checklist
We verify every component:
| Component | Validation Method |
| -------------- | -------------------- |
| Tables | Row count comparison |
| Data | Sample verification |
| Relationships | Foreign key checks |
| RLS Policies | Permission testing |
| Auth Users | Account verification |
| Edge Functions | Execution tests |
| Functions | Output validation |
## Timeline
Typical migration timeline:
* **Small app** (10-50 tables): 1-2 days
* **Medium app** (50-200 tables): 2-3 days
* **Large app** (200+ tables): 3-5 days
* **Complex app** (370+ tables): 5-7 days
Includes: discovery, migration, testing, and handoff.
Ready to start? [Set up your Supabase project](/cloud-migration/supabase-setup) or learn [why this costs 3 credits](/cloud-migration/why-3-credits).
# Why 3 Credits?
Source: https://docs.nextlovable.com/cloud-migration/why-3-credits
Understanding the value behind Cloud Migration pricing
# Why 3 Credits Costs 3x More
Complex migrations aren't about running a script—they're about preserving relationships, security policies, and business logic that grew organically. One wrong move and months of user data could be at risk.
## The Real Cost Breakdown
Here's where your 3 credits (\$237) go:
**Before touching anything, we map the battlefield:**
* Schema inventory (every table, column, relationship)
* RLS policy audit (security vulnerabilities)
* Data volume assessment (GB to transfer)
* Complexity scoring (simple vs. nested relationships)
* Risk identification (what could break)
* Migration strategy (order of operations)
**Time invested**: 2-4 hours of expert analysis
**Recreating your database structure:**
* Table definitions (potentially hundreds of create statements)
* Foreign key relationships (mapping web of connections)
* Constraints & indexes (performance preservation)
* Custom types & enums (PostgreSQL specifics)
* Triggers & functions (business logic)
**What goes wrong without this**:
* Foreign key conflicts
* Constraint violations
* Data type mismatches
* Index corruption
**The heavy lifting:**
* Batch extraction (not dumping everything at once)
* Relationship preservation (parent→child integrity)
* Binary data handling (images, files)
* JSON/JSONB integrity (complex nested data)
* Validation checks (every row verified)
* Error recovery (what if transfer fails mid-way?)
**Time invested**: 4-8 hours of careful transfer
**RLS policies—where most migrations fail:**
* Policy extraction (parsing SQL logic)
* Security function migration (custom auth logic)
* Permission testing (verify it actually works)
* Vulnerability audit (are you more secure or less?)
* Edge case testing (what about null users?)
**Why this matters**:
* One broken policy = data exposure
* One missing policy = unauthorized access
* One logic error = app broken for users
**User experience preservation:**
* Account migration (metadata, OAuth links)
* Password reset strategy (communication plan)
* Testing user flows (sign-in, sign-up, recovery)
**The human factor**:
* Users need to reset passwords
* Email templates need updating
* Support documentation required
## What Could Go Wrong (DIY Migration)
**Scenario**: You dump and restore without checking foreign keys.
**Result**: Orphaned records, broken relationships, app crashes.
**Cost to fix**: 40+ hours of manual cleanup, lost user trust.
**Scenario**: RLS policies don't transfer correctly.
**Result**: Users see each other's data. GDPR violation. Legal liability.
**Cost to fix**: Incident response, legal review, reputation damage.
**Scenario**: OAuth providers not reconfigured properly.
**Result**: Users can't log in. Support tickets flood in. Churn spikes.
**Cost to fix**: Emergency hotfix, 24/7 support, lost revenue.
**Scenario**: Indexes not recreated. Queries that took 50ms now take 5s.
**Result**: App feels broken. Users leave. SEO rankings drop.
**Cost to fix**: Performance audit, query optimization, re-indexing.
**Scenario**: You migrate 300 tables but miss 70.
**Result**: App works... mostly. Features randomly break. Data inconsistency.
**Cost to fix**: Weeks of debugging, user complaints, patchwork fixes.
## Why Complex Migrations Need Expert Handling
Complex migrations aren't just about moving data—they're about preserving relationships, security, and business logic that grew organically over months or years.
**What makes migrations complex**:
1. **Deep Relationships**: Foreign keys spanning dozens of tables
* One wrong order = orphaned records
* Circular dependencies require careful sequencing
* Self-referencing tables need special handling
2. **RLS Policy Complexity**: Security rules that reference multiple tables
* Policies spanning junction tables
* Custom security functions
* Permission dependencies
3. **Business Logic in Database**: Functions and triggers
* Automated workflows
* Data validation rules
* Audit logging
4. **Scale Matters**:
* More tables = more things that can go wrong
* More data = longer transfer time = more risk
* More users = less tolerance for downtime
**What the 3 credits cover**:
* **Analysis & Planning** (0.5 credits): Understanding your schema
* **Schema Migration** (0.5 credits): Recreating structure safely
* **Data Transfer** (1 credit): Moving data with validation
* **Security Migration** (0.5 credits): Porting RLS without gaps
* **Auth & Testing** (0.5 credits): Users and verification
**The alternative**: DIY migration that could take weeks, risk data loss, or break security.
## What You Get for 3 Credits
Not just a migration. A **complete infrastructure handoff**:
Complete audit trail:
* Every table migrated
* Row counts verified
* Relationship map
* RLS policy summary
* Testing results
Your database documented:
* ER diagrams
* Table descriptions
* Column definitions
* Index explanations
* Function docs
Ready-to-use configuration:
* Connection strings
* Environment variables
* API endpoints
* Webhook configs
Validation that it works:
* Automated tests
* Manual verification
* Security audit
* Performance baseline
* Edge case coverage
User transition support:
* Password reset emails
* Migration announcement
* FAQ document
* Support responses
Safety net:
* Revert instructions
* Backup locations
* Emergency contacts
* Recovery timeline
## Compare the Alternatives
| Approach | Cost | Risk | Time | Result |
| ----------------------------- | --------------- | ------ | --------- | ---------------- |
| **Our Migration** (3 credits) | \$237 | Low | 2-5 days | Production-ready |
| **Hire Developer** | \$3,000+ | Medium | 1-2 weeks | Variable quality |
| **DIY Migration** | \$0 (your time) | High | 3-4 weeks | Unknown |
| **Stay on Lovable** | \$0 | Medium | — | Locked in |
**DIY hidden costs**:
* Your time: 80-120 hours × $100/hour = $8,000-12,000
* Opportunity cost: Features not built
* Risk: Data loss (incalculable)
* Stress: Learning migration tools under pressure
## Who Needs This?
**The situation**: Built MVP in Lovable, now need to launch.
**Why 3 credits**: Can't launch on shared infrastructure. Need:
* Dedicated resources
* Custom domain
* Direct database access
* Full control
**The alternative**: Stay on Lovable, hit limits, migrate in crisis.
**The situation**: 100+ tables, hitting Lovable constraints.
**Why 3 credits**: Need advanced features:
* Custom PostgreSQL extensions
* Complex RLS policies
* Real-time at scale
* Edge functions
**The alternative**: Patchwork solutions, technical debt, slow performance.
**The situation**: Compliance, security, audit requirements.
**Why 3 credits**: Can't use shared backend:
* SOC 2 requirements
* Data residency needs
* Security audits
* SLA guarantees
**The alternative**: Rebuild from scratch (3-6 months, \$50K+).
## The Bottom Line
You're not paying for a script. You're paying for:
* 15+ years of combined database experience
* Tested migration processes
* Error handling and recovery
* Validation and verification
* Documentation and handoff
**Questions to ask yourself**:
1. What's the cost of losing even 1% of your data?
2. How many hours can your team afford to spend on migration?
3. What's the risk of breaking RLS and exposing user data?
4. Can you afford downtime while you figure it out?
If the answer to any of these makes you nervous, the 3 credits are worth it.
Still deciding? [See what's included](/cloud-migration/what-included) or [set up your Supabase project](/cloud-migration/supabase-setup) to get started.
# Choose Your Migration
Source: https://docs.nextlovable.com/index
Find the right solution for escaping Lovable's walled garden
# What's Your Situation?
You've built something great in Lovable. Now you need to **escape the walled garden**.
Pick the pain point that matches your situation:
**You need the CLI**
Your app is stuck in Lovable's ecosystem. Convert your React Router code to Next.js App Router and own your frontend. No more platform lock-in.
1 Credit (\$39)
**You need the Cloud Migration Extension**
You're still using Lovable's managed Supabase. Use our Chrome Extension to migrate to your own Supabase project with full data, auth users, and RLS policies. Completes in under 5 minutes.
From \$99
**You need the SEO Builder Extension**
Already migrated to Next.js but still invisible to search engines? Use our Chrome Extension to prerender your app and deploy to Vercel. New users get 1 free credit.
1 Free Credit for New Users
**Done-For-You Complete Stack**
We handle the CLI conversion, Cloud Migration, and Prerendering setup. You get a Next.js app on your own infrastructure that actually ranks.
\$850+
## The Decision Tree
Are you still on Lovable's managed Supabase, or do you already have your own?
Do you have the code exported, or are you still trying to get it out of Lovable?
Is Google indexing your pages, or do you see "Lovable builds SPAs" warnings in Search Console?
## The Three Liberation Stages
**The CLI** — Stop waiting for Lovable to export.
Convert your React Router app to Next.js App Router. Get instant control over your code.
* **What converts**: React hooks, Tailwind classes, React Router patterns
* **What breaks**: Lovable's magic components, hardcoded API calls
* **Time to escape**: 5 minutes
* **Cost**: 1 credit
[Start with CLI →](/cli)
**Cloud Migration Extension** — Infrastructure independence.
Use our Chrome Extension to migrate from Lovable's Supabase to your own. Self-service migration completes in under 5 minutes for simple projects.
* **Self-Service (\$99)**: Up to 50 tables, automatic migration
* **White-Glove (€850+)**: Complex projects with external APIs (Stripe, OpenAI)
* **How it works**: Chrome Extension clones your setup to Supabase
* **Caveat**: Storage requires manual migration, users need password reset
[Get the Extension →](https://chromewebstore.google.com/detail/lovable-cloud-to-supabase/ekleklhofagefcgokjlgcjkkmlkbdlnp)
**SEO Builder Extension** — The difference between migrated and production-ready.
Lovable builds SPAs. Google sees blank pages. Use our Chrome Extension to prerender your app and auto-deploy to Vercel.
* **The problem**: `next build` generates static HTML, but dynamic routes need help
* **The solution**: Chrome Extension prerenders your routes and deploys to Vercel
* **Free tier**: New users get 1 free credit to try it out
* **Credits**: Additional credits for more deployments
[Get the Extension →](https://chromewebstore.google.com/detail/lovable-seo-builder/jkbedjnpcldmnoifajhldbipmlbmgfkl)
## Credit Clarity
React → Next.js conversion. Stays on Lovable's backend. Perfect for developers who want control of their frontend code.
Chrome Extension for Supabase migration. Up to 50 tables, completes in under 5 minutes. For complex projects (100+ tables, external APIs), White-Glove service starts at €850+.
* **Free**: 1 credit for every new user
* **Paid**: Additional credits for more prerender deployments
* Chrome Extension prerenders and deploys to Vercel automatically
All three stages handled for you. You get a Next.js app on your own Supabase that actually ranks on Google. This justifies the \$850+ pricing—it's not just labor, it's the complete unbundling from Lovable's ecosystem.
[Book a consultation](https://cal.com/chiheb-nabil/next.js-migration-help-done-for-you-service)
## Common Scenarios
You're building your MVP and want to own the code from day one.
**Start here**: [CLI Quick Start](/cli/quick-start)
Your app works but you're still on Lovable's infrastructure.
**Start here**: [Cloud Migration](/cloud-migration)
You migrated but Google isn't indexing your pages.
**Start here**: [Prerendering](/prerendering)
## Not Sure Where to Start?
Answer 5 questions and we'll tell you exactly what you need.
***
**All migrations include**: Free single-file testing, preview changes before applying, and detailed transformation logs.
# Migration Command
Source: https://docs.nextlovable.com/legacy/0.0.6/commands/migrate
Complete project migration from React to Next.js using version 0.0.6
**Version 0.0.6**: All operations require authentication. Consider upgrading to 0.0.7+ for free single file conversions.
## Basic Usage
Version 0.0.6 uses a simple command structure without subcommands:
```bash theme={null}
next-lovable [target-directory] [options]
```
## Examples
### Basic Migration
Migrate to a new directory:
```bash theme={null}
next-lovable ./my-react-app ./my-next-app
```
### In-Place Migration
Migrate in the same directory (be careful!):
```bash theme={null}
next-lovable ./my-react-app
```
### Preview Changes First
See what will change without making modifications:
```bash theme={null}
next-lovable ./my-react-app --dry-run
```
### Automated Migration
Skip confirmations and install dependencies:
```bash theme={null}
next-lovable ./my-react-app ./my-next-app --yes --install
```
## Command Options
Path to your React application directory. Must contain a `package.json` file with React and React Router dependencies.
**Examples:**
* `./my-react-app`
* `/path/to/react-project`
* `../frontend`
Directory where the new Next.js project will be created. If omitted, migration happens in-place in the source directory.
**Examples:**
* `./my-next-app`
* `/path/to/next-project`
* `../next-frontend`
**Note:** Directory will be created if it doesn't exist.
Simulate the migration without making any actual changes. Shows you exactly what files will be created, modified, or removed.
**Example:**
```bash theme={null}
next-lovable ./my-app --dry-run
```
**Output includes:**
* List of files to be converted
* New file structure
* Dependencies to be added/removed
* Configuration changes
Skip all confirmation prompts and proceed with migration automatically.
**Example:**
```bash theme={null}
next-lovable ./my-app ./next-app --yes
```
**Use with caution** - this will proceed without asking for confirmation.
Automatically install dependencies after migration completes.
**Example:**
```bash theme={null}
next-lovable ./my-app ./next-app --install
```
Equivalent to running `npm install` in the target directory after migration.
Show help information and exit.
**Example:**
```bash theme={null}
next-lovable --help
```
Show version information and exit.
**Example:**
```bash theme={null}
next-lovable --version
```
## Migration Process
### What Happens During Migration
* Scans source directory for React components
* Identifies React Router usage patterns
* Analyzes component dependencies
* Checks for common React patterns
* Creates Next.js app directory structure
* Sets up layout.tsx and page.tsx files
* Organizes components appropriately
* Creates necessary configuration files
* Converts React Router to Next.js navigation
* Adds 'use client' directives where needed
* Updates import statements
* Transforms routing logic
* Generates next.config.js
* Updates package.json with Next.js scripts
* Configures TypeScript (if used)
* Sets up ESLint and other tools
### File Structure Transformation
```bash Before (React + Vite) theme={null}
my-react-app/
├── src/
│ ├── App.tsx
│ ├── main.tsx
│ ├── components/
│ │ ├── Header.tsx
│ │ └── Navigation.tsx
│ ├── pages/
│ │ ├── Home.tsx
│ │ ├── About.tsx
│ │ └── Contact.tsx
│ └── styles/
│ └── index.css
├── public/
├── package.json
└── vite.config.js
```
```bash After (Next.js App Router) theme={null}
my-next-app/
├── app/
│ ├── layout.tsx
│ ├── page.tsx
│ ├── about/
│ │ └── page.tsx
│ ├── contact/
│ │ └── page.tsx
│ └── globals.css
├── components/
│ ├── Header.tsx
│ └── Navigation.tsx
├── public/
├── package.json
└── next.config.js
```
## Code Transformations
### React Router Conversion
```tsx Before theme={null}
import { BrowserRouter, Routes, Route, Link, useNavigate } from 'react-router-dom';
function App() {
return (
} />
} />
} />
);
}
function Navigation() {
const navigate = useNavigate();
return (
);
}
```
```tsx After theme={null}
// app/layout.tsx
import Navigation from '../components/Navigation';
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
{children}
);
}
// components/Navigation.tsx
'use client';
import Link from 'next/link';
import { useRouter } from 'next/navigation';
function Navigation() {
const router = useRouter();
return (
);
}
```
### Package.json Updates
```json Before theme={null}
{
"name": "my-react-app",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.8.0"
},
"devDependencies": {
"@vitejs/plugin-react": "^3.1.0",
"vite": "^4.1.0"
}
}
```
```json After theme={null}
{
"name": "my-next-app",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"next": "^13.5.0"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "^13.5.0",
"typescript": "^5"
}
}
```
## Error Handling
The migration command includes comprehensive error handling:
### Pre-Migration Validation
* **Source directory exists** and contains a valid React project
* **Package.json validation** - ensures React and React Router are present
* **Write permissions** checked for target directory
* **Disk space** verification
* **Network connectivity** to API endpoints
### During Migration
* **Syntax error detection** - invalid components are reported
* **Dependency conflicts** - version mismatches are handled
* **File permission issues** - clear error messages
* **API failures** - network issues are reported with suggestions
### Post-Migration Verification
* **Generated code validation** - ensures TypeScript/JavaScript is valid
* **Dependency installation** - verifies all packages install correctly
* **Configuration testing** - checks Next.js config is valid
## Troubleshooting Common Issues
**Problem**: Cannot authenticate with API
**Solutions**:
1. Verify API key is correct from nextlovable.com
2. Check network connectivity
3. Try re-running `next-lovable auth`
4. Contact support if account issues persist
**Problem**: Error about source directory not existing
**Solutions**:
1. Check the path is correct: `ls -la ./my-react-app`
2. Use absolute paths if relative paths fail
3. Ensure the directory contains a package.json file
4. Verify you have read permissions
**Problem**: Cannot create target directory
**Solutions**:
1. Check write permissions in parent directory
2. Ensure sufficient disk space
3. Try using a different target location
4. Run with elevated permissions if necessary
**Problem**: Migration stops partway through
**Solutions**:
1. Check error messages for specific issues
2. Ensure stable network connection
3. Try migration without `--install` flag first
4. Run `--dry-run` to identify potential issues
**Problem**: `npm run dev` fails in migrated project
**Solutions**:
1. Run `npm install` to ensure dependencies
2. Check for TypeScript errors: `npx tsc --noEmit`
3. Clear Next.js cache: `rm -rf .next`
4. Review next.config.js for issues
## Best Practices
Use `--dry-run` to preview changes before applying them
Commit to git or create a backup before migration
Test the migrated app thoroughly before deployment
Check the converted components for any needed adjustments
## Migration Checklist
* [ ] Backup original project
* [ ] Verify authentication works
* [ ] Run dry-run to preview changes
* [ ] Check disk space and permissions
* [ ] Monitor for error messages
* [ ] Ensure stable network connection
* [ ] Don't interrupt the process
* [ ] Install dependencies if not done automatically
* [ ] Test development server starts
* [ ] Verify all routes work correctly
* [ ] Check for TypeScript/linting errors
* [ ] Test build process
## Upgrading to Version 0.0.7+
Consider upgrading for enhanced features:
Single file conversions without authentication
Subcommand structure with more options
Choose specific transformations to apply
Faster processing and better error handling
## Need Help?
Common issues and solutions
Report bugs and request features
# Troubleshooting
Source: https://docs.nextlovable.com/legacy/0.0.6/guides/troubleshooting
Common issues and solutions when using next-lovable version 0.0.6
## Common Issues in Version 0.0.6
### Authentication Problems
**Problem**: Authentication fails with "Invalid API key" or similar errors
**Solutions**:
1. **Verify API key is correct**:
* Log into [nextlovable.com](https://nextlovable.com)
* Go to your dashboard
* Copy the API key exactly (no extra spaces)
2. **Re-run authentication**:
```bash theme={null}
next-lovable auth
```
Paste the API key when prompted
3. **Check account status**:
* Ensure your account is active
* Verify you have credits remaining
* Check for any billing issues
4. **Network connectivity**:
```bash theme={null}
curl -I https://api.nextlovable.com/health
```
Should return a 200 status code
**Problem**: Previously working authentication suddenly fails
**Solutions**:
1. **Re-authenticate**:
```bash theme={null}
next-lovable auth
```
2. **Check token storage**:
```bash theme={null}
# Check if config exists
ls -la ~/.next-lovable/
```
3. **Clear stored credentials and re-auth**:
```bash theme={null}
rm -rf ~/.next-lovable/
next-lovable auth
```
**Problem**: Cannot connect to authentication servers
**Solutions**:
1. **Check firewall settings**:
* Ensure outbound HTTPS (port 443) is allowed
* Whitelist `*.nextlovable.com` domains
2. **Corporate proxy**:
```bash theme={null}
# Set proxy if needed
export HTTPS_PROXY=http://proxy.company.com:8080
next-lovable auth
```
3. **Test connectivity**:
```bash theme={null}
ping api.nextlovable.com
curl -v https://api.nextlovable.com
```
### Installation Issues
**Problem**: After installation, running `next-lovable` shows "command not found"
**Solutions**:
1. **Restart your terminal** - This refreshes the PATH
2. **Check installation location**:
```bash theme={null}
npm list -g next-lovable
which next-lovable
```
3. **Verify npm global bin is in PATH**:
```bash theme={null}
npm config get prefix
echo $PATH
```
The npm prefix path should be in your PATH
4. **Add npm global bin to PATH** (if missing):
```bash theme={null}
# For bash/zsh
echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
```
5. **Use npx as alternative**:
```bash theme={null}
npx next-lovable@0.0.6 ./my-app
```
**Problem**: `next-lovable --version` shows wrong version
**Solutions**:
1. **Uninstall and reinstall specific version**:
```bash theme={null}
npm uninstall -g next-lovable
npm install -g next-lovable@0.0.6
```
2. **Clear npm cache**:
```bash theme={null}
npm cache clean --force
npm install -g next-lovable@0.0.6
```
3. **Check for multiple installations**:
```bash theme={null}
# Find all installations
find / -name "next-lovable" 2>/dev/null
which -a next-lovable
```
**Problem**: Errors about Node.js version being incompatible
**Solutions**:
1. **Check Node.js version**:
```bash theme={null}
node --version
```
Version 0.0.6 requires Node.js 16.x or higher
2. **Update Node.js**:
* Visit [nodejs.org](https://nodejs.org/) for official installer
* Or use nvm: `nvm install 18 && nvm use 18`
3. **For Ubuntu/Debian**:
```bash theme={null}
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
```
### Migration Issues
**Problem**: Tool doesn't recognize your React project
**Solutions**:
1. **Verify package.json exists and contains React**:
```bash theme={null}
cat package.json | grep -E "(react|react-dom|react-router)"
```
2. **Check for required dependencies**:
```json theme={null}
{
"dependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-router-dom": "^5.0.0 || ^6.0.0"
}
}
```
3. **Install missing dependencies**:
```bash theme={null}
npm install react react-dom react-router-dom
```
4. **Check project structure**:
Ensure you have components or pages that use React Router
**Problem**: Migration stops due to syntax errors in source files
**Solutions**:
1. **Fix syntax errors first**:
```bash theme={null}
# Check for TypeScript errors
npx tsc --noEmit
# Check for ESLint errors
npx eslint src/
```
2. **Common syntax issues in v0.0.6**:
* Missing semicolons
* Incorrect JSX syntax
* TypeScript type errors
* Import/export statement issues
3. **Simplify complex patterns**:
* Break down large components
* Remove experimental JavaScript features
* Fix any linting errors
4. **Skip problematic files**:
Move complex files out temporarily, migrate, then manually port them
**Problem**: Cannot create or write to target directory
**Solutions**:
1. **Check permissions**:
```bash theme={null}
ls -ld /path/to/parent/directory
touch /path/to/parent/directory/test-file
```
2. **Use different location**:
```bash theme={null}
# Try in your home directory
next-lovable ./my-app ~/my-next-app
```
3. **Check disk space**:
```bash theme={null}
df -h
```
4. **Run with elevated permissions if needed**:
```bash theme={null}
sudo next-lovable ./my-app /opt/my-next-app
```
**Problem**: Migration process stops or hangs partway through
**Solutions**:
1. **Check network connectivity**:
```bash theme={null}
ping api.nextlovable.com
curl -I https://api.nextlovable.com/health
```
2. **Monitor system resources**:
```bash theme={null}
# Check memory usage
free -h
# Check CPU usage
top
```
3. **Try smaller batches**:
* Exclude large files temporarily
* Remove node\_modules before migration
* Clear any build artifacts
4. **Enable verbose logging**:
```bash theme={null}
DEBUG=next-lovable* next-lovable ./my-app
```
5. **Kill and restart**:
```bash theme={null}
# Find and kill hung process
ps aux | grep next-lovable
kill -9
# Clean up and retry
rm -rf target-directory
next-lovable ./my-app ./clean-target
```
### Post-Migration Issues
**Problem**: `npm run dev` fails with errors
**Solutions**:
1. **Install dependencies**:
```bash theme={null}
cd migrated-project
npm install
```
2. **Common dependency issues**:
```bash theme={null}
# Install missing Next.js types
npm install --save-dev @types/react @types/react-dom @types/node
# Update to compatible versions
npm install next@13 react@18 react-dom@18
```
3. **Fix configuration issues**:
```bash theme={null}
# Check next.config.js for syntax errors
node -c next.config.js
# Regenerate if corrupted
rm next.config.js
# Create minimal config
echo "module.exports = {}" > next.config.js
```
4. **Clear cache and rebuild**:
```bash theme={null}
rm -rf .next node_modules package-lock.json
npm install
npm run dev
```
**Problem**: Pages don't load or routing is broken
**Solutions**:
1. **Check App Router structure**:
```bash theme={null}
# Should have this structure
app/
├── layout.tsx
├── page.tsx (home page)
├── about/
│ └── page.tsx
└── contact/
└── page.tsx
```
2. **Verify page.tsx exports**:
```tsx theme={null}
// Each page.tsx should export default
export default function PageName() {
return
Content
;
}
```
3. **Check for client component issues**:
```tsx theme={null}
// Add 'use client' if component uses hooks or event handlers
'use client';
import { useState } from 'react';
// ... rest of component
```
4. **Review navigation components**:
Ensure Link components use `href` instead of `to`
**Problem**: Many TypeScript errors in migrated code
**Solutions**:
1. **Update TypeScript configuration**:
```json theme={null}
// tsconfig.json
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "es6"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
```
2. **Install missing type definitions**:
```bash theme={null}
npm install --save-dev @types/react @types/react-dom @types/node
```
3. **Fix common type issues**:
```tsx theme={null}
// Add proper typing for components
interface Props {
children: React.ReactNode;
}
export default function Component({ children }: Props) {
return
{children}
;
}
```
### Performance Issues
**Problem**: Migration takes an extremely long time
**Solutions**:
1. **Check project size**:
```bash theme={null}
du -sh ./my-react-app
find ./my-react-app -name "*.tsx" -o -name "*.ts" | wc -l
```
2. **Exclude unnecessary files**:
```bash theme={null}
# Remove build artifacts first
rm -rf node_modules dist build .next
```
3. **Check network speed**:
```bash theme={null}
# Test upload speed to API
curl -w "@curl-format.txt" -s -o /dev/null https://api.nextlovable.com/health
```
4. **System resources**:
* Close other applications
* Check available RAM and CPU
* Use faster storage (SSD vs HDD)
**Problem**: Migration uses more credits than expected
**Solutions**:
1. **Check project complexity**:
* Large projects consume more credits
* Complex routing patterns increase usage
* Many components increase processing
2. **Use dry-run to estimate**:
```bash theme={null}
next-lovable ./my-app --dry-run
```
This shows estimated credit usage
3. **Consider breaking down project**:
* Migrate in smaller chunks
* Remove unused components
* Simplify complex routing
4. **Upgrade to newer version**:
Version 0.0.7+ offers free single file conversions
## Version 0.0.6 Specific Limitations
**Known Limitations in v0.0.6**:
* All operations require authentication and credits
* No single file conversion mode
* Limited error recovery options
* No granular transformation control
* Older React Router patterns may not convert perfectly
### Workarounds
1. **For testing small changes**: Use online converters or manual conversion
2. **For better control**: Upgrade to version 0.0.7+
3. **For complex projects**: Consider manual migration with v0.0.6 as reference
## Getting Help
### Debug Information
When reporting issues, include:
```bash theme={null}
# Version information
next-lovable --version
node --version
npm --version
# System information
uname -a
# Project information
ls -la my-react-app/
cat my-react-app/package.json
# Error logs (if available)
cat ~/.next-lovable/logs/latest.log
```
### Support Channels
Report bugs specific to v0.0.6
Get help from other users
Browse v0.0.6 documentation
## Upgrade Recommendation
**Consider upgrading to version 0.0.7+** for:
* Free single file conversions
* Better error handling
* More granular control
* Improved performance
* Enhanced CLI experience
See what's new in newer versions
Learn how to use the latest version
## Frequently Asked Questions
**No**, version 0.0.6 requires authentication for all operations, including single file conversions. Consider upgrading to 0.0.7+ for free features.
Only if you:
1. Used a separate target directory (recommended)
2. Have backups or version control
3. Used `--dry-run` first to understand changes
There's no built-in undo feature in v0.0.6.
Version 0.0.6 has limited support for:
* Custom route guards
* Dynamic route configurations
* Nested routing with complex logic
* Integration with state management
These require manual migration or upgrading to newer versions.
1. Uninstall v0.0.6: `npm uninstall -g next-lovable`
2. Install latest: `npm install -g next-lovable`
3. Note: Command structure changed in v0.0.7+
4. Read the [v0.0.7+ documentation](/0.0.7) for new features
## Report a Bug
Found a bug specific to version 0.0.6? Please report it with:
1. **Version confirmation**: `next-lovable --version` output
2. **Clear description** of the problem
3. **Steps to reproduce** the issue
4. **Sample project** that demonstrates the issue
5. **Expected vs actual behavior**
6. **System information** (OS, Node.js version, etc.)
[Report on GitHub →](https://github.com/Remote-Skills/next-lovable-cli-issues/issues/new?labels=v0.0.6)
# Introduction
Source: https://docs.nextlovable.com/legacy/0.0.6/index
Automatically migrate React applications to Next.js 13+ App Router - Legacy version with full authentication
**Legacy Version**: This is version 0.0.6 which requires authentication for all operations. Consider upgrading to [version 0.0.7+](/0.0.7) for free single file conversions and enhanced features.
A CLI tool that automatically converts your React applications to Next.js 13+ using the new App Router. This legacy version provides full project migration capabilities with API-based processing.
## Key Features
Full React to Next.js App Router conversion
React Router to Next.js navigation transformation
Seamlessly migrates from Vite build system
Automatically adds 'use client' directives where needed
## Get Started
```bash theme={null}
npm install -g next-lovable@0.0.6
```
```bash theme={null}
next-lovable ./my-react-app --dry-run
```
```bash theme={null}
next-lovable ./my-react-app ./my-next-app --yes --install
```
## Documentation
Setup and authentication instructions
Your first migration in 5 minutes
Complete command reference
Common issues and solutions
Enhanced features and free conversions
## What You Can Do
### Full Project Migration (Authentication Required)
Convert entire React applications to Next.js
See exactly what will change before applying
## What Gets Converted
* `useNavigate()` → `useRouter()` from `next/navigation`
* `` → `` from `next/link`
* `useLocation()` → `usePathname()` and `useSearchParams()`
* Route structure converted to app directory
* Vite configuration → Next.js configuration
* Component organization for App Router
* Package.json scripts and dependencies
* TypeScript configuration updates
* Automatic "use client" directive addition
* Server/client component separation
* Import path optimization
## Command Reference
| Task | Command | Authentication | Credits |
| ----------------- | ------------------------------- | -------------- | ------- |
| Preview migration | `next-lovable ./app --dry-run` | ✅ Yes | ❌ No |
| Full migration | `next-lovable ./app ./next-app` | ✅ Yes | ✅ Yes |
## Real-World Example
```tsx Before (React + Vite) theme={null}
// src/App.tsx
import { BrowserRouter, Routes, Route } from 'react-router-dom';
import Home from './pages/Home';
import About from './pages/About';
function App() {
return (
} />
} />
);
}
export default App;
```
```tsx After (Next.js App Router) theme={null}
// app/layout.tsx
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
{children}
);
}
// app/page.tsx (Home)
export default function Home() {
return
Home Page
;
}
// app/about/page.tsx
export default function About() {
return
About Page
;
}
```
## Version 0.0.6 Limitations
**Important Limitations**:
* **Authentication required** for all operations
* **Credit consumption** for all migrations
* **No single file mode** - only full project migration
* **Limited error recovery** compared to newer versions
* **Simpler CLI** without subcommands
## Why Upgrade to v0.0.7+?
Single file conversions without authentication
Subcommand structure with more control
Faster processing and better error handling
Choose specific transformations to apply
**Migration Path**: Existing v0.0.6 users can easily upgrade to the latest version for enhanced features and free single file conversions.
## Command Structure
Version 0.0.6 uses a simple command structure:
```bash theme={null}
# Basic migration
next-lovable [target-directory]
# With options
next-lovable ./my-app ./next-app --dry-run --yes --install
```
### Available Options
* `--dry-run, -d` - Preview changes without making them
* `--yes, -y` - Skip confirmation prompts
* `--install, -i` - Install dependencies after migration
## 🔧 Prerequisites
Version 0.0.6 requires Node.js 16.x or higher
A React application using React Router
Required for authentication and API access
Migration operations consume credits
## Need Help?
We'll convert your beautiful Lovable app into a lightning-fast, SEO-ready website that actually shows up in search results. No coding required.
## Ready to Migrate?
Use the current legacy version
Get enhanced features and free conversions
***
**Legacy Support**: While v0.0.6 continues to work, we recommend upgrading to [version 0.0.7+](/0.0.7) for the best experience with free features and enhanced capabilities.
## What Gets Converted
### React Router → Next.js Router
```tsx Before (React Router) theme={null}
import { Link, useNavigate, useLocation } from 'react-router-dom';
export const Navigation = () => {
const navigate = useNavigate();
const location = useLocation();
return (
);
};
```
```tsx After (Next.js) theme={null}
'use client';
import Link from 'next/link';
import { useRouter, usePathname } from 'next/navigation';
export const Navigation = () => {
const router = useRouter();
const pathname = usePathname();
return (
);
};
```
### React Helmet → Next.js Head
```tsx Before (React Helmet) theme={null}
import { Helmet } from 'react-helmet';
export const PageMeta = ({ title, description }) => (
{title}
);
```
```tsx After (Next.js Head) theme={null}
import Head from 'next/head';
export const PageMeta = ({ title, description }) => (
{title}
);
```
## Command Comparison Table
| Task | Command | Credits Required | Authentication |
| ------------------------- | ------------------------------------------ | ---------------- | -------------- |
| Preview project migration | `next-lovable migrate ./my-app --dry-run` | ❌ | ✅ Yes |
| Full project migration | `next-lovable migrate ./my-app ./next-app` | ✅ Yes | ✅ Yes |
## ⚠️ Important Notes
**Version 0.7+**: Uses new subcommand structure (`migrate`, `convert`)
**Version 0.6 and earlier**: Uses legacy command format
Always backup your original project before running a full migration!
## Limitations & Best Practices
### Known Limitations
* Complex custom route configurations may need manual adjustments
* Dynamic route parameters might require review
* Some third-party integrations may need updates
* Complex state management setups might need fine-tuning
### Best Practices
1. **Always test individual files first** using the free `convert` command
2. **`Run --dry-run`** before any actual migration
3. **Keep backups** of your original project
4. **Review generated files** before deployment
5. **Test thoroughly** after migration
## Getting Help
```bash theme={null}
next-lovable --help
```
***
Ready to migrate your React app to Next.js? Start with a simple file conversion to see the magic in action! 🚀
# Installation
Source: https://docs.nextlovable.com/legacy/0.0.6/installation
How to install and set up next-lovable CLI version 0.0.6
## System Requirements
Version 18.x or higher
npm, yarn, or pnpm
## Installation Methods
### Global Installation (Recommended)
Install next-lovable globally to use it from anywhere:
```bash npm theme={null}
npm install -g next-lovable@0.0.6
```
```bash yarn theme={null}
yarn global add next-lovable@0.0.6
```
```bash pnpm theme={null}
pnpm add -g next-lovable@0.0.6
```
Global installation allows you to run `next-lovable` from any directory on your system.
## Verify Installation
Check if next-lovable is installed correctly:
```bash theme={null}
next-lovable --version
```
You should see version 0.0.6 displayed.
## Updating to Newer Version
To update to the latest version with more features:
```bash npm theme={null}
npm update -g next-lovable
```
```bash yarn theme={null}
yarn global upgrade next-lovable
```
```bash pnpm theme={null}
pnpm update -g next-lovable
```
**Recommended**: Consider upgrading to version 0.0.7+ which offers free single file conversions without authentication requirements.
## Troubleshooting
If you get permission errors on macOS/Linux, try:
```bash theme={null}
sudo npm install -g next-lovable@0.0.6
```
Or better yet, configure npm to use a different directory:
```bash theme={null}
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
```
If `next-lovable` command is not found after installation:
1. Restart your terminal
2. Check if the npm global bin directory is in your PATH:
```bash theme={null}
npm config get prefix
echo $PATH
```
3. Add npm global bin to your PATH if missing
If you cannot authenticate:
1. Ensure you have a valid account at nextlovable.com
2. Check that your API key is correctly copied
3. Verify network connectivity to api.nextlovable.com
4. Try re-running the auth command
## What's Next?
Learn the basics with a simple example
Learn about project migration
# Quick Start
Source: https://docs.nextlovable.com/legacy/0.0.6/quick-start
Get up and running with next-lovable 0.0.6 in 5 minutes
**Version 0.0.6**: This version requires authentication for all operations. Consider upgrading to 0.0.7+ for free single file conversions.
## Prerequisites
Before you begin, make sure you have:
Create an account at [nextlovable.com](https://nextlovable.com)
## Your First Migration
Let's start with migrating a simple React project:
### Step 1: Prepare Your React Project
Make sure you have a React project with React Router. Here's a sample structure:
```bash theme={null}
my-react-app/
├── src/
│ ├── App.tsx
│ ├── components/
│ │ └── Navigation.tsx
│ └── pages/
│ ├── Home.tsx
│ └── About.tsx
├── package.json
└── vite.config.js
```
### Step 2: Preview the Migration (Dry Run)
See what changes will be made without modifying anything:
```bash theme={null}
next-lovable ./my-react-app --dry-run
```
Expected output
You'll see a summary of:
* Files that will be converted
* React Router patterns found
* Components that need 'use client' directives
* New Next.js file structure
### Step 3: Execute the Migration
Run the actual migration:
```bash theme={null}
next-lovable ./my-react-app ./my-next-app --yes --install
```
This will:
* Create a new Next.js project in `./my-next-app`
* Convert React Router to Next.js App Router
* Add 'use client' directives where needed
* Install all dependencies
* Set up the proper Next.js configuration
### Step 4: Review and Test
```bash theme={null}
cd my-next-app
```
```bash theme={null}
npm run dev
```
Visit [http://localhost:3000](http://localhost:3000) to see your migrated app
## Command Structure (v0.0.6)
Version 0.0.6 uses a simpler command structure:
```bash Basic Migration theme={null}
next-lovable [target-directory]
```
```bash With Options theme={null}
next-lovable ./my-app ./next-app --dry-run --yes --install
```
### Available Options
Path to your React application
Where to create the new Next.js project (optional)
Simulate migration without making changes
Skip confirmation prompts
Install dependencies after migration
## What Gets Converted
* `useNavigate()` → `useRouter()`
* `` → ``
* `useLocation()` → `usePathname()`
* Route structure converted to App Router
* Automatic 'use client' directive addition
* Page components moved to app directory
* Layout components properly structured
* Vite config → Next.js config
* Package.json scripts updated
* Dependencies migrated
## Example Migration
```tsx Before (React Router) theme={null}
// src/App.tsx
import { BrowserRouter, Routes, Route } from 'react-router-dom';
import Home from './pages/Home';
import About from './pages/About';
function App() {
return (
} />
} />
);
}
export default App;
```
```tsx After (Next.js App Router) theme={null}
// app/layout.tsx
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
{children}
);
}
// app/page.tsx
export default function Home() {
return
Home Page
;
}
// app/about/page.tsx
export default function About() {
return
About Page
;
}
```
## Limitations in v0.0.6
**Version 0.0.6 Limitations**:
* Requires authentication for all operations
* No single file conversion mode
* Limited transformation options
* No granular control over conversions
## Upgrade Benefits
Consider upgrading to version 0.0.7+ for:
Single file conversions without authentication
Granular transformation options
Subcommand structure (convert, migrate)
Faster processing and better error handling
## Common Issues
1. Check source directory permissions
2. Ensure target directory is writable
3. Verify sufficient disk space
4. Review error messages for specific issues
1. Run `npm install` in the target directory
2. Check for TypeScript errors
3. Review Next.js configuration
4. Clear Next.js cache: `rm -rf .next`
## What's Next?
Review how your React components were converted
Navigate through your app to ensure everything works
Deploy your new Next.js app to your preferred platform
Upgrade to version 0.0.7+ for enhanced features
Detailed CLI documentation
Common issues and solutions
Upgrade for more features