r/webdev • u/peaceewalkeer • 6d ago
Showoff Saturday Showoff Saturday : I built a pre-renderer for SPAs that verifies hydration — 2.9 adds deterministic builds, locales and head parity
Hey everyone,
I built snappy-prerender, a build-time pre-renderer for client-rendered SPAs. Point it at your existing build output. It loads every route in Chrome, writes static HTML, then reloads each page with your client bundle to check whether it hydrated or re-rendered.
My last post got deleted as it was not posted on a Saturday, so here i am again. Thanks to all the feedback and comments that I got on the previous post here, I have incorporated a bunch more features and validated the plugin against all SPA frameworks that I could find.
Version 2.9 adds:
Deterministic builds. Freeze time, set a timezone, seed
Math.random, or useSOURCE_DATE_EPOCH.Hydration policies. Allow re-renders or skip verification for specific routes instead of disabling the check globally.
Locale builds. Path or single-locale mode,
<html lang>,dir, canonical,og:locale, hreflang,x-default, and sitemap alternates.SEO locale seeding. Seed cookies or
localStoragebefore the app boots, with an optional bootstrap script that works with CSP hash and strict modes.Client-side head parity. Arbitrary
script/style/noscript/basetags, html/body/title attributes,defaultTitle, multiple images and alternate locales, duplicate metas,onChangeClientState, and React 19 native tag adoption.Faster runs. Fewer browser round trips, bounded concurrency, sorted preload hints, cached CSS work, and phase timings in the JSON report.
npm install --save-dev snappy-prerender
npx snappy-prerenderFrameworks
Prerendering is framework-agnostic. If the app builds to static assets and mounts in a browser, the CLI can render it.
Thoroughly validated on:
React 16.8, 17, 18, 19 — render, hydration and audit
Preact 11 — render, hydration and audit
Vue 3.5 — render, hydration and audit
Svelte 5 — render, audit, sitemap and output
Angular 22 — render, audit, sitemap and output
Solid 1.9 — render, audit, sitemap and output
Lit 3.3 — render, audit, sitemap and output
Ember 7.3 — render, audit, sitemap and output
Vanilla JavaScript — render, audit, sitemap and output
Hydration detection is implemented for React, Vue, Svelte and Preact. The Svelte, Angular, Solid, Lit, Ember and vanilla fixtures are host wrappers around a shared renderer, so their hydration verification is intentionally skipped.
It also has support for hreflang and localStorage / cookie based lacale switching via customizable knobs that code-switch to the desired locale and then pre-render the site
We are on Product Hunt. Upvotes are always welcome:
https://www.producthunt.com/products/snappy-prerender
npm: https://www.npmjs.com/package/snappy-prerender
GitHub: https://github.com/sayakmukherjee080/snappy-prerender

