Back to Blog

Rebuilding this site with TanStack Start

How I moved my personal site from Next.js to TanStack Start on Cloudflare Workers, and cut its JavaScript bundle to zero.

This site used to be a Next.js app, deployed through OpenNext on Cloudflare Workers. It worked, but it shipped a lot of JavaScript for what is basically one page of text and a few images. I rebuilt it with TanStack Start, and the home page now ships no JavaScript bundle at all.

What changed

No JavaScript in production

TanStack Start can prerender routes at build time. With that on, the build writes static HTML for every page, and the CSS is inlined into it. The home page is one response of about 25 KB compressed.

tanstackStart({
    prerender: { enabled: true },
});

The dev server still loads React for hot reload, so I only leave the <Scripts /> tag out of the production build.

Space, still without JavaScript

Later I gave the site a space theme, and every effect in it is CSS:

@view-transition {
    navigation: auto;
}

Browsers that don't support one of these just skip it, and the page works the same.

Results

Lighthouse scores 100 in all four categories on mobile and desktop. Total blocking time is 0 ms, because there is nothing to block.

This blog is written in MDX and rendered the same way, so this page is static HTML too.