Skip to content
Frontsiter

Static site vs. server rendering

When prebuilt HTML is enough, and when pages have to be rendered on each request.

By · Published · 3 min read

The problem

You are building a website and have to choose how its pages are produced. A static site is built once into HTML files that any host can serve. With server rendering, a server builds each page when someone asks for it. Some frameworks, such as Next.js, also offer incremental regeneration (ISR): pages are built ahead of time and rebuilt on a server after a set time. The choice decides where you can host, what the site costs to run, and how fresh the content can be.

Options compared

Ways to produce pages compared
CriteriaStatic siteRecommendedServer renderingIncremental (ISR)
HostingStrongAny web server or CDNWeakA Node.js server or a serverless platformMixedA server or a platform that supports ISR
Page speedStrongPrebuilt files, served from a cacheMixedDepends on how fast the server respondsStrongPrebuilt files, refreshed in the background
Fresh dataWeakOnly after you rebuild and redeployStrongOn every requestMixedAfter the set time
Running costStrongLow: plain file hostingWeakHigher: server work for each requestMixedMedium: server work on each refresh

The trade-off

A static site trades freshness for cost and simplicity. It cannot show different content to each visitor or change between builds, but any low-cost host can serve it, and there is no server to run or secure. Server rendering gives fresh, per-visitor pages, but every request costs server time. ISR sits in between, and it still needs a server.

How to set it up

Most frameworks can build a static site. Each writes the HTML files to a folder that you upload to your host:

FrameworkStatic buildOutput folder
Next.jsoutput: "export" in next.config.tsout/
AstroThe default (output: "static")dist/
NuxtRun nuxt generate.output/public/
SvelteKit@sveltejs/adapter-static, with prerender = truebuild/

Before you choose, check that you do not need anything that runs on a server when a request arrives, such as form handling, logins with cookies, or redirects set in the framework. Those need a third-party service or a move to server rendering.

When to choose something else

Choose server rendering, or ISR, when pages differ for each visitor (an account page or a cart), when content must update within seconds (prices or stock levels), or when the site has too many pages to build every time.

Frontsiter's first version is a static site, built with Next.js and served from shared hosting with no Node.js server. At launch, its homepage scored 99 for performance on mobile and 100 on desktop in Google PageSpeed Insights.

Questions or ideas?

Corrections and topic ideas are always welcome. Email hello@frontsiter.com.

Contact us