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
5

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

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 7 of 10·Chapter 7 — Styling, Assets & Performance
Lesson 38 of 54Reading14 min

next/image — Smart, Fast Images

#next/image — Smart, Fast Images¶

next/image is one of Next.js's biggest wins. It automatically:

  • Generates multiple sizes (responsive srcSet)
  • Converts to modern formats (AVIF, WebP) on the fly
  • Lazy-loads off-screen images
  • Blocks layout shift (CLS) by reserving space

Local Images¶

tsx
4 lines
1import Image from "next/image";
2import logo from "@/public/logo.png";
3
4<Image src={logo} alt="CoachNest" />

Local imports include width/height at build time — no dimensions needed.

Remote Images¶

Whitelist the domain in next.config.ts:

ts
6 lines
1images: {
2  remotePatterns: [
3    { protocol: "https", hostname: "images.unsplash.com" },
4    { protocol: "https", hostname: "cdn.coachnest.dev" },
5  ],
6},

Then provide width/height (or fill):

tsx
6 lines
1<Image
2  src="https://images.unsplash.com/photo-...."
3  alt="Hero"
4  width={1200}
5  height={600}
6/>

The fill Prop¶

For containers where you don't know the dimensions ahead of time:

tsx
9 lines
1<div className="relative aspect-video">
2  <Image
3    src={course.thumbnail}
4    alt={course.title}
5    fill
6    sizes="(max-width: 768px) 100vw, 50vw"
7    className="object-cover"
8  />
9</div>

Next.js 16 change: sizes is now required when using fill. The build will fail without it.

Priority for Above-the-Fold Images¶

tsx
7 lines
1<Image
2  src={hero}
3  alt="…"
4  priority
5  sizes="100vw"
6  className="w-full"
7/>

priority opts out of lazy loading and adds the image to the preload list.

Placeholder & Blur¶

tsx
1 line
1<Image src={cover} alt="…" placeholder="blur" />

Local imports include a blurDataURL automatically. For remote images, generate one with the plaiceholder library or skip the placeholder.

Quality & Format¶

tsx
1 line
1<Image src={cover} alt="…" width={1200} height={600} quality={75} />

The default quality (75) is the sweet spot. Increase only if you've measured a visual issue.

Vercel vs Self-Hosted Image Optimization¶

  • Vercel runs the optimizer at the edge — no setup.
  • Self-hosted uses sharp (a native library). The Docker base image node:20-alpine works; you may need to add apk add vips for some image types.

If you don't want Next.js to optimize images at all (e.g., your CDN already does):

ts
1 line
1images: { unoptimized: true }

Common Mistakes¶

MistakeFix
Using <img> instead of <Image> for app contentUse <Image> — ESLint will warn
Forgetting sizes with fillBuild will error in Next.js 16
Setting both width/height AND fillPick one
Loading 4000×3000 imagesAlways pass sizes so smaller versions are generated
Marking every image priorityOnly the LCP image should be priority

Previous

CSS Modules, Global Styles & Scoped CSS

Next

Fonts, Icons & Metadata

Use ← → arrow keys to navigate between lessons