Services

Pages Router to App Router Migration for Mature Next.js Codebases

The risk is an App Router move that changes runtime behaviour enough to need planning like a platform migration, not a mechanical file conversion.

Move a mature Next.js codebase to the App Router without turning caching, rendering, middleware, or rollout changes into launch risk.

Short Answer

A Pages Router to App Router migration changes runtime behaviour, not just route folders. Caching, data fetching, middleware, and server/client boundaries can all shift under working production code. Mature Next.js teams need a routebyroute plan that proves the risky slices first, protects search and release behaviour, and avoids a bigbang file move.

Typical Symptoms

  • The current Pages Router codebase is blocking newer Next.js platform features.
  • Teams want App Router features but do not want a risky bigbang rewrite.
  • Caching and rendering semantics are not well understood across the migration.

Where Migration Risk Usually Sits

  • The current codebase mixes assumptions that do not translate directly into the App Router.
  • Server and client boundaries are not yet explicit enough for a safe migration.
  • The migration path has not accounted for caching, middleware, and which routes now belong where.

What I Would Check First

  • Map the routes that rely on middleware, caching assumptions, or browseronly behaviour before moving them.
  • Which routes need to move first and which can remain in the Pages Router temporarily.
  • Where caching and rendering changes will affect behaviour after migration.

How I Help Fix This

  • Plan a routebyroute migration that avoids unnecessary platform shocks.
  • Make the server, client, and caching responsibilities explicit before implementation.
  • Work through the highestrisk route types first.

When to Look at This

  • Before the first migration slice bakes in the wrong caching and server/client boundaries.
  • When the team understands the desire to move but not yet the operational cost of moving.

What Gets Resolved

  • Pages Router routes, datafetching behaviour, cache assumptions, and SEO output are mapped before App Router work starts.
  • Routes can move incrementally whilst unaffected pages continue to run in the Pages Router.
  • Server and client execution boundaries are explicit enough to keep browseronly behaviour out of the wrong render path.
  • Caching, data fetching, middleware, and revalidation stay predictable for each migrated route.
  • Searchcritical HTML and metadata remain stable as the route implementation changes.

How This Usually Works

  1. Technical Diagnostic

    A focused review to establish what is happening, where the risk sits, and what should happen next, ending with a prioritised plan the team can take into delivery.

  2. Embedded Delivery Support

    Senior handson support inside an existing team when architecture, implementation, review, and delivery decisions need to stay connected.

  3. Fractional Technical Leadership

    Ongoing senior technical direction when a team needs stronger leadership and platform ownership before a permanent hire makes sense.

Common Questions

Do we have to migrate the whole codebase at once?
No. In most mature codebases the safer route is phased adoption, keeping lowerrisk routes or shared utilities in place whilst the first App Router slices prove the new rendering and caching model.
Is this mainly a routing task or a caching task?
Usually both. The file moves are the smallest part of the work; the real risk sits in caching behaviour, server and client boundaries, and middleware assumptions that no longer behave the same way.

Planning a migration?

Tell me what you're moving from, what you're moving to, and what must keep working through the change. I'll read it and suggest the next step.

Related Case Studies and Project Work

  1. Screenshot of the Virgin Atlantic & Holidays website; part of John Kavanagh's selected project work.

    A New Headless Platform for Virgin Atlantic & Holidays

    At Virgin Atlantic, migration work sat inside a hightraffic travel estate where sequencing, release control, and frontend stability mattered every week.

    View case study