Bunext: Replacing Next.JS from scratch
Building a meta-framework is the 'final boss' of web engineering. After watching AI-generated 'slop forks' fail to handle the complexities of React hydration and security, I decided to build the engine myself. Bunext is the result: a leaner, faster, and truly platform-agnostic successor to the Next.js Pages Router, built natively on Bun and esbuild. No AI shortcuts, no Vercel tax; just raw performance and hand-coded stability.For quite some time now, I’ve been quietly building Bunext. It is a full-stack, server-rendering framework for React, built natively on Bun. It handles file-system routing, SSR, HMR, and client hydration, utilizing esbuild to bundle client assets and Bun.serve as the HTTP server.
But this isn’t just a new framework announcement. It’s the story of why I had to build it from scratch, what I learned about the hard limits of current "AI agents," and why I believe the industry is facing a crisis of "slop forks."
The Origin: Breaking Point with Vercel and the App Router
The decision to build Bunext wasn’t born from a desire to reinvent the wheel. It was born from frustration.
I started using Next.js at around v11, long before the App Router was introduced. The Pages Router worked just fine for me; it was stable, intuitive, and stayed out of my way. Then the App Router showed up, and it was just downhill from there.
Once the App Router became the default, it felt like the once-awesome software I loved was being ruined by complexity. I found myself fighting the framework’s opinions more than writing application logic. Eventually, a few months ago, I had enough. I decided to create my own full-stack React framework: one compatible with my workflow, truly platform-agnostic, and essentially a drop-in replacement for the Next.js I loved.
I knew I wasn't alone. A lot of companies and developers have been looking for strong alternatives to Next.js—one of those companies being Cloudflare.
The Illusion of the "Weekend Build": The Vinext "Slop Fork"
You may have heard of Vinext, a Next.js clone created by a Cloudflare employee. It was allegedly built in a single week using AI.
On the surface, it seemed to succeed. It aimed to replicate the core functionalities of Next.js using Vite as the base. However, the developer community quickly (and correctly) dubbed it a "slop fork": i.e., a fork of existing software with AI slop (non-deterministic, unverified code) added on top.
This was when it really struck me: it’s not that easy to create a framework like Next.js.
- Cloudflare tried it and failed.
- OpenNext tried it too, but I wouldn't call that a Next.js replacement—it’s an adapter.
A few other projects have tried to replace Next.js, but none have really succeeded. The reason is that no one has attempted to build it from scratch. Well, I did, and after going through that process, I now understand why no one else has been able to.
The "Final Boss" of Engineering: Hydration and HMR
Let's be clear: building this has been one of the most difficult things I've done in a long time. It forced me to confront the deepest, most complex plumbing of the modern web stack.
I even tossed Claude Code into the mix to help me with the two parts that are statistically the hard limits of AI intelligence: Client Hydration and Hot Module Replacement (HMR).
Why AI "Agents" Plateau at This Level
When you tell an LLM to "build a router," it can pattern-match its way to a functional result. But when you ask it to manage state, concurrency, and security between a server-side render and a client-side JavaScript tree, it fails.
To sum up my experience with Claude Code on the HMR/Hydration logic:
- Claude Code produced about 1,000 lines of code for just this aspect.
- I ended up deleting about 980 of those lines.
- I hand-coded the entire core from scratch.
This project truly hit the hard limit of what AI agents can do. It showed why a "slop fork" couldn't even attempt to build this core from scratch. AI produces plausible patterns, not deterministic logic.
That said, Claude Code did provide a lot of help during this project, mostly with documentation and writing tests (which I hate doing). This is not to put Anthropic or Claude down; it’s simply stating the hard truth that AI simply hasn't reached that level of intelligence yet.
Bunext: Leaner, Faster, and Built on Bun
After spending about two months just to figure out hydration and HMR, the rest was quite easy. I ended up with a leaner and more efficient codebase, built on Bun, that offers all the things I needed from Next.js:
- Server-side rendering (SSR)
- Per-page server logic
- File-based Pages Router
- Custom server
- HMR
- Zero-config TS execution (no transpile step)
Even more, I managed to fix two core headaches with the Next.js Pages Router that the App Router doesn't solve well: per-page CSS imports and Pages directory ignore patterns.
Not to mention, with Bun's native WebSocket support, setting up a WebSocket is already baked-in and doesn't require extra packages or configuration. It is truly platform-agnostic, which was what Cloudflare was going for all along. All this was achieved with a fraction of the codebase of Next.js.
The Big Picture: Our Deficit in Intelligence
Building Bunext wasn't just about shipping code; it was an eye-opening engineering journey. I walked away with two main takeaways:
- We're facing a serious deficiency in actual intelligence. This problem will be exacerbated by Artificial Intelligence (AI). We are tempting developers to stop learning how difficult things like HMR or hydration contexts work, creating an "engineering debt" that will inevitably come due.
- AI as it is now is not being used as it should be. AI is a very useful tool, but it is not a replacement for actual intelligence. It should be used to offload the repetitive work (tests, docs), but never to architect the mission-critical core.
Bunext is my attempt to build a stable, "boring," yet incredibly fast framework for developers who want stability over complexity. It’s built on hand-coded primitives and the fastest JavaScript runtime available.
If you’re interested in a full-stack React framework that stays out of your way, check out Bunext on GitHub.