Prerendering

Prerendering is the practice of running a JavaScript app once at build time and saving the resulting HTML for each route as a real file, so that crawlers, AI fetchers and first-time visitors receive finished markup instead of an empty container that only fills in after scripts execute.

How it works in practice

A build script starts the app in a headless browser, visits every route in a list, waits for the view to settle, and writes the resulting DOM to dist/<route>/index.html. The deployed site then contains one real HTML file per page. A visitor gets readable content on the first byte, and the JavaScript bundle still loads afterwards to make the page interactive — the hydration step.

The reason to bother is that not every consumer of your pages runs JavaScript. Google does, with a delay and a rendering budget. Bing is inconsistent. Most LLM crawlers, link preview bots and scrapers simply read the HTML they are given. For those, an unrendered single-page application has no content at all.

Prerendering, SSR and SSG are not the same thing

The words are used loosely, so it is worth pinning them down:

There is also a second, unrelated meaning: browsers use "prerender" for speculatively loading a page the user is likely to visit next. Same word, different subject — context usually makes it obvious which one is meant.

What to watch out for

Prerendering only covers the routes you list, so a new page that nobody added to the list ships as an empty shell. Anything personalised must not be captured in the snapshot — prerendering a logged-in view bakes one user's data into a public file. And the prerendered HTML and the client render need to agree, because if they differ the page will visibly flicker as the app replaces the markup.

Frequently asked questions

Is prerendering the same as server-side rendering?

No. Prerendering produces the HTML once at build time and serves it as a static file, so it cannot show anything personalised or newer than the last deploy. Server-side rendering produces the HTML on every request, which allows fresh and per-user content but requires a server to keep running.

Build it yourself

NorthernGo turns a plain-text description into a working web app with a database, login and a live URL. Local AI generation runs on your own GPU, is unlimited, and is free on every plan.

Start building free