Create React App → Next.js
mediumCRA is dead. Next.js gives you SSR, SSG, API routes, and a production-ready setup. Most effort is restructuring routing and deciding Pages vs App Router.
npx create-next-app@latest my-app --typescript && npm uninstall react-scripts
Move src/components, src/hooks, src/utils as-is. Create app/ (or pages/) directory. Each route = a file.
React Router routes → Next.js file-based routes. <Link> from next/link. useNavigate → useRouter from next/navigation.
REACT_APP_ → NEXT_PUBLIC_ for client-side vars. Server-only vars have no prefix.
find src -name '*.ts*' -exec sed -i 's/process.env.REACT_APP_/process.env.NEXT_PUBLIC_/g' {} +Put <head> content in app/layout.tsx using Next.js Metadata API. Global CSS in app/globals.css.
Move any CRA proxied endpoints to app/api/route.ts. Replace fetch('/api/x') with same — routing matches automatically.
npm run build && npm run start
What this migration involves
Moving from Create React App to Next.js is rated medium and takes about 4-10h on a typical project. The guide breaks it into 7 steps, 3 of which ship with runnable commands and 1 with a verification check.
Related migrations
FAQ
How long does migrating from Create React App to Next.js take?
Around 4-10h for a typical project — 7 steps, difficulty rated medium, 3 of them with copy-paste commands.
Is moving from Create React App to Next.js reversible?
No reverse guide is tracked yet, so treat this as a one-way move and keep a full export of your Create React App data before you start.
What does Next.js cost compared to Create React App?
Next.js: open-source from $0/mo, free plan available.