00
Preparation & Audit
Audit your codebase before writing a single line of Next.js
Week 13–5 daysEstimated: 12h totalDon't skip this
Why this phase matters
3 days of audit prevents 3 weeks of debugging. Discovering that you missed all window references mid-migration causes SSR crashes in production. Catch them now.
Codebase Audit — Run These Searches
Find all react-router-dom imports — every file using it needs a route created in app/
Run: grep -r "react-router-dom" src/ --include="*.jsx" -lFind all useNavigate calls — replace with useRouter from next/navigation
Find all localStorage / sessionStorage references — causes SSR crash
List all VITE_ env variables — rename each to NEXT_PUBLIC_ everywhere
Document every protected route path — these go in middleware.js matcher array
Identify all <img> tags using S3 URLs — these become next/image (needs domain config)
Document all custom React hooks — useAuth, useSocket, etc. — all need 'use client'
List all Context Providers — replace with Zustand or keep as client components
Run npm run build on Vite project — note all warnings — they become SSR errors in Next.js
Project Scaffolding
Create a new git branch — never migrate on main
Keep old Frontend/ folder untouched — create a new Frontend-Next/ alongside it
Scaffold Next.js — with the exact flags below — all configured for your stack
Performance Baseline
Record baseline Lighthouse scores — run on your current Vite app — Performance, SEO, Accessibility, Best Practices
Measure current bundle size — run npm run build and note total JS/CSS sizes
terminal — run from project root
# Run from your project root (same level as Backend/) npx create-next-app@latest Frontend-Next \ --tailwind \ --eslint \ --app \ --no-typescript \ --no-src-dir \ --import-alias "@/*" # Install your stack cd Frontend-Next npm install axios zustand socket.io-client npm install react-hook-form @hookform/resolvers zod npm install next-sitemap @tanstack/react-table npm install sonner lucide-react # Initialize shadcn/ui npx shadcn@latest init # Verify it runs npm run dev # should open http://localhost:3000
Common Gotcha: Port conflict — Your Vite dev server runs on :5173. Next.js defaults to :3000. Run both simultaneously during migration.