Overview
Server-side rendering builds the full HTML document on the server for each request. The browser paints content immediately, crawlers receive full markup, and a hydration step then makes the page interactive. Choose it when pages depend on request data such as cookies, auth, or live inventory and must still be crawlable.
Rules
- Every request costs server time. Cache what can tolerate staleness (CDN
s-maxagewithstale-while-revalidate), or use ssg or isr for pages that can be minutes or hours old. - Next.js App Router renders a route dynamically when it reads request-time APIs such as
cookies()orheaders(); the Pages Router usedgetServerSideProps. SvelteKit renders on the server by default. - Server and client markup must match, or hydration fails (hydration).
- Compared with csr, SSR usually improves LCP and indexing but adds server latency.