What is the Pages Router in Next.js?

The Pages Router is the original Next.js routing system, where each file in pages/ becomes a route and data is loaded with getStaticProps, getServerSideProps and getStaticPaths. It is still supported in Next.js 16, but new features land in the App Router.

How it works

  • pages/index.tsx maps to /, pages/about.tsx to /about, pages/blog/[slug].tsx to /blog/:slug.
  • pages/_app.tsx wraps every page (global CSS, providers, persistent layout).
  • pages/_document.tsx customizes the <html> and <body> markup.
  • pages/api/* defines API routes with a Node-style (req, res) handler.

Data fetching

  • getStaticProps runs at build time (SSG), optionally with revalidate for ISR.
  • getServerSideProps runs on every request (SSR).
  • getStaticPaths lists which dynamic paths to prerender.
  • Components on the client use useRouter from next/router.

Why the App Router replaced it as the default

Every page in the Pages Router is a Client Component that hydrates fully, so all page code ships to the browser. Layouts are not nested natively, data fetching is page-level only, and there is no streaming per component. The App Router adds Server Components, nested layouts, streaming and the Cache Components model.

Status today

The Pages Router is maintained, receives bug and security fixes, and works with Turbopack. Both routers can live in the same project, which allows incremental migration: routes in app/ take precedence when both define the same path. AMP support and next lint, which some older Pages Router projects relied on, were removed in Next.js 16.

Code example

tsx
1// pages/blog/[slug].tsx - classic Pages Router page
2import type { GetStaticPaths, GetStaticProps, InferGetStaticPropsType } from "next";
3
4type Post = { slug: string; title: string; body: string };
5
6export const getStaticPaths: GetStaticPaths = async () => {
7 const posts: Post[] = await fetch("https://cms.example.com/posts").then((r) => r.json());
8 return {
9 paths: posts.map((p) => ({ params: { slug: p.slug } })),
10 fallback: "blocking", // render unknown slugs on first request
11 };
12};
13
14export const getStaticProps: GetStaticProps<{ post: Post }> = async ({ params }) => {
15 const res = await fetch(`https://cms.example.com/posts/${params!.slug}`);
16 if (!res.ok) return { notFound: true };
17 return { props: { post: await res.json() }, revalidate: 60 }; // ISR
18};
19
20export default function BlogPost({ post }: InferGetStaticPropsType<typeof getStaticProps>) {
21 return (
22 <article>
23 <h1>{post.title}</h1>
24 <p>{post.body}</p>
25 </article>
26 );
27}

Practice this question

Open it in the study app to track progress, take notes, listen to the answer and work through the rest of the Next.js set.

Open in study app