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

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

Tailwind CSS v4 with Next.js 16

#Tailwind CSS v4 with Next.js 16¶

Tailwind v4 is dramatically faster (Rust-based engine) and simpler to configure than v3. Next.js 16 ships with first-class support and a one-step install.

Install¶

bash
1 line
1npm i -D tailwindcss@latest @tailwindcss/postcss

postcss.config.mjs¶

js
3 lines
1export default {
2  plugins: { "@tailwindcss/postcss": {} },
3};

globals.css¶

css
6 lines
1@import "tailwindcss";
2
3@theme {
4  --color-brand: #f97316;
5  --font-sans: "Inter", ui-sans-serif;
6}

That's the whole config. No tailwind.config.ts required — themes live in CSS.

Custom Utilities¶

css
6 lines
1@layer utilities {
2  .text-balance { text-wrap: balance; }
3  .gradient-brand {
4    background: linear-gradient(135deg, theme(--color-brand) 0%, #ef4444 100%);
5  }
6}

Composing Class Names¶

bash
1 line
1npm i clsx tailwind-merge
ts
7 lines
1// lib/cn.ts
2import { clsx, type ClassValue } from "clsx";
3import { twMerge } from "tailwind-merge";
4
5export function cn(...inputs: ClassValue[]) {
6  return twMerge(clsx(inputs));
7}
tsx
9 lines
1import { cn } from "@/lib/cn";
2
3<button className={cn(
4  "rounded-md px-4 py-2 text-sm font-medium",
5  variant === "primary" && "bg-brand text-white",
6  variant === "ghost" && "border bg-transparent",
7  disabled && "opacity-50 cursor-not-allowed",
8  className,                // allow consumers to override
9)} />

twMerge resolves conflicting utilities — e.g. px-2 px-4 becomes px-4. Always wrap consumer-overridable classes.

Dark Mode¶

In v4, dark mode is a media query by default. To use a class:

css
3 lines
1@import "tailwindcss";
2
3@variant dark (.dark &);

Then toggle <html class="dark"> from a theme provider.

Tailwind + Server Components¶

Tailwind classes are just strings — they cross the server/client boundary without any special handling. Server Components can use any Tailwind class.

Performance Notes¶

  • Tailwind v4 build is 5–10× faster than v3 due to the new Rust engine.
  • The output CSS contains only the utilities you actually use — bundle size scales with your codebase, not the framework.
  • For a typical app, the final CSS is 15–30 KB gzipped.

Common Patterns¶

Container Queries¶

tsx
5 lines
1<div className="@container">
2  <article className="@md:grid @md:grid-cols-2 @md:gap-6">
3    {/* responds to its container's width, not viewport */}
4  </article>
5</div>

Modern Color Syntax¶

tsx
1 line
1<div className="bg-blue-500/20 text-blue-700" />   // 20% opacity, no extra classes

Animations¶

tsx
1 line
1<button className="transition-colors duration-200 hover:bg-brand active:scale-95" />

For complex animations, reach for Framer Motion. For basic UI transitions, Tailwind alone is enough.

Previous

Chapter 6 — Quiz

Next

CSS Modules, Global Styles & Scoped CSS

Use ← → arrow keys to navigate between lessons