Bun is rewriting itself in Rust. Zig's biggest showcase changes course.

4 min read 1 source clear_take
├── "The rewrite is a pragmatic ecosystem and hiring decision, not a performance one"
│  └── Jarred Sumner / Bun team (bun.com/blog) → read

The Bun team frames the migration as driven by Rust's larger talent pool, superior documentation, and mature package ecosystem — explicitly not by claims that Rust is faster than Zig. They argue that reinventing dependencies per module in Zig has become an unsustainable tax as the codebase grows into the hundreds of thousands of lines.

├── "Zig's pre-1.0 status made it untenable for a production runtime at Bun's scale"
│  └── top10.dev editorial (top10.dev) → read below

The editorial argues that while Zig's design (comptime, explicit allocators, no hidden control flow) is what made it attractive in 2021, its pre-1.0 status in 2026 and thin standard library create compounding friction for a project of Bun's scale. Being the largest production Zig codebase means Bun was effectively subsidizing the language's maturation rather than leveraging a stable foundation.

├── "This is a significant blow to Zig's mainstream credibility"
│  └── top10.dev editorial (top10.dev) → read below

The editorial highlights that Bun is 'the single project most responsible for Zig's mainstream visibility' — losing it removes Zig's most prominent production showcase. The HN reaction split between 'finally' and 'but what about Zig' reflects the community reading this as a verdict on the language's readiness, not just a Bun-specific engineering choice.

└── "The incremental, API-compatible migration is the right way to de-risk a rewrite of this scale"
  └── Jarred Sumner / Bun team (bun.com/blog) → read

The team commits to a module-by-module port with Zig and Rust code paths coexisting, and preserves the full public API surface (`bun install`, `bun run`, `bun test`, Node.js compatibility). This staged approach lets feature work continue in parallel over multiple quarters rather than freezing development for a big-bang rewrite.

What happened

Bun, the JavaScript runtime and toolchain led by Jarred Sumner, announced that it is rewriting its codebase from Zig to Rust. The post on bun.com/blog frames the move as a long-running engineering decision rather than a sudden pivot: the team plans an incremental port module by module, with the Zig and Rust code paths coexisting during the transition. Public API compatibility is not affected — `bun install`, `bun run`, `bun test`, and the runtime's Node.js compatibility surface all continue to behave the same.

The scale is worth naming. Bun is the largest production Zig codebase in public existence — hundreds of thousands of lines, three years of work, and the single project most responsible for Zig's mainstream visibility. Ripping that out is not a weekend refactor. The blog post concedes as much: it describes a multi-quarter migration that will run alongside continued feature work, with the JavaScriptCore embedding, the bundler, the package manager, and the runtime shell all eventually crossing over.

Numbers on the current state: Bun sits above 78k GitHub stars, ships a 1.x release cadence, and has become the default runtime for a growing slice of new Node-alternative projects. The HN thread on the announcement cleared 399 points in a few hours, with the top comments split between "finally" and "but what about Zig."

Why it matters

The interesting part isn't the language switch. It's the reasoning. Bun's team is not claiming Rust is faster — they're claiming Rust is more hireable, better documented, and has a package ecosystem that no longer needs to be reinvented per module. That is a very different argument than the one runtime teams usually make.

Zig is a beautifully designed language. It has comptime, explicit allocators, no hidden control flow, and a build system that a small team can actually reason about end-to-end. Those properties are exactly why Sumner chose it in 2021. But Zig is also pre-1.0 in 2026, its standard library churns between minor releases, and the total pool of engineers who can be productive in it on day one is a rounding error compared to Rust's. When you're hiring against Deno (Rust), Cloudflare Workers (Rust), and roughly every other new infra project, the math on retention and ramp-up gets ugly fast.

Compare the runtime landscape. Node.js is C++, born of a different era and locked in by V8's embedding surface. Deno chose Rust from day one and has spent five years benefiting from crates.io, `tokio`, `hyper`, and `swc`. Bun's counter-bet was that Zig's low-level control would let a small team out-optimize both. On raw benchmarks — cold start, HTTP throughput, `bun install` speed — that bet mostly paid off. But the bet was never really about the runtime binary. It was about the sustainable team velocity of maintaining a runtime binary. That's where Zig's ecosystem gap kept compounding.

Community reaction is more nuanced than the headline suggests. Andrew Kelley (Zig's creator) has been public about Zig-1.0 targeting quality over hype, and several Zig users on the thread pointed out that Bun's rewrite isn't a repudiation of Zig — it's a signal that a for-profit company running a runtime as its main product has a different risk profile than a game engine or a compiler. The lesson isn't "Zig lost." The lesson is that language choice for a commercial runtime is a hiring decision as much as a performance decision, and pre-1.0 languages carry a hiring tax that eventually shows up on the balance sheet.

The skeptical read: rewriting a working codebase is one of the most expensive things a small team can do, and Joel Spolsky's 2000 essay on this is still cited for a reason. Bun is betting that the port pays for itself in year-two velocity — new contributors ramping in weeks instead of quarters, dependencies pulled from crates.io instead of hand-written, and less time spent tracking Zig's std library breakages. If they're wrong, the story ends with a runtime that ships slower for two years and still isn't Node.

What this means for your stack

If you use Bun in production, nothing changes today. The rewrite is internal. API surface, Node.js compatibility guarantees, and performance characteristics stay put during the transition, and the team has explicitly committed to no user-visible regressions. Keep shipping.

If you were evaluating Bun vs. Node vs. Deno, this arguably makes Bun *more* attractive over a 2-3 year horizon, not less. The single biggest long-term risk with Bun was Zig-ecosystem risk — the chance that a niche language with a small maintainer pool would slow feature velocity or leave critical libraries unmaintained. That risk just went to near zero. Rust's ecosystem is not going anywhere, and the operational calculus for betting on Bun in a corporate stack gets easier once the codebase looks like every other modern runtime.

If you were considering Zig for your own project, this is a data point, not a verdict. Zig is still an excellent choice for a small team writing a well-scoped systems binary — a game, an embedded runtime, a specialized compiler. It becomes riskier as the project grows past a small team's ability to own the entire dependency graph, because that's when you start needing crates you don't want to write. Bun crossed that threshold a year ago and is now paying the exit cost.

Looking ahead

Expect the migration to dominate Bun's release notes for the next 12-18 months, with a slower cadence of user-facing features while the core is swapped out. Watch for two signals: the first Rust-only Bun module shipping to production, and hiring posts that no longer list Zig as a requirement. If both land by year-end, the bet is working. If the release cadence stalls and Node compatibility regresses, it isn't. Either way, Bun just made the strongest argument yet that in 2026, language choice for a production runtime is downstream of the labor market — not the benchmark chart.

Hacker News 710 pts 441 comments

Rewriting Bun in Rust

→ read on Hacker News
padjo · Hacker News

It's very odd how quickly people fall back on emotional claims to attack this. Like we're engineers, if you can point at concrete problems with this rewrite I'd love to hear them. Obviously Jared is going to give the positive case, saying that he's doing that doesn't prove t

pier25 · Hacker News

Personally I don't care that they used AI to rewrite Bun to Rust. Even if 1.4 is not good enough it will probably get better over time.What has pushed me back to Node is seeing how amateurish the transition has been handled.- No LTS support for the Zig version regarding CVEs etc.- Huge bugs lik

didibus · Hacker News

Article did a decent job of showing discipline and care and human involvement to assert the automated rewrite was done diligently, as best as it can be when using AI for it. I does make me feel a bit more comfortable about it.As an aside, I don't know why anyone would not want to use a memory-s

sashank_1509 · Hacker News

I think the important thing is this is much cheaper than hiring a software engineering team. They could have hired me for 200k and I could not do this in a year. I do not have the context, and I do not know Zig or Rust, perhaps I could pick it up in a month, but I would be extremely slow.Forgetting

Philpax · Hacker News

Without commenting on Bun itself as a project, or the nature of the rewrite, it can't be good for Zig that a naive rewrite away from it fixed memory leaks, improved stability, shrunk binary size by 20%, and improved performance by 5%.

// share this

// get daily digest

Top 10 dev stories every morning at 8am UTC. AI-curated. Retro terminal HTML email.