00
Preparation & Audit
Audit your codebase before writing a single line of Next.js
Week 13–5 daysDon't skip this
Phase Progress0/9 tasks · 0%
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)
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
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.