Skip to content
TopicTracker
From HackerNewsView original
TranslationTranslation

Rewriting Bun in Rust

Bun, the JavaScript runtime originally written in Zig, has been rewritten in Rust to improve performance, stability, and developer experience. The transition aims to leverage Rust's mature ecosystem and safety guarantees while maintaining full compatibility with existing JavaScript and TypeScript applications.

Background

Bun is a fast all-in-one JavaScript runtime and toolkit (like Node.js or Deno, but bundled with a package manager, test runner, and bundler). It was originally built using **Zig**, a low-level systems programming language. This post announces that Bun's core is being rewritten in **Rust**, another systems language known for memory safety, performance, and a large ecosystem of libraries ("crates"). Key context: The rewrite is specifically for *JavaScriptCore* (the engine powering Bun), not the whole project. The reason given is that Rust's ecosystem (especially its parser tooling like `nom` and `winnow`) is more mature and practical for building reliable, fast JavaScript parsers than Zig's. This is notable because Bun is a high-profile project that bet big on Zig early on, and the shift signals a pragmatic move toward Rust's richer library support for certain compiler-like tasks.

Related stories