Next.js & React
SSG, SSR or ISR? Choosing a rendering strategy for each route
What SSG, SSR, ISR and client-side rendering mean, what each costs, and how I choose per route across real Astro and Next.js projects.
Render a page at build time (SSG) when everyone sees the same content and it changes rarely; regenerate it periodically or on demand (ISR) when the content changes but not per visitor; render on each request (SSR) only when the page depends on who is asking or must be current to the second; and render in the browser (CSR) only for interactive parts behind a login. Choose per route, not per project.
The four strategies
| Strategy | HTML produced | Best for | Main cost |
|---|---|---|---|
| SSG: static site generation | Once, at build time | Marketing pages, docs, catalogues, case studies | Content changes need a rebuild |
| ISR: incremental static regeneration | At build, then refreshed after a time window or on demand | Large catalogues, listings, content edited during the day | Briefly stale pages; platform support needed |
| SSR: server-side rendering | On every request | Personalised pages, carts, dashboards needing fresh server data | Server work per request; slower time to first byte than a cached file |
| CSR: client-side rendering | In the browser, after JavaScript loads | Highly interactive app views behind a login | Empty initial HTML; slower first render; poor for SEO |
What’s the difference between SSR and SSG? Both send complete HTML to the browser, which is what search engines and answer engines read. The difference is when that HTML is produced: SSG produces it once during the build and serves the same file to everyone; SSR produces it fresh on every request, so it can depend on the visitor, but it costs server work every time.
The decision rules I use
- Does the page differ per visitor? If yes, it needs SSR or client rendering for the personalised part. If no, keep going.
- How often does the content change? Rarely: SSG. Throughout the day, but the same for everyone: ISR, or SSG plus a rebuild triggered by content changes.
- Does it need to rank or be shared? Then the content must be in the initial HTML, which rules out client-only rendering for that content.
- How much interactivity? Add it as islands or Client Components on top of server-rendered HTML; don’t make the whole page client-rendered to get one interactive widget.
How this plays out in real projects
Brand and business websites: static. Eastern Condiments (520 pages), Venora Dubai, ORVAS and this portfolio are fully static Astro sites. Content is the same for everyone and changes when someone edits it, so a rebuild on change is simpler and faster than any server rendering. The HTML is complete from the first byte, and the only JavaScript is for motion and a few interactive components.
A data-driven documentary: static Next.js. Rich Anthill is a Next.js App Router site where every route is prerendered at build time, then deployed to Cloudflare Workers with OpenNext. Adding a day’s episode means adding a validated JSON file and rebuilding; the homepage, archive, sitemap and share images all regenerate. Next.js was chosen for its tooling, not for server rendering.
Dashboards: server data, client interactivity. The Ekonavi marketplace’s seller dashboard is personal to each seller and changes constantly. Static rendering is irrelevant there. Data comes from Hasura GraphQL and is cached in the browser with TanStack Query, so navigation between views is fast and lists refresh in the background. Search-engine visibility doesn’t matter behind a login.
Mixed products: per route. A typical product has public pages that should be static, catalogue pages that suit ISR, and account pages that need SSR or client data. The App Router lets each route choose; the mistake is letting the most dynamic route dictate the strategy for all of them.
Common mistakes
- Making everything SSR “for SEO”. Static HTML is just as crawlable, faster and cheaper. SSR is for freshness or personalisation, not for search engines.
- Client-rendering public content. If the HTML is an empty shell until JavaScript runs, some crawlers and AI systems will see nothing, and every visitor waits longer.
- Forgetting cache behaviour on the target platform. Revalidation and caching depend on the hosting platform and its adapter. Running Next.js on Cloudflare Workers through OpenNext, test caching on the real deployment, not just locally.
- Hydrating a whole page for one widget. Use islands (Astro) or a small Client Component (Next.js) for the interactive part.
A quick reference
| Page | Strategy |
|---|---|
| Home, services, about, case studies, articles | SSG |
| Product or property listings updated daily | ISR or SSG with rebuild on content change |
| Product detail with live stock | SSG page + client-fetched stock widget |
| Cart, checkout, account | SSR or client-rendered behind auth |
| Admin and seller dashboards | Client-rendered views over a cached API |
References
- Next.js: rendering nextjs.org
- Next.js: incremental static regeneration nextjs.org
- Astro: on-demand rendering docs.astro.build
- web.dev: rendering on the web web.dev