Alex Carter1 min readGetting Started with Next.js 14 App Router
A practical tour of the App Router: server components, layouts, data fetching, and the mental models that make it click.
The App Router in Next.js 14 is the most significant shift in how we build React applications since hooks. If you've been holding off, this is your guide to the mental models that make it all click.
Why the App Router?
The Pages Router served us well for years, but it had a few rough edges. Client-side navigation meant shipping more JavaScript than necessary, and splitting server and client components was awkward.
The App Router fixes this by building on React Server Components as the default. Components render on the server unless you explicitly opt into client-side rendering.
Server vs. Client Components
This is the single most important concept to internalize.
The "use client" directive
Add the "use client" directive at the top of a file to mark it as a client
component. Everything without that directive is a server component by default.
// app/counter.tsx
"use client";
import { useState } from "react";
export function Counter() {
const [count, setCount] = useState(0);
return (
<button onClick={() => setCount((c) => c + 1)}>
Clicked {count} times
</button>
);
}Rule of thumb
Keep state, effects, and event handlers in client components. Keep data fetching, heavy logic, and direct database access in server components.
Data Fetching
You can fetch directly in a server component — no getServerSideProps
needed. Next.js extends fetch with request memoization and caching.
// app/blog/page.tsx
export default async function BlogIndex() {
const posts = await fetch("https://api.example.com/posts", {
next: { revalidate: 60 }, // ISR: revalidate every 60s
}).then((res) => res.json());
return <PostList posts={posts} />;
}Layouts and Nesting
Layouts wrap child segments and persist across navigation. Define a root layout once and it applies to every route.
Layouts are the secret weapon of the App Router. They let you compose shared UI — headers, footers, sidebars — without repeating yourself.
Colocation
You can colocate non-route files inside app/ by wrapping them in a folder,
or by giving them a name that isn't page, layout, loading, etc.
Summary
- Server components are the default — opt into
"use client"only when needed. - Fetch data directly in server components.
- Use layouts for persistent, composable UI.
Give it a try on your next project. Once it clicks, you won't go back.
// Comments
Powered by Giscus
Comments are powered by GitHub Discussions. Configure Giscus incomponents/blog/comments.tsxto enable live discussions.
// Related Posts
Mastering React Server Components: A Mental Model
React Server Components sound complicated, but they click once you grok the module boundary. Here's the mental model that finally made it stick.
2026-04-02TypeScript Patterns I Actually Use in Production
Beyond the basics: discriminated unions, branded types, and the patterns that have earned a permanent place in my toolbox.
2026-02-21How I Ship Side Projects Without Burning Out
A sustainable system for building side projects: scoping, timeboxing, and knowing when something is 'done'.