Cra To Next Migration
Comprehensive guide for migrating Create React App (CRA) projects to Next.js. Use when migrating a CRA app, converting React Router to file-based routing, or adopting Next.js patterns like Server Components, App Router, or image optimization.
- Skill ID
- vercel-labs/migration-skills/cra-to-next-migration
- Publisher
- vercel-labs
- Repository
- migration-skills
- Installs
- 0
- Files
- 149
- License
- MIT
- Synced
- Sep 23, 2026
Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.
vercel-labs/migration-skills/cra-to-next-migrationInstalls these files- SKILL.md
- rules/api-cors.md
- rules/api-headers-cookies.md
- rules/api-http-methods.md
- rules/api-middleware.md
- rules/api-query-params.md
- rules/api-rate-limiting.md
- rules/api-request-body.md
- rules/api-response-types.md
- rules/api-route-handlers.md
- rules/assets-absolute-urls.md
- rules/assets-favicon.md
- rules/assets-manifest.md
- rules/assets-public-folder.md
- rules/assets-static-imports.md
- rules/build-bundle-analysis.md
- rules/build-docker.md
- rules/build-output.md
- rules/build-scripts.md
- rules/build-standalone.md
- rules/build-static-export.md
- rules/build-vercel.md
- rules/components-boundary-placement.md
- rules/components-children-pattern.md
- rules/components-composition.md
- rules/components-context-providers.md
- rules/components-interleaving.md
- rules/components-props-serialization.md
- rules/components-server-default.md
- rules/components-third-party.md
- rules/components-use-client.md
- rules/data-caching.md
- rules/data-client-fetch.md
- rules/data-client-library-init.md
- rules/data-parallel-fetching.md
- rules/data-revalidation.md
- rules/data-sequential-fetching.md
- rules/data-server-actions.md
- rules/data-streaming.md
- rules/data-useeffect-to-rsc.md
- rules/data-useeffect-to-ssg.md
- rules/data-useeffect-to-ssr.md
- rules/deps-react19-compatibility.md
- rules/env-build-time.md
- rules/env-local-files.md
- rules/env-prefix-change.md
- rules/env-runtime-config.md
- rules/env-server-only.md
- rules/env-validation.md
- rules/fonts-font-display.md
- rules/fonts-google-fonts.md
- rules/fonts-local-fonts.md
- rules/fonts-next-font.md
- rules/fonts-preload.md
- rules/fonts-variable-fonts.md
- rules/gotchas-api-routes-edge.md
- rules/gotchas-auth-race-conditions.md
- rules/gotchas-auth-state-gating.md
- rules/gotchas-configuration-idempotency.md
- rules/gotchas-cookies.md
- rules/gotchas-dynamic-imports.md
- rules/gotchas-empty-modules.md
- rules/gotchas-headers.md
- rules/gotchas-hydration-mismatch.md
- rules/gotchas-hydration-nested-interactive.md
- rules/gotchas-infinite-rerender.md
- rules/gotchas-middleware.md
- rules/gotchas-nullish-coalescing.md
- rules/gotchas-provider-hierarchy.md
- rules/gotchas-react19-class-components.md
- rules/gotchas-react19-ref-prop.md
- rules/gotchas-redirect.md
- rules/gotchas-router-push-timing.md
- rules/gotchas-router-ready.md
- rules/gotchas-static-generation.md
- rules/gotchas-turbopack.md
- rules/gotchas-use-effect-timing.md
- rules/gotchas-websocket-optional-deps.md
- rules/gotchas-window-undefined.md
- rules/images-fill-prop.md
- rules/images-loader.md
- rules/images-next-image.md
- rules/images-optimization.md
- rules/images-placeholder.md
- rules/images-priority.md
- rules/images-remote-patterns.md
- rules/images-required-dimensions.md
- rules/integrations-sentry.md
- rules/routing-basic-pages.md
- rules/routing-catch-all-routes.md
- rules/routing-dynamic-routes.md
- rules/routing-error-boundaries.md
- rules/routing-hash-based.md
- rules/routing-intercepting-routes.md
- rules/routing-link-component.md
- rules/routing-loading-states.md
- rules/routing-nested-layouts.md
- rules/routing-not-found.md
- rules/routing-optional-catch-all.md
- rules/routing-parallel-routes.md
- rules/routing-programmatic-navigation.md
- rules/routing-protected-routes.md
- rules/routing-route-groups.md
- rules/routing-use-params.md
- rules/routing-use-search-params.md
- rules/seo-canonical.md
- rules/seo-dynamic-metadata.md
- rules/seo-head-component.md
- rules/seo-json-ld.md
- rules/seo-metadata-api.md
- rules/seo-opengraph.md
- rules/seo-robots.md
- rules/seo-sitemap.md
- rules/seo-twitter-cards.md
- rules/setup-eslint.md
- rules/setup-gitignore.md
- rules/setup-initial-structure.md
- rules/setup-next-config.md
- rules/setup-package-json.md
- rules/setup-typescript.md
- rules/state-context-client.md
- rules/state-jotai.md
- rules/state-persistence.md
- rules/state-recoil.md
- rules/state-redux.md
- rules/state-server-state.md
- rules/state-url-state.md
- rules/state-zustand.md
- rules/styling-component-styles.md
- rules/styling-css-import-order.md
- rules/styling-css-in-js.md
- rules/styling-css-modules.md
- rules/styling-dark-mode-hydration.md
- rules/styling-emotion.md
- rules/styling-global-css.md
- rules/styling-postcss.md
- rules/styling-sass.md
- rules/styling-scss-global-syntax.md
- rules/styling-styled-components.md
- rules/styling-tailwind.md
- rules/testing-api-routes.md
- rules/testing-async-components.md
- rules/testing-client-components.md
- rules/testing-e2e-cypress.md
- rules/testing-e2e-playwright.md
- rules/testing-jest-config.md
- rules/testing-mocking.md
- rules/testing-react-testing-library.md
- rules/testing-server-components.md
What this skill tells the agent
CRA to Next.js Migration Guide
Comprehensive migration guide for converting Create React App projects to Next.js, covering routing, data fetching, components, styling, and deployment. Contains 148 rules across 17 categories, prioritized by migration impact. After a successful migration the application should work the same as it did before the migration.
When to Apply
Reference these guidelines when:
- Migrating an existing CRA application to Next.js
- Converting React Router routes to file-based routing
- Adopting Server Components in a client-heavy app
- Moving from client-side rendering to SSR/SSG
- Updating environment variables for Next.js
- Optimizing images and fonts with Next.js built-ins
Version Policy
Use Next.js 16.x or later. Do NOT use Next.js 14.x or 15.x.
Before starting migration, check the current latest version:
npm info next versionUse the latest version in your package.json with a caret for minor/patch updates. The minimum supported version for this migration guide is ^16.0.0.
Rule Categories by Priority
| Priority | Category | Impact | Prefix | Rules |
|---|---|---|---|---|
| 1 | Project Setup | CRITICAL | setup- | 6 |
| 2 | Dependencies | CRITICAL | deps- | 1 |
| 3 | Routing | CRITICAL | routing- | 17 |
| 4 | Data Fetching | CRITICAL | data- | 11 |
| 5 | Components | HIGH | components- | 9 |
| 6 | Environment Variables | HIGH | env- | 6 |
| 7 | Styling | HIGH | styling- | 12 |
| 8 | Public Assets | MEDIUM | assets- | 5 |
| 9 | Images | MEDIUM | images- | 8 |
| 10 | Fonts | MEDIUM | fonts- | 6 |
| 11 | SEO & Metadata | MEDIUM | seo- | 9 |
| 12 | API Routes | MEDIUM | api- | 9 |
| 13 | State Management | MEDIUM | state- | 8 |
| 14 | Integrations | MEDIUM | integrations- | 1 |
| 15 | Testing | LOW | testing- | 9 |
| 16 | Build & Deploy | LOW | build- | 7 |
| 17 | Common Gotchas | HIGH | gotchas- | 24 |
Quick Reference
1. Project Setup (CRITICAL)
setup-initial-structure- Convert CRA folder structure to Next.js App Routersetup-package-json- Update dependencies and scriptssetup-next-config- Create and configure next.config.jssetup-typescript- Migrate TypeScript configurationsetup-eslint- Update ESLint for Next.jssetup-gitignore- Update .gitignore for Next.js
2. Dependencies (CRITICAL)
deps-react19-compatibility- Upgrade dependencies for React 19 compatibility
3. Routing (CRITICAL)
routing-basic-pages- Convert components to file-based routesrouting-dynamic-routes- Use [param] syntax for dynamic segmentsrouting-catch-all-routes- Use [...slug] for catch-all routesrouting-optional-catch-all- Use [[...slug]] for optional catch-allrouting-route-groups- Use (group) folders for organizationrouting-parallel-routes- Use @slot for parallel routesrouting-intercepting-routes- Use (..) for intercepting routesrouting-link-component- Replace react-router Link with next/linkrouting-programmatic-navigation- Replace useNavigate with useRouterrouting-use-params- Replace useParams with Next.js paramsrouting-use-search-params- Replace useSearchParams properlyrouting-nested-layouts- Convert nested routes to layoutsrouting-loading-states- Add loading.tsx for suspenserouting-error-boundaries- Add error.tsx for error handlingrouting-not-found- Add not-found.tsx for 404 pagesrouting-hash-based- Handle hash-based routing for client-only appsrouting-protected-routes- Implement protected route patterns
4. Data Fetching (CRITICAL)
data-useeffect-to-rsc- Convert useEffect fetches to Server Componentsdata-useeffect-to-ssr- Convert useEffect to getServerSidePropsdata-useeffect-to-ssg- Convert useEffect to getStaticPropsdata-client-fetch- Keep client fetches with proper patternsdata-server-actions- Use Server Actions for mutationsdata-revalidation- Configure data revalidation strategiesdata-streaming- Use Suspense for streaming datadata-parallel-fetching- Fetch data in parallel on serverdata-sequential-fetching- Handle sequential data dependenciesdata-caching- Configure fetch caching behaviordata-client-library-init- Initialize client-only libraries in useEffect
5. Components (HIGH)
components-use-client- Add 'use client' directive for client componentscomponents-server-default- Understand server components are defaultcomponents-boundary-placement- Place client boundaries strategicallycomponents-composition- Use composition to minimize client JScomponents-interleaving- Interleave server and client componentscomponents-props-serialization- Ensure props are serializablecomponents-children-pattern- Pass server components as childrencomponents-context-providers- Handle Context providers properlycomponents-third-party- Wrap third-party client components
6. Environment Variables (HIGH)
env-prefix-change- Change REACTAPP to NEXTPUBLICenv-server-only- Use non-prefixed vars for server-onlyenv-runtime-config- Use runtime configuration when neededenv-local-files- Understand .env file loading orderenv-build-time- Understand build-time vs runtime env varsenv-validation- Validate required environment variables
7. Styling (HIGH)
styling-global-css- Move global CSS to app/layout.tsxstyling-css-modules- CSS Modules work with minor changesstyling-sass- Configure Sass supportstyling-tailwind- Configure Tailwind CSSstyling-css-in-js- Handle CSS-in-JS librariesstyling-styled-components- Configure styled-components for SSRstyling-emotion- Configure Emotion for SSRstyling-component-styles- Import component styles properlystyling-postcss- Configure PostCSSstyling-scss-global-syntax- Use :global only in CSS Modulesstyling-css-import-order- Control CSS import order in layoutsstyling-dark-mode-hydration- Handle dark mode without hydration mismatch
8. Public Assets (MEDIUM)
assets-public-folder- Public folder works the same wayassets-static-imports- Use static imports for assetsassets-absolute-urls- Reference assets without public prefixassets-favicon- Place favicon in app directoryassets-manifest- Configure web app manifest
9. Images (MEDIUM)
images-next-image- Replace img with next/imageimages-required-dimensions- Provide width and heightimages-fill-prop- Use fill for responsive imagesimages-priority- Use priority for LCP imagesimages-placeholder- Configure blur placeholdersimages-remote-patterns- Configure remote image domainsimages-loader- Configure custom image loadersimages-optimization- Understand automatic optimization
10. Fonts (MEDIUM)
fonts-next-font- Use next/font for optimizationfonts-google-fonts- Load Google Fonts properlyfonts-local-fonts- Load local font filesfonts-variable-fonts- Configure variable fontsfonts-font-display- Configure font-display strategyfonts-preload- Understand automatic font preloading
11. SEO & Metadata (MEDIUM)
seo-metadata-api- Use Metadata API instead of react-helmetseo-dynamic-metadata- Generate dynamic metadataseo-opengraph- Configure Open Graph metadata
More from vercel-labs
Use this skill in a project
Open any RiverX project, search the Skills panel for vercel-labs/migration-skills/cra-to-next-migration, and install it in one click.
