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.

Likely Causes

  • 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 Look at 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.
  • Redirect, canonical, metadata, and sitemap dependencies are mapped before release.
  • Source and target route, template, and content differences are clear.
  • Content and preview risks are separated from framework migration work.
  • Launch actions are prioritised by visibility and delivery risk.

How This Usually Works

  1. Technical Diagnostic

    A focused review of affected routes, templates, deployment behaviour, crawl signals, CMS behaviour, performance bottlenecks, or code paths, followed by a prioritised fix plan the team can take into delivery.

  2. Embedded Delivery Support

    Senior handson support inside an existing team where architecture, implementation, review, and delivery judgement all matter, especially when the work cannot be handed over as isolated tickets.

  3. Fractional Technical Leadership

    Ongoing senior technical cover for architecture, roadmap, supplier review, delivery risk, hiring shape, and platformownership decisions when the team is not ready to hire permanently.

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 while 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.

Contact me about your migration

A short description of the current platform, target Next.js setup, and main migration risk is enough. 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