CW Logo
Back to posts

Moving This Blog from Next.js to Astro

essay

This blog is now built with Astro. On the surface, almost nothing changed: the layout, dark mode, syntax highlighting, and every article URL remain exactly where they were.

And that was the whole point. I wanted to simplify the plumbing without falling into the trap of yet another visual redesign.

Next.js wasn't broken. Most pages were already statically generated, so this was never an emergency rescue from sluggish server rendering. But after gradually trimming away old experiments — photo galleries, separate tag archives, and scattered features — the blog had settled into a delightfully modest job: read local files, render prose, and keep a handful of small controls interactive.

For a site that had become this lean, Next.js started feeling like packing heavy winter gear for a sunny afternoon walk. Astro felt like a much more honest fit for what was left.

I also chose to keep React around. When moving to Astro, it's tempting to rewrite everything just to make every filename end in .astro. But rewrite dogmatism rarely pays off. Through Astro's React integration, existing page layouts render straight to static HTML during build time with zero client-side tax. Only the parts that genuinely need browser runtime — the theme switcher and avatar preview cards — are hydrated as islands. Working code stayed working; it just stopped shipping unnecessary runtime bundles.

Code blocks took the opposite path. In an SPA mindset, it’s all too easy to turn an entire article into a hydrated React tree just so a copy button can sit in the corner of a code block. Here, syntax highlighting is pure HTML rendered ahead of time. A tiny inline script handles clipboard copy and reading progress without ever touching React. The site still ships JavaScript, and client-side view transitions keep page navigation snappy. Reaching "zero JS" was never the goal; avoiding needless hydration was.

Content required the most respect. Frameworks are transient, but essays and their URLs shouldn't be. The existing content pipeline — date parsing, slug generation, previous/next links, and summary-only RSS/Atom feeds — stayed untouched. So did the OpenGraph images, where build-time generators and simple rewrites ensured existing social links wouldn't break. When migrating a site, it’s dangerously easy to declare victory the moment the homepage renders. But the real work is making sure every tiny edge case quietly keeps doing its job.

The most satisfying moment came right at the end: deleting the old app/ directory, purging next.config.mjs, dropping next-mdx-remote, and stripping away layers of adapter glue. There is a quiet joy in opening a repository and seeing a single, unambiguous codebase again.

I don't have synthetic benchmark charts or dramatic speedup claims to show off. Most of the weight loss here is mental rather than measurable: fewer framework abstractions standing between a Markdown file and the browser, and far less ceremony when I sit down to tweak a style or publish a note.

At the end of the day, a personal blog is meant to be a comfortable workbench. Having a setup that feels right to build on is more than enough reason to make the jump.