Next.js Pages Router → Next.js App Router
hardApp Router is Next.js's future. React Server Components, server actions, streaming, and layouts replace getServerSideProps/getStaticProps.
You can run pages/ and app/ simultaneously. Migrate incrementally. Create app/layout.tsx first.
mkdir app && touch app/layout.tsx
Move global CSS imports, fonts, and providers to app/layout.tsx. Metadata API replaces next/head.
export const metadata = { title: 'My App' }
export default function Layout({ children }) { return <html><body>{children}</body></html> }pages/blog.tsx → app/blog/page.tsx. getServerSideProps → async server component. getStaticProps → generateStaticParams + cached fetch.
getServerSideProps → direct async/await in server components. getStaticProps → fetch with { next: { revalidate } }. SWR/React Query → still works in client components.
pages/api/*.ts → app/api/*/route.ts. Change (req, res) → Request/Response Web API style.
Add 'use client' to components using useState, useEffect, event handlers, browser APIs.