next-lovable
A CLI tool to migrate React applications to Next.js 13+ (App Router).
Features
- Converts React Router routes to Next.js App Router
- Migrates from Vite to Next.js build system
- Handles package.json dependencies
- Preserves existing components and layouts
- Adds necessary Next.js configuration files
- Supports TypeScript projects
Prerequisites
- Node.js 18.x or higher
- npm or yarn
- A React project using:
- Generated using lovable.com
- React Router
- Vite
- TypeScript
Installation
$npm install -g next-lovable
Authentication
When you run the CLI tool, you'll be prompted to authenticate with your credentials:
$next-lovable ./my-react-app
? Email: youremail@gmail.com
? Password: [hidden]
✅ Successfully logged in!
✅ Authentication successful
? This will convert the React project at ..\ses-template-manager\ to Next.js in next-app. Continue? Yes
Your free account includes 1 migration credit. Additional migrations require purchasing more credits.
Usage
Basic usage:
$next-lovable <source-directory> [target-directory]
With options:
$next-lovable ./my-react-app ./next-app --yes --install
Options
-y, --yes
: Skip confirmation prompts-i, --install
: Install dependencies after migration--help
: Show help information
Examples
1. Basic migration:
$next-lovable ./my-react-app
2. Specify target directory:
$next-lovable ./my-react-app ./converted-app
3. Non-interactive migration with dependency installation:
$next-lovable ./my-react-app --yes --install
Migration Process
- Setup and Validation
- Validates source project
- Creates target directory
- Project Structure
- Copies project files
- Restructures directories to Next.js format
- Converts route structure
- Code Transformation
- Adds 'use client' directives
- Updates import paths
- Converts router code
- Creates Next.js page files
- Configuration
- Updates package.json
- Creates Next.js config files
- Sets up root layout
Post-Migration Steps
- Review generated files in
src/app
- Check component imports and paths
- Update any remaining router-specific code
- Test the application with
npm run dev
Known Limitations
- You may need to manualy to add the
"use client"
directive to certain components.