Files
blog/entries/Rebuilding-My-Website:-Faster-and-Leaner.md
Arkaprabha Chakraborty f9bfa37d1a edit the last entry
2025-12-10 00:47:35 +05:30

4.6 KiB
Raw Blame History

Tags: #webdev #golang #htmx #performance #nextjs #optimization #backend

Go + HTMX Architecture

Co-authored by LLMs

Rebuilding My Website: Faster and Leaner

I recently rebuilt my website, and the project turned out to be a great reminder of how modern web stacks can feel powerful—but also unnecessarily heavy—when all you really need is speed and clarity.

My old site was built with Next.js. It started as a borrowed template and slowly grew into a bundle of features: GitHub activity widgets, sandboxed project previews, a little 3D solar system, code-typing animations, and other decorative interactions. All of it worked—just not quickly.

The site consistently took over one second to become interactive. For a personal website, that delay felt wasteful. Most visitors arent looking for an immersive app; they just want clean, readable information.

You can still see the archived version here, and youll immediately notice the difference.


Why I Moved Away From Next.js

Next.js wasnt the villain here. Its great for full-scale applications. But for a simple, mostly static website, the abstractions—SSR, hydration, client-side bundles, routing layers, and build pipelines—added more complexity than benefit.

So I rebuilt everything using a simpler stack:

  • Go + Echo for fast, explicit server-side rendering and routing
  • Goldmark for Markdown processing (server-side, no client-side parsing)
  • HTMX for small pockets of interactivity without a front-end framework
  • A minimal, industrial-feel design focused on speed and readability

This alone cut load times to ~300 ms. Pages rendered instantly, the codebase shrank dramatically, and the whole system felt easier to reason about.


Adding Features Back… and Hitting a Wall

With the core structure working beautifully, I reintroduced two dynamic pieces:

  • My GitHub contribution stats
  • My blog feed

Almost immediately, load times jumped from ~300 ms to ~700 ms.

That wasnt terrible—but it felt like a step backward. The slowdown wasn't caused by Echo, HTMX, or Go. It was caused by where I was fetching data:

I was calling external APIs during the request cycle, blocking the entire render until GitHub responded.

No HTML was sent until the GitHub API call completed. And without framework-level abstractions like caching or static generation, the delay hit the user directly.


HTMX as Lightweight “Hydration”

The fix was obvious once I saw the bottleneck: dont make the initial page load wait for remote APIs.

Instead, I shifted from blocking SSR to progressive loading using HTMX.

Before (Blocking)

  • User requests /
  • Server fetches GitHub data
  • Server renders the template
  • Only then does HTML get sent back

After (HTMX-enhanced)

  • User requests /
  • Server immediately returns static HTML (with placeholders)
  • HTMX fires background requests to fetch stats
  • Received fragments are swapped into the page

This change preserved the super-fast initial load without sacrificing dynamic data.

The page becomes visible almost instantly, and the asynchronous HTMX swaps feel natural—similar to hydration, but without any client-side runtime or heavy JS bundles.


Lessons From the Rebuild

  1. Not every site needs a full framework; For mostly-static content, a minimal backend + progressive enhancement often wins in clarity and speed.

  2. SSR is only fast when your data is local; If your render pipeline waits on third-party APIs, you're no longer doing “fast SSR”—youre doing “SSR with built-in delays.”

  3. Interactivity doesnt require an SPA; HTMX continues to prove that small, targeted interactions can replace entire client-side frameworks.

  4. Perceived performance matters most; Sending HTML quickly has a bigger impact than many deep optimizations that happen later.


The Final Result

The new website is dramatically faster and lighter. It takes about 300 ms to completely load on a fast connection, while the old one used to take over 2 seconds. It makes a bigger difference on a slow 4G network, the old site takes over 6 seconds to load. The new one loads under 2 seconds, under similar conditions.

That improvement comes from:

  • Simple HTMX-powered AJAX
  • ~10× less bloat transferred
  • No hydration, no bundlers, no labyrinth of abstractions

The rebuild didnt just improve the site, it clarified how I want to approach simple websites going forward: focus on speed, reduce moving parts, and keep the bloat out.