Lesson 194 of 2116
Next.js App Router With AI
The App Router uses React Server Components by default. Learn the folder conventions and the server/client split.
Lesson map
What this lesson covers
Learning path
The main moves in order
- 1Folders Are Routes
- 2app router
- 3layout
- 4page
Concept cluster
Terms to connect while reading
Section 1
Folders Are Routes
In Next.js 16, every folder under `app/` is a URL segment. `app/dashboard/page.tsx` serves `/dashboard`. `layout.tsx` wraps children. `loading.tsx` shows fallbacks. That is the whole router.
The root layout renders once per app session. Use it for fonts, providers, and html/body.
// app/layout.tsx
import "./globals.css";
export const metadata = { title: "Tendril" };
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}Next 15+ makes params async. Await it before use. revalidate: 60 caches the fetch for a minute.
// app/posts/[slug]/page.tsx
import { notFound } from "next/navigation";
async function getPost(slug: string) {
const res = await fetch(`https://api.example.com/posts/${slug}`, {
next: { revalidate: 60 },
});
if (res.status === 404) return null;
if (!res.ok) throw new Error("failed to load post");
return res.json() as Promise<{ title: string; body: string }>;
}
export default async function PostPage({
params,
}: {
params: Promise<{ slug: string }>;
}) {
const { slug } = await params;
const post = await getPost(slug);
if (!post) notFound();
return (
<article>
<h1>{post.title}</h1>
<p>{post.body}</p>
</article>
);
}Key terms in this lesson
The big idea: folders are routes, the server is the default, and params are async. Let Next do the heavy lifting on the server.
End-of-lesson quiz
Check what stuck
15 questions · Score saves to your progress.
Tutor
Curious about “Next.js App Router With AI”?
Ask anything about this lesson. I’ll answer using just what you’re reading — short, friendly, grounded.
Progress saved locally in this browser. Sign in to sync across devices.
Related lessons
Keep going
Creators · 50 min
The Landscape: Copilot vs. Cursor vs. Windsurf vs. Claude Code
The AI coding tool market fragmented fast. Let's map the 2026 landscape honestly: who is for autocomplete, who is for agents, who wins on cost, and what the tradeoffs actually feel like.
Creators · 50 min
Installing and Using Claude Code CLI
Claude Code is Anthropic's terminal-native coding agent. Let's install it, wire it to a project, and use the features most engineers miss on day one.
Creators · 45 min
Installing and Using the OpenAI Codex CLI
Codex CLI is OpenAI's terminal coding agent. It runs locally, supports MCP, and ships a codex cloud mode for background tasks. Let's install it and compare it honestly to Claude Code.
