Skip to main content

Module 17 — Next.js App Router

What Is Next.js?

Next.js is a React framework that adds server-side rendering, static generation, file-based routing, API routes, and edge computing on top of React. It's the most popular way to build production React applications.

App Router vs Pages Router

Next.js 13+ introduced the App Router — a complete rethinking based on React Server Components. The old Pages Router still works but the App Router is the future.

App Router (current)Pages Router (legacy)
app/ directorypages/ directory
Server Components by defaultClient Components by default
async componentsgetServerSideProps
Nested layouts_app.tsx, _document.tsx
Server ActionsAPI routes only
Streaming + SuspenseManual loading states

Learning Objectives

  • Understand the App Router directory structure
  • Use Server Components for data fetching
  • Add 'use client' only when necessary
  • Implement layouts and loading/error states
  • Use Server Actions to mutate data
  • Add authentication with NextAuth v5

Module Lessons

  1. App Router
  2. Server Components
  3. Data Fetching
  4. Server Actions
  5. NextAuth v5

Challenge

Build a full-stack blog with Next.js App Router:

  • Public blog posts (SSG)
  • Admin dashboard (protected routes)
  • Create/edit posts with Server Actions
  • GitHub OAuth via NextAuth

View Challenge →