CoachnestCoachnest
Sign InGet Started
Back to course

Next.js 16: The Complete Developer Guide

…
—
Contents
1

What's New in Next.js 16

Reading14mFree
2

Installation, CLI & Your First Project

Reading12mFree
3

Project Structure & Conventions Deep Dive

Reading16m
4

Turbopack — The New Default Bundler

Video18m

Configuring TypeScript, ESLint & next.config.ts

Reading14m
6

Chapter 1 — Quiz

Quiz10m
7

App Router Fundamentals

Reading16m
8

Dynamic Routes, Catch-Alls & Type-Safe Params

Reading14m
9

Route Groups & Parallel Routes

Reading16m
10

Intercepting Routes & Modal Patterns

Reading12m
11

Loading, Error & Not-Found UI

Reading12m
12

Chapter 2 — Routing Quiz

Quiz12m
13

Understanding the Server/Client Boundary

Reading18m
14

Choosing When to use "use client"

Reading14m
15

Composing Server & Client Components

Reading14m
16

server-only, client-only & Code Splitting

Reading12m
17

Chapter 3 — Quiz

Quiz10m
18

Fetching Data in Server Components

Reading14m
19

The Next.js 16 Cache Model

Reading16m
20

Revalidation: revalidateTag, revalidatePath & On-Demand

Reading12m
21

Cache Components — Building Reusable Cached Functions

Reading14m
22

Search Params, Cookies & Dynamic APIs

Reading12m
23

Chapter 4 — Quiz

Quiz12m
24

Server Actions From First Principles

Reading16m
25

Forms with useActionState & Progressive Enhancement

Reading14m
26

Optimistic UI with useOptimistic

Reading12m
27

Validation with Zod + Server Actions

Reading12m
28

Chapter 5 — Quiz

Quiz10m
29

Static vs Dynamic vs Streaming

Reading14m
30

generateStaticParams & Pre-Rendering Dynamic Routes

Reading12m
31

Incremental Static Regeneration (ISR)

Reading12m
32

Partial Prerendering (PPR)

Reading16m
33

Edge Runtime vs Node.js Runtime

Reading12m
34

Rendering Strategies Deep Dive

Video22m
35

Chapter 6 — Quiz

Quiz12m
36

Tailwind CSS v4 with Next.js 16

Reading14m
37

CSS Modules, Global Styles & Scoped CSS

Reading10m
38

next/image — Smart, Fast Images

Reading14m
39

Fonts, Icons & Metadata

Reading12m
40

Chapter 7 — Quiz

Quiz10m
41

Middleware Fundamentals

Reading14m
42

Sessions, JWTs & Cookies

Reading16m
43

Protecting Server Components & Server Actions

Reading12m
44

Chapter 8 — Quiz

Quiz10m
45

Prisma with Next.js — The Production Setup

Reading14m
46

Mutations: Server Actions + Database Writes

Reading12m
47

Route Handlers & REST APIs

Reading12m
48

Chapter 9 — Quiz

Quiz10m
49

Unit & Component Testing with Vitest

Reading12m
50

End-to-End Testing with Playwright

Reading14m
51

Deploying to Vercel

Reading12m
52

Self-Hosting with Docker

Reading14m
53

Production Performance Checklist

Reading12m
54

Final Assessment — Next.js 16 Mastery

Quiz20m
←→navigate lessons
Chapter 1 of 10·Chapter 1 — Getting Started with Next.js 16
Lesson 5 of 54Reading14 min

Configuring TypeScript, ESLint & next.config.ts

#Configuring TypeScript, ESLint & next.config.ts¶

next.config.ts — Now TypeScript Native¶

Next.js 16 reads next.config.ts natively. You get auto-completion and type-checking on every option.

ts
21 lines
1import type { NextConfig } from "next";
2
3const config: NextConfig = {
4  reactStrictMode: true,
5  images: {
6    remotePatterns: [
7      { protocol: "https", hostname: "images.unsplash.com" },
8      { protocol: "https", hostname: "cdn.coachnest.dev" },
9    ],
10  },
11  experimental: {
12    ppr: "incremental",          // Partial Prerendering, opt-in per route
13    typedRoutes: true,            // Type-safe <Link href> across the app
14    serverActions: { bodySizeLimit: "2mb" },
15  },
16  async redirects() {
17    return [{ source: "/docs", destination: "/learn", permanent: true }];
18  },
19};
20
21export default config;

Use satisfies NextConfig if you'd rather keep literal types narrow.

tsconfig.json — Recommended Settings¶

The CLI scaffolds a solid default. Two settings worth turning on once you're comfortable:

json
11 lines
1{
2  "compilerOptions": {
3    "strict": true,
4    "noUncheckedIndexedAccess": true,   // safer array & object access
5    "noFallthroughCasesInSwitch": true,
6    "moduleResolution": "bundler",
7    "paths": {
8      "@/*": ["./*"]
9    }
10  }
11}

Path aliases work everywhere — components, server actions, route handlers.

Typed Routes¶

With experimental.typedRoutes: true:

tsx
8 lines
1import Link from "next/link";
2
3// ✅ Valid
4<Link href="/dashboard" />
5<Link href={`/courses/${slug}`} />
6
7// ❌ Compile error — no such route
8<Link href="/dashbaord" />

Catches typos at build time. Worth the opt-in.

ESLint¶

bash
1 line
1npm run lint

The eslint-config-next preset enforces:

  • React rules of hooks
  • Anti-patterns for next/image, next/link, next/script
  • No <a href> for internal nav
  • No <img> when next/image works
  • No React.lazy for routes (use the App Router instead)

Environment Variables¶

FileLoaded in
.envAll environments
.env.localAll environments — gitignored
.env.developmentnext dev
.env.productionnext build / next start

Public vs Private¶

bash
5 lines
1# Only available on the server (default)
2DATABASE_URL=postgresql://...
3
4# Exposed to the browser — prefix with NEXT_PUBLIC_
5NEXT_PUBLIC_POSTHOG_KEY=phc_abc123

Security: never put secrets behind NEXT_PUBLIC_. The variable is inlined into the JS bundle and visible in DevTools.

Validating Env at Boot¶

ts
10 lines
1// lib/env.ts
2import { z } from "zod";
3
4const schema = z.object({
5  DATABASE_URL: z.string().url(),
6  NEXTAUTH_SECRET: z.string().min(32),
7  NEXT_PUBLIC_APP_URL: z.string().url(),
8});
9
10export const env = schema.parse(process.env);

Crash early on misconfigured deploys instead of returning HTTP 500s in production.

Recommended Scripts (package.json)¶

json
11 lines
1{
2  "scripts": {
3    "dev": "next dev",
4    "build": "next build",
5    "start": "next start",
6    "lint": "next lint",
7    "typecheck": "tsc --noEmit",
8    "test": "vitest",
9    "e2e": "playwright test"
10  }
11}

Run npm run typecheck in CI — next build reports type errors, but a dedicated step keeps PR feedback fast.

Previous

Turbopack — The New Default Bundler

Next

Chapter 1 — Quiz

Use ← → arrow keys to navigate between lessons