Migrate runtime to Next.js App Router and introduce framework-agnostic routing boundary#458
Draft
jimmyandrade with Copilot wants to merge 4 commits into
Draft
Migrate runtime to Next.js App Router and introduce framework-agnostic routing boundary#458jimmyandrade with Copilot wants to merge 4 commits into
jimmyandrade with Copilot wants to merge 4 commits into
Conversation
19 tasks
Copilot
AI
changed the title
[WIP] Migrate site from Gatsby to Next.js with App Router
Migrate runtime to Next.js App Router and introduce framework-agnostic routing boundary
Jul 16, 2026
There was a problem hiding this comment.
Pull request overview
Migrates the site runtime from Gatsby to Next.js App Router while keeping the existing page templates, and introduces a thin routing adapter (src/framework/router.js) to decouple UI/templates from any specific routing framework.
Changes:
- Adds a new
src/appApp Router route tree (including metadata routes likemanifest,robots,sitemap) and removes legacysrc/pagesentrypoints to avoid route conflicts. - Refactors templates/components away from Gatsby navigation APIs to a framework adapter (
RouterLink,navigateTo,getPath) and adds a Gatsby shim for transitional compatibility. - Updates metadata sourcing to shared config (
config/siteMetadata) and aligns docs/troubleshooting with the new runtime.
Reviewed changes
Copilot reviewed 33 out of 36 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| TROUBLESHOOTING.md | Documents Cypress install failures in restricted networks and Next App/Pages route conflicts. |
| src/templates/index.js | Switches template links/buttons to use RouterLink instead of Gatsby Link. |
| src/templates/check.js | Makes query parsing compatible with App Router by accepting a search prop. |
| src/templates/about.js | Switches CTA button to RouterLink. |
| src/pages/pages.test.js | Removes Gatsby pages export tests (Pages Router removed). |
| src/pages/index.js | Removes Gatsby Pages Router entrypoint for /. |
| src/pages/consultar/index.js | Removes Gatsby Pages Router entrypoint for /consultar. |
| src/hooks/useSiteMetadata.js | Replaces Gatsby static query with shared config/siteMetadata. |
| src/framework/router.test.js | Adds tests for the new routing boundary primitives. |
| src/framework/router.js | Introduces framework-agnostic RouterLink, getPath, navigateTo. |
| src/framework/gatsby-shim.js | Adds shim module for gatsby imports during migration. |
| src/containers/RecoilProviderWrapper/index.js | Adds a RecoilProvider for Next App Router layout usage. |
| src/containers/HomeCheckParkingForm/index.js | Refactors navigation/path prefix handling to the framework router adapter. |
| src/components/NavigationDrawer/index.js | Updates drawer navigation items to use RouterLink. |
| src/components/Footer/index.test.js | Updates test description to be framework-agnostic. |
| src/components/Footer/index.js | Updates footer links to use RouterLink. |
| src/app/termos/page.js | Adds App Router page for /termos. |
| src/app/sobre/page.js | Adds App Router page for /sobre. |
| src/app/sitemap.js | Adds Next metadata route for sitemap generation. |
| src/app/robots.js | Adds Next metadata route for robots.txt generation. |
| src/app/privacidade/page.js | Adds App Router page for /privacidade. |
| src/app/page.js | Adds App Router home page entrypoint. |
| src/app/not-found.js | Adds App Router not-found entrypoint. |
| src/app/manifest.js | Adds Next metadata route for web app manifest. |
| src/app/layout.js | Adds root layout and Next metadata from shared site metadata. |
| src/app/globals.css | Adds basic global CSS for Next layout. |
| src/app/denunciar/page.js | Adds App Router page for /denunciar. |
| src/app/consultar/page.js | Adds App Router page for /consultar with Suspense-safe query string handling. |
| src/app/ClientLayout.js | Adds a client layout wrapper to provide Recoil + existing Layout. |
| src/app/ajuda/page.js | Adds App Router page for /ajuda. |
| README.md | Updates documentation to reflect Next.js App Router structure and install guidance. |
| package.json | Switches scripts to Next and upgrades React/ReactDOM; adds Next dependency. |
| package-lock.json | Updates lockfile for Next + React 18 dependency graph. |
| next.config.js | Adds Next config and aliases gatsby to the migration shim. |
| config/siteMetadata/index.js | Adjusts env var names for Next and removes Gatsby-specific dotenv bootstrap. |
| .gitignore | Ignores .next/ build output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+81
to
+85
| "next": "16.2.10", | ||
| "prop-types": "15.7.2", | ||
| "query-string": "6.14.1", | ||
| "react": "17.0.2", | ||
| "react-dom": "17.0.2", | ||
| "react": "18.3.1", | ||
| "react-dom": "18.3.1", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR starts the Gatsby→Next migration by moving the site runtime to Next.js 16 App Router while preserving existing templates/content. It also introduces a framework boundary so core UI/page composition is no longer directly coupled to Gatsby, enabling future portability to Next/Remix-style runtimes.
Runtime migration (App Router)
src/approute tree for main paths (/,/ajuda,/consultar,/denunciar,/privacidade,/sobre,/termos) plusnot-found.src/pagesto avoid App/Pages route conflicts.manifest,robots,sitemap.Framework-agnostic boundary
src/framework/router.jswith shared primitives (RouterLink,navigateTo,getPath).Footer,NavigationDrawer,HomeCheckParkingForm,templates/index,templates/about) to use the framework adapter.Metadata decoupling
useSiteMetadatato read from shared config (config/siteMetadata) instead of Gatsby GraphQL/static query APIs.Next bootstrapping + compatibility bridge
next.config.jsand switched package scripts (develop,build,serve) to Next runtime.src/framework/gatsby-shim.js) for transitional compatibility with legacy imports from shared dependencies during migration.Query handling in App Router
/consultarnow reads query string viauseSearchParamswith Suspense-safe rendering and preserves existing template contract (searchstring).