← Back to blog

Angular SSR + Static Prerendering on a Self-Hosted Stack

Angular SSR + Static Prerendering on a Self-Hosted Stack

This site is built with Angular 21. For SEO and cold-load performance, the public routes are statically prerendered at build time.

The Goal

ng prerender runs at build time, hits every public route, and drops .html files into the dist folder. nginx serves them directly. The Angular app hydrates on the client side afterwards.

The Approach

Rather than spinning up a full staging environment for a build step, we use a SQLite snapshot (seed.db) with fixture data. The backend boots against it, prerender runs, and the image contains everything it needs.

Result

First-contentful paint drops from around 1.2 s to under 200 ms on a cold cache.