Skip to content
All writing

Fun with Bun

My guess about why Anthropic acquired Bun

Author
Tushar Khairnar
Published
Revised
Not revised
Length
7 min read
Cover image for Fun with Bun

Recently Anthropic aquired Bun - a JavaScript Runtime which claims faster than NodeJS. I was curious about why AI company is interested in acquiring a Opensource DevOps tool. When such things happen its always a major move - Anthropic might make Bun (along with Typescript) defacto way to work with Claude Code. The impact will broader as CC gains significant advantage when its using Bun. Lets explore this in detail

How Bun is different from NodeJs

Bun is quite different from NodeJs - it supports typescript, react natively ie. does not require cross-compile tool-chain. It also does not require a bundler - single tool and single command to run entire backend-frontend in one process. Bun also has differentiated itself from NodeJS - it has added inbuilt support for Databases and other modules which means it can do 70-80% typical webapp natively without needing to NPM Packages. I believe latest version of Node also has similar features but Bun has always positioned itself as more efficient runtime and has proven itself as well.

Why Bun can make working with AI fun?

One of major discomfort for me when working with AI was always - number of processes, environment etc. needing to manage. As we know AI's efficiency goes down as it number of things it needs to track and its hallucination and forgetting increases. If your Agent needs to understand one tool for compiling/cross-compiling, another for linting, one more for testing, packaging, deploying etc. naturally agent is doing too many things. It makes process a simple workflow if lot of this is taken care by the runtime. It just like what container-native means? Earlier when programming languages like Java were called as not-serverless or micro-service friendly because runtime was FAT and would take lot of memory and startup time to boot so it never made sense to run 5 or 10s of JVM for each micro-service or serverless function.

I had this thought many years ago and I even worked with ReactJS like clone which would define a front-end using JSON manifest. Manifest had predefined set of component library support and it was based on Mithril JS. Each JSON object was basically VNode. Simple JS runtime would read JSON and mount the Root Vnode. On the surface it looks like reinventing wheel but what it means is something powerful - If you give AI agent knowledge base about the framework and component library - agent would output JSON which it can readily draw into page. Of course one can do this with ReactJS as well but running ReactJs code with entire UI library would need a bundler as well. JSON is quite readable for Agent and most important thing was - UI could be drawn in Chat Response Widget. It was my prototype for Generative UI year-and-half years earlier. Agent can generate entirely new UI based on current context and user's prompt - with less token and time. The efficiency in this approach makes it practical alternative over Reactjs.

I see something similar happening with Bun. So I decided to test my theory with simple experiment - Take a simple problem implement it using Bun and deploy it and compare how much simpler it is. My target problem was - Wrap Excalidraw into a web-app so that I can save my diagrams into database and view them anytime. CC generated this app within 5 minutes, though it struggled with one issue which was a bug with Excalidraw.

Now the most interesting part was - Deployment. Bun can generate native executable - if your app does not have native modules. I generated an executable using bun compile and with Caddy reverse proxy I was up and drawing diagram in flat 15 minutes. The Service is available at - xcalidraw.druta.io for anyone to use freely. Of course - the major value add here in diagramming tool is Excalidraw, but this example shows how Claude Code + Bun can provide you fastest path to deployment and also simplify development progress. Its a good optimization that make AI agent do less and Less is more.

What this means?

My guess is that Anthropic will push Bun hard and use it for lot of its internal tools as well as user-facing applications - if its not already using it. AI companies follow simple pattern - they work on innovative ideas, implement them using infinite tokens that are available to them, use and refine them internally and if idea has merit and real-world use-case they release it to public (and AI Hype train riders get new shiny toy for their social media content). Anthropic is going to do the same with Bun. It may create something entirely new - Software engineering platform or something as pivotal (or bigger) as of Vercel. This will change entire software engineering tooling - it may change engineering itself just like how Claude Code has convinced majority of programmers to stop hand-coding. It may kill Vibe Coding platforms like Emergent. Or at minimum - it makes Claude Code less buggy or flicker-free.

Edit : Comment by my friend Rajat - his take on the post

Point of Convergence

text
do you think this could be a point of convergence where all the AI clans follow and choose one tool each which can cross-compile, lint, test, package and deploy?

I believe its already reflected in the training of models - models are quite good in front-end code, python/ts over other languages. Hate it or not - its all driven by the data on which models getting trained. and part of data is generated by LLM themselves. Lot of code that's being fed to LLMs as training data is written by LLMs - so its self-momentum-building juggernaut and its here to stay.

New Abstraction Layers

text
do you think this could be a point of convergence where all the AI clans follow and choose one tool each which can cross-compile, lint, test, package and deploy?

Its not easy to do - most of the current effort is re-purpose or add make existing tools AI-Native. Bun does not do something unique that Deno or Node can not do but I believe AI/LLMs have made Bun more valuable than it was in Non-AI world. Think of Vercel and JIRA or Github Issues and PR. These tools are now integral part of AI Software Engineering Tech Stack and used more than it was before 2022. Every Coding agent has integration for it. Now think - What if one command not only does code versioning and PR integration but deploys your changes - which includes running build, tests, update environment with new code or binary, updating SSL certs and host of other things that Vercel does for you. Only Two Exes - Run Code (Bun) and Do DevOps(Vercel + Github) - few years later - these two combine.

BTW - such tools already exist - Beam VM on which Erlang runs and it does lot of above tasks without downtime.

I forgot to add very important point in the blog - JS ecosystem is so broken that someone needs to reset it. Bun could be that player. If Typescript has to be main language that LLMs become expert on, ecosystem needs a new pull - Bun.