80%
DefinitionNext.js is a React framework: file-based routing, server rendering, data fetching, caching, API routes, image/font optimisation and bundling in one tool.
Runs on the server only; its code is not sent to the browser: Rendered on the server for HTML, then hydrated in the browser
Can be async, read the DB or secrets directly: Can use state, effects, event handlers, browser APIs
No useState, onClick, window: Can't be async; can't import server-only code
TipPush
'use client' down to the leaves (buttons, forms) so most of the page stays server-rendered with zero JS.CSR: in the browser · dashboards behind login
SSR (dynamic): on every request · personalised or always-fresh pages
SSG (static): at build time · marketing pages, docs, blogs
ISR: at build, then regenerated after a time or on demand · product pages, large catalogs
Hydration = React attaching event handlers to server-rendered HTML.
Hydration mismatch: server and client render different output (dates,
window, random values).Partial prerendering: a static shell is served instantly, and dynamic holes stream in.
Server Actions are public endpoints — always validate input and check auth inside them.
Cache invalidation:
revalidatePath, revalidateTag (on-demand) or time-based revalidation.Newer versions make caching explicit (
'use cache', Cache Components); request APIs like cookies(), headers() and params are async.Route Handlers (
route.ts) for webhooks and public APIs.next/link: client-side navigation + prefetching
next/image: resizing, lazy loading, modern formats, no layout shift
next/font: self-hosted fonts, no layout shift
Metadata API: export const metadata / generateMetadata for SEO tags
Common mistakeReading
window or localStorage during render in a Client Component — it also renders on the server.ReviseApp Router files = routes.