$ ls index/

engineering / frontend / nextjs

Next.js: App Router vs Pages Router

$cat engineering/frontend/nextjs/app-router-vs-pages-router.md

Quick Comparison

FeaturePages Router (pages/)App Router (app/)
IntroducedNext.js 1 (classic)Next.js 13
Route filepages/about.jsapp/about/page.tsx
Dynamic routepages/blog/[id].jsapp/blog/[id]/page.tsx
LayoutsManual (wrap in _app.js)Built-in nested layouts
Server ComponentsNoYes — default
Data fetchinggetStaticProps / getServerSidePropsasync/await directly in server components
API routespages/api/route.jsapp/api/route/route.ts (Route Handlers)
RenderingStatic + SSRStatic + SSR + Streaming

Pages Router

File-system routing under pages/. Each file = one route. Supports:

  • getStaticProps — build-time static generation
  • getServerSideProps — per-request SSR
  • getStaticPaths — static paths for dynamic routes

Simple and battle-tested. Good fit for smaller apps or migrating legacy projects.

App Router

Routing under app/. Each route is a folder containing a page.tsx. Key additions:

  • Nested layoutslayout.tsx wraps all child routes; persists across navigation without remounting
  • Server Components — components render on the server by default; add "use client" only where you need interactivity or browser APIs
  • Streamingloading.tsx enables Suspense-based streaming for faster perceived load
  • Route Handlersroute.ts files replace pages/api/

Data Fetching in App Router

No more getStaticProps/getServerSideProps. Fetch directly in async server components:

// app/blog/[id]/page.tsx
export default async function BlogPost({ params }: { params: { id: string } }) {
  const post = await fetch(`/api/posts/${params.id}`).then(r => r.json())
  return <article>{post.title}</article>
}

Cache control is via fetch options: { cache: 'force-cache' } (static), { cache: 'no-store' } (dynamic), or { next: { revalidate: 60 } } (ISR).

When to Use Each

Pages Router — maintaining an existing codebase, simple apps, or when dependencies don't yet support Server Components.

App Router — new projects. It's the current standard; the Pages Router is stable but not receiving new features.

Let's build something impactful together.

ertughaskan@gmail.com Find me online
Availability
WorkAvailable
RelocationOpen
FreelanceClosed
© 2026 Ertugrul Alex Haskan /cookiesVancouver, BC 🇨🇦

This site uses one optional Google Analytics cookie to see which pages get read. Nothing is set until you choose — cookie details.