back to all posts

Why this site left Next.js for SvelteKit

Notes from moving nhg.design from Next.js to a fully static SvelteKit site, and why I think less machinery is the feature.

tl;dr

  • I moved this site from Next.js to SvelteKit compiled to plain static files
  • A site where I can name every URL before deploying wants static files, not request-time infrastructure
  • A folder of HTML has no server to patch, which is the real win for me and for client work
  • The trade-offs are real, and each one took me an afternoon to solve

The previous version of this site ran on Next.js. It worked. It also shipped a React runtime, a server I had to think about, and a dependency tree that wanted my attention every few months, all for what is honestly a brochure with a blog. I rebuilt it as SvelteKit compiled to plain static files, and the difference is not subtle.

the mismatch

Next.js earns its complexity when you use what it is for: per-request rendering, middleware, image pipelines, incremental regeneration. A studio site uses none of that. Every page here is knowable at build time. Paying for request-time infrastructure to serve build-time content was the mismatch, and I paid it for years, mostly in upgrade churn between app router revisions and the periodic “your build is deprecated” email.

I liked Next.js, and I still think it is the right tool for what it is for. It was the wrong tool for a brochure with a blog, and it took me years to admit it.

These days I run one test on any small site: if I can name every URL before deploying, I want static files. This site passes trivially.

what the new stack is

The site runs on SvelteKit 2 with adapter-static and prerender = true at the root. The build walks every route and writes HTML. The output deploys to Cloudflare Pages, so the hosting bill is zero, there is no server for me to patch, and the site sits on the edge without me configuring anything.

Svelte compiles components away instead of shipping a framework to interpret them, so the JavaScript that does reach the browser is small and specific: the theme draw, the generative canvases, the reveal observer. If you visit with JavaScript disabled, you still get the entire site, just in fallback colors.

Posts are mdsvex files: markdown with frontmatter that can import real Svelte components inline. The interactive color demo in the studio post is a component sitting in the middle of the markdown, prerendered with the rest of the page. No embed, no iframe.

longevity is the point

Performance was the advertised reason and it delivered: no server round-trips, HTML at the edge, nothing blocking first paint but a font. But the argument that actually moved me is a duller one. The build output is a folder of files, and files do not have CVEs. A folder of HTML from 2010 still serves today; a Next.js 12 app from the same era needs an archaeologist.

This matters even more for client work than for my own site. A small business does not want a maintenance contract as a condition of owning a website. With a static site, the worst-case future is that it keeps working exactly as I deployed it. That is a strange sentence to write about web technology, and it is the one that sealed it for me.

The trade-offs are real. There is no request-time personalisation, forms need an external endpoint, and the visit-random theming had to move client-side, which is why an inline script draws the colors before first paint. I solved each of those in an afternoon.

lessons learned

  • Name what a site actually needs before picking the framework, and let the URL test decide
  • Upgrade churn is a real cost, even when nobody sends an invoice for it
  • Weigh the trade-offs honestly, then time them: mine took an afternoon each
  • Think about the worst-case future of a site, especially one a client will own

The problems I deleted used to be permanent.