Back to results for “Routing”
React › Server-Side Rendering (SSR) & Next.js

What is the difference between the pages router and the newer app router in Next.js?

Intermediate

Answer

The pages router, Next.js's original approach, defines each route as a file inside a pages folder, and every page is rendered on the client by default unless configured otherwise. The newer app router, inside an app folder, uses Server Components by default, supports nested layouts more naturally, and gives finer control over rendering behavior for each part of a page.
// Pages router: pages/about.js
export default function About() {
  return <h1>About Us</h1>;
}

// App router: app/about/page.js
export default function About() {
  return <h1>About Us</h1>;
}
Real-world example A team starting a brand new project chooses the app router specifically to take advantage of Server Components and nested layouts, while an older existing project continues using the pages router it was originally built with.

Common follow-ups: Should an existing project using the pages router be migrated to the app router?;What are nested layouts, and how does the app router make them easier to build?