Static to Dynamic: Migrating Gatsby/CRA to Next.js 15 (Step-by-Step)

Ship faster with React Server Components, App Router, and ISR. This step-by-step playbook shows how to migrate from Gatsby or CRA to Next.js 15 without losing SEO, performance, or developer velocity.
A practical 2025 migration guide for teams moving from Gatsby or Create React App to Next.js 15. Learn App Router, React Server Components, ISR, edge rendering, Metadata API, routing, SEO, images, and CI/CD.
Introduction
Next.js 15 delivers the full-stack React experience teams have wanted: React Server Components (RSC), the App Router, Incremental Static Regeneration (ISR), edge rendering, first-class image & font optimization, and a powerful Metadata API for SEO. If you’re running a Gatsby or Create React App (CRA) site and need faster builds, dynamic personalization, or better Core Web Vitals, this step-by-step migration guide will get you to Next.js 15 with minimal friction—and maximum long-term wins.
We’ll cover planning, project bootstrapping, routing differences, data fetching, SEO and redirects, styling and assets, testing, and CI/CD. You’ll learn how to map Gatsby GraphQL queries or CRA client-only fetches into server-first patterns that ship HTML quickly, reduce client JS, and preserve (or improve) rankings.
1) Plan Your Migration: Inventory, Priorities, and Cutover
Start with an audit. The right plan reduces risk and keeps organic traffic steady.
- Inventory pages & routes: List URLs, templates, and dynamic parameters (e.g., /blog/[slug]).
- Data sources: Note CMSes, Markdown, REST/GraphQL endpoints, environment variables, and build steps.
- SEO assets: Titles, meta descriptions, canonical tags,
hreflang, structured data, sitemaps, robots rules. - Performance: Largest media, fonts, third-party scripts; identify LCP/INP/CLS offenders.
- Cutover strategy: Big bang vs. incremental (subpaths, reverse proxy, or DNS split by route).
Tip: Migrate the highest-value, low-complexity paths first (e.g., marketing pages, docs, blog), then complex app areas.
2) Create the Next.js 15 App (App Router + RSC)
Next.js 15 is RSC-first. Keep components server by default, add "use client" only where interactivity is needed. This reduces bundle size and improves Time to Interactive.
3) Routing Differences: Gatsby/CRA → App Router
Gatsby maps files in src/pages, and can create pages programmatically in gatsby-node. CRA relies on react-router. In Next.js 15, use App Router with nested segments and route groups. Dynamic params are folder names in brackets.
Use Route Groups like app/(marketing) to separate SEO’d content from app dashboards where you might set robots: noindex.
4) Data Fetching: From Gatsby GraphQL/StaticQuery & CRA Fetch to RSC
Gatsby relies on GraphQL at build time. CRA fetches on the client (CSR). In Next.js 15, fetch data on the server using RSC and control caching/ISR precisely.
For Gatsby Markdown, read files at build time or use a headless CMS. For CRA APIs previously called client-side, move them server-side in the route and pass minimal props to client components.
On-demand revalidation: trigger from your CMS on publish to refresh the cache immediately.
5) SEO Migration: Metadata API, Canonicals, Hreflang, Structured Data
Replace Gatsby plugins or CRA head management with the Metadata API. Co-locate meta with the route so it stays in sync with content.
Render JSON-LD server-side to ensure parsers see it in the initial HTML.
6) URLs, Redirects, and Canonicalization
Preserve existing URLs where possible. If paths must change, implement 301 redirects and normalize noisy query params using middleware.ts.
Regenerate sitemaps with App Router so search engines discover Next pages quickly.
7) Images & Fonts: Next.js Optimization for LCP/CLS
Replace Gatsby image plugins or CRA image tags with Next.js <Image /> and Google Fonts integration for better LCP and CLS.
Always set width/height to lock layout, preload the hero image, and lazy-load below-the-fold media. For self-hosted fonts, preload the critical subset.
8) Styling, State, and Client Components
Bring your existing styling library (Tailwind, CSS Modules, CSS-in-JS). Keep most UI server-rendered; mark interactive islands with "use client". Avoid global state for public marketing routes; prefer local state or server data.
Server Components fetch and render content; client components handle events and animations.
9) Environment, Config, and Build Pipeline
Map your Gatsby/CRA env usage to Next env rules (NEXT_PUBLIC_* for client). Validate at build time.
Use edge runtime where latency matters (geo redirects, A/B cookies) and Node runtime for heavy server work.
10) Testing & Quality Gates: Keep Confidence During Migration
Lock behaviors with unit, integration, and e2e tests. If you’re migrating a large site, snapshot legacy HTML where possible and compare key templates.
Add accessibility checks (axe/Pa11y), and block PRs that regress LCP/INP/CLS beyond budgets.
11) Deploy, Observe, and Iterate
Deploy to a platform with first-class Next.js support and global edge network. Monitor real-user metrics (RUM), error rates, and crawl stats. Use on-demand revalidation webhooks from your CMS so editors see changes instantly without full rebuilds.
- Observability: Web Vitals in production, 404/500 logs, slow API traces.
- SEO monitoring: Crawl new Next routes, verify canonicals and hreflang, watch index coverage.
- Perf budgets: Bundle size limits, image weight caps, third-party script guards.
12) Common Pitfalls (and How to Fix Them)
- Hydration mismatches: Split client logic; avoid reading browser-only APIs in RSC. Move such code into
"use client"components. - Lost redirects: Mirror every Gatsby/CRA redirect in
next.config.tsandmiddleware.ts. Verify with a crawl. - Slow images: Missing width/height or priority flags; convert to Next Image.
- Duplicate content: Normalize trailing slashes, query params, and add consistent canonicals via Metadata API.
- Client-only data: Move fetches server-side to lower JS cost and improve SEO.
13) Quick Checklist: Gatsby/CRA → Next.js 15
- ✅ App Router created; routes mapped (static/dynamic) with ISR where suitable
- ✅ Metadata API replacing head management; JSON-LD rendered server-side
- ✅ All legacy redirects implemented; sitemap & robots updated
- ✅ Images/fonts optimized; LCP asset preloaded; CLS guarded
- ✅ Data moved to server; client islands only for interactivity
- ✅ On-demand revalidation hooked to CMS
- ✅ Tests, a11y checks, Lighthouse budgets in CI
- ✅ Observability & RUM in place; post-cutover crawl verified
Conclusion
Migrating from Gatsby or Create React App to Next.js 15 unlocks server-first rendering, modern caching, and platform features that make sites faster, more indexable, and easier to maintain. By mapping routes to the App Router, moving fetches into React Server Components, enabling ISR, and using the Metadata API, you’ll deliver HTML quickly, reduce JS on the client, and protect Core Web Vitals.
Adopt an incremental cutover if needed, start with high-impact pages, and validate via redirects, structured data, and RUM. With this playbook, your team can modernize the stack without sacrificing SEO or developer velocity—and set the foundation for personalization, edge logic, and rapid iteration in 2025 and beyond.
Tags

A passionate and detail-oriented frontend developer with a strong knowledge in Web Development and strong foundation in HTML, CSS, JavaScript, React.js and Next.js.
Ready for Career Guidance?
At CDPL Ed-tech Institute, we provide expert career advice and counselling in AI, ML, Software Testing, Software Development, and more. Apply this checklist to your content strategy and elevate your skills. For personalized guidance, book a session today.
