Next.js SSR vs SSG vs ISR: when each mode fits
Next.js SSR vs SSG vs ISR: when each mode fits - практическое руководство MillionsCode с критериями, чек-листом, инструментами и FAQ.
Next.js SSR vs SSG vs ISR: when each mode fits
Decision rule
SSR creates HTML for every request. It fits dashboards, order status, permissions, private prices and pages where cookies change the result.
SSG creates HTML during build. It fits stable public pages, documentation, help pages, policy pages and evergreen tutorials.
ISR keeps static speed but regenerates the page after a selected interval. It is useful for blogs, product pages, public rankings and comparison guides.
The main test is cacheability. If the same HTML is safe for many visitors, choose SSG or ISR. If each request can differ, choose SSR or fetch private data separately.
Useful internal references: Next.js metadata, PageSpeed checker, meta tag checker, reading time calculator, image format guide.
Practical selection table
| Situation | Prefer | Reason |
|---|---|---|
| Stable public page | SSG | fastest delivery and simple cache |
| Public content with occasional updates | ISR | static speed plus controlled refresh |
| User-specific page | SSR | request data and permissions matter |
| Real-time widget | SSR or client fetch | freshness matters more than build speed |
Operating checklist
Check whether the HTML can be cached, how often the source data changes, whether build time grows with content count, and whether SEO metadata is available in the first response. Also check images, fonts and third-party scripts because they can damage performance even when the rendering mode is correct.
FAQ
Is SSR always better for SEO?
No. SSG and ISR also return full HTML and can be faster for public pages.
What should a blog use?
SSG for a small stable blog; ISR for many pages or regular updates.