r/bun • • 4h ago

After import succeeds: 19 npm behavior probes on Bun, Node and Deno (raw results)

1 Upvotes

I maintain CompatLab. Our first study mostly found that popular npm packages loaded successfully, so this follow-up tests what happens when you actually call an API.

We froze 24 package versions chosen for native addons, workers, loader hooks and other Node-specific behavior. Nineteen received named behavior probes; nine had upstream suite or subset attempts, with some overlap. On Linux amd64, Node 26.10.0 and Deno 2.9.7 passed all 19 named probes. Bun 1.4.2 passed 15; the four differences also reproduced on Bun 1.4.4. This deliberately selected sample is not an npm-wide compatibility percentage.

The useful cases were:

• [email protected]: the rebuilt binding failed under its original filename, but a byte-identical renamed copy and the shipped prebuild worked. This independently reproduces earlier work in Bun PR #47648: https://github.com/oven-sh/bun/pull/47648

• [email protected]: the worker started, but our thread task timed out; a package-free message-channel reduction reproduced it.

• [email protected]: import succeeded, then creating the loader hit missing module.registerHooks.

• [email protected]: the timer callback lost its namespace value.

These have prior upstream reports or documented API gaps, linked in the article. The broader suites also exposed failing Node baselines and unequal coverage. Deno's original full Import-fresh suite timed out after two tests.

Update (November 16): we isolated a cross-test async-context leak after a dynamic import on Deno 2.9.7 and 2.9.8. Explicitly binding test callbacks lets all 69 tests finish: 65 pass and four still fail on each Deno version; Node passes all 69. The four failures also reproduce individually without the adapter. This is a runner workaround, not a released Deno fix. Follow-up method and raw receipts; upstream reproduction. The original study data remains unchanged.

The tests ran in disposable gVisor containers with networking disabled during execution, pinned runtimes and dependencies, and Deno -A. Selected native build/install hooks ran offline in the sandbox. Raw JSON/CSV, source pins, replays and limitations are here:

https://compatlab.me/articles/npm-behavior-study-2026-11?utm_source=reddit&utm_medium=community&utm_campaign=npm_behavior_study_2026_11&utm_content=r_bun

I'd appreciate corrections to the probes or interpretation, especially a counterexample on the same package/runtime versions. Which real application behavior should we test next? Public reproductions are welcome; please leave out private code and credentials.

AI assisted the analysis and drafting; the linked receipts preserve the actual executions.


r/bun • • 3d ago

Fixing a long time miss for Bun: HTTP Compression

1 Upvotes

My journey with bun has been amazing so far and I now removed Node for almost everything I do.

But there was still one thing that I got surprised Bun still doesn't support compression of http responses in Bun.serve. Of course you would do it by putting a reverse proxy in front of it. But what if you don't want to spend money with egress to a CDN for example? You are probably losing money right now due to this.

So I made this library to cover for the cases. Free and open source. Hope one day bun covers it so you don't need to think about it.

Fully available NPM: bun-serve-compress - npm


r/bun • • 6d ago

Constructor DI on Bun without decorators or reflect-metadata: how I'm wiring Elysia services (alpha, feedback wanted)

3 Upvotes

I've been building backends on Bun + Elysia, and once a service grew past a handful of routes I wanted some kind of dependency injection for shared clients, test fakes and request-scoped state. I just didn't want decorators, emitDecoratorMetadata, or something that replaces Elysia's router.

So I started a small framework called Elpod. A class lists its dependencies in a plain static tuple and the container builds the graph from that, with no reflection and no hidden global singletons. Controllers still register normal Elysia routes, so validation, WebSockets and streaming stay Elysia's job.

export class ReportService {
  static readonly needs = [Clock] as const;
  constructor(private readonly clock: Clock) {}
}

It's an early alpha (0.1.x, MIT) and the API may change, and for a small service plain Elysia is honestly simpler. I'm curious how other Bun folks handle DI today, and whether the static needs tuple reads fine or feels too verbose. Docs are here if you want a look: https://elpod.vercel.app/docs/


r/bun • • 7d ago

Introducing Skif - a repository/monorepo linter written in Rust

10 Upvotes

Hi Peeps,

I want to share with you a tool I am working on. Its still early, but I already use it and it works well.

So story goes like this - I was working on restructuring a very large monorepo with disparate package managers and versions into a single PNPM workspace. When I was finished I decided I am going to enforce certain conventions so it could not drift again without failing CI. I set this up, and found myself using several different tools -Sherif, Syncpack and Knip to ensure that the repository doesn't drift again. This setup, while working, is rather clanky and also suffered from some issues - mainly performance, but also a few bugs.

I therefore decided I will build my own tool. I forked Sherif as a baseline, and built on top of it while substantially rewriting and extending its capabilities. The result is skif: a Rust linter and enforcement tool for JS/TS dependencies and monorepos.

skif replaces sherif and syncpack, and most of what knip does (the aim is to offer a full replacement for Knip in the future) in a single, ultra fast, binary.

npx skif-cli              # lint the workspace or package you are in
npx skif-cli --fix        # apply safe fixes
npx skif-cli migrate      # turn sherif, syncpack and knip config into a skif.toml

Where it came from

skif started as a fork of sherif, and the workspace and manifest rules are ported from it. The version and catalog policies follow syncpack's model. The dead-code analysis follows knip's issue types.

It has since gone past the fork. It ports every sherif rule, adds new ones and fixes, and runs faster on every target measured. On the syncpack side it enforces version, range, banned-dependency and catalog policy.

What it deliberately does not do is sync versions. skif is a linter: it tells you a policy is broken and fails CI. Moving versions in step is left to specialized tools or the package manager's themselves. If you need this, use syncpack for example.

What it checks

42 rules:

  • Manifests and workspace: empty dependency maps, types in dependencies, root private and packageManager, unsorted dependencies, workspace globs that match nothing, members without a package.json.

  • Version policy: mismatched versions, semver range policy, banned dependencies, catalogs (missing entries, unused entries, references that do not resolve), workspace: protocol, peer dependency compatibility.

  • Dead code: unused files, exports, types, enum members and dependencies; unlisted dependencies and binaries; unresolved imports; circular imports. Leveraging the OXC ecosystem for this.

It also adds some new rules, such as incompatible-peer-dependencies and workspace-protocol.

Skif lifts the idea of framework plugins - which allow it to understand different types of entrypoints (e.g. Next.JS, Vite, Storybook etc.). But unlike Knip, which loads these files, Skif doesn't actually load code - it only statically analyses it. This removes a potential surface for code execution, and is altogether much faster, although it does bring in the potential to some imprecision.

Supported package managers

Skif supports all major package managers - npm, pnpm, Yarn classic, Yarn Berry as well as Bun. It does not support Deno, although if there is a need it might in the future. It also supports Rush and Lerna workspaces.

Benchmarks

Speed

Medians of 15 runs on a 4-vCPU Linux VM, pinned public repositories, dependencies installed:

Repositoryskifknip
create-t3-turbo32 ms2.0 s
vue-core62 ms1.7 s
tanstack-query375 ms4.5 s
npm-cli99 ms968 ms
babel884 ms7.2 s

Manifest checks alone (--no-js) against sherif and syncpack:

Targetskifsherifsyncpack
create-t3-turbo4.6 ms36 ms41 ms
babel9.4 ms37 ms280 ms
2,000 generated packages102 ms130 ms655 ms

sherif is already fast Rust, so the margin there is small: 1.3x at 2,000 packages. The real win is knip, and not paying for three processes.

Links

P.S.

Note: This is an early project, it is on v0.2.0. I am very eager to have users, since it will improve the tool and help me fix bugs. But do expect some issues!

Thanks for reading, this was a human written post (the benchmarking data was done by an LLM). If you find the tool useful, star it!


r/bun • • 7d ago

A design-system for Hono JSX

Post image
4 Upvotes

r/bun • • 8d ago

WebLoad: "https:" Imports With Caching And Access Control

Thumbnail
reddit.com
1 Upvotes

r/bun • • 9d ago

bun update --no-save vs npm update --no-save

4 Upvotes

There is difference between bun and npm update command.

While both programs install possible new package versions into node_modules and do not touch package.json bun doesn't write updated lockfile while npm does.

Our workflow is based on that updated lockfile generated by npm - we commit that lockfile into git.


r/bun • • 10d ago

Using Bun for installation, builds, and tests in a Lit design-system workspace

3 Upvotes

We’re building DS-GN, a CLI that generates a Lit design-system workspace. We chose Bun for speed and fewer separate development dependencies: package installation, TypeScript build scripts, component bundling, and unit tests use the same tool. The walkthrough covers scaffolding and workflow; we haven’t published a comparative performance benchmark.

The generated workspace has token and UI packages. bun install installs dependencies, bun run build runs the generated build scripts, and bun run test runs the test workflow, including preparing component CSS. Component bundling uses Bun.build and unit tests use bun test. For iteration, the UI watcher rebuilds a component when its TypeScript source changes; optional Storybook runs alongside it.

We still use a Lit CSS plugin, Storybook, and TypeScript declaration tooling. Bun’s filters and package scripts cover basic workspace task execution; teams that need shared build caching or package versioning and release workflows can add specialized tools. Choosing Bun also means requiring it: the current scaffold requires Bun 1.4.4 or later. You can choose TypeScript or JavaScript and CSS, Sass, or Tailwind. The generated code lives in your repo, under your control.

I wrote up the commands, configuration, generated files, and a creation recording in the workflow walkthrough. The CLI currently uses a restricted registry, so this is an internal source-checkout preview rather than a public install tutorial. There’s an early-access email waitlist; joining doesn’t give immediate access, and timing and pricing are still to be announced.

For those using Bun in component-library workspaces: which parts of your build or test setup still need separate tools, and why?


r/bun • • 11d ago

Introducing Bunminer — an Adminer-style database manager in Bun (no PHP)

5 Upvotes

Artur Abovyan and I wanted a database manager like Adminer but native to the Bun ecosystem, so we built Bunminer. It's a self-hosted web app for MariaDB/MySQL, PostgreSQL, and SQLite: browse tables, run SQL with a results grid + export, create/edit/drop tables/columns/indexes/views, import/export, and manage users. Unlike Adminer, though, it's not a single page management system -- it uses an MVC framework for easier modification.

Stack: Bun + BriskMVC/a thin Elysia wrapper + Bootstrap 4 + jQuery + EJS. MIT.

Security is baked in, not bolted on: parameterized SQL everywhere, CSRF protection, signed sessions, rate-limited login, and database passwords stay in server memory only (never written to disk).

Repo: https://github.com/volomike/bunminer

Screenshot

Would love feedback — especially from anyone who's run a DB-admin tool in production on Bun.


r/bun • • 16d ago

X3Bun a Hono/TanStack Start/tRPC/Better-Auth Turborepo Starter App

Thumbnail
github.com
15 Upvotes

This is simply a starter template that I use and I thought of sharing

  • Bun optimized

  • Front End: Tanstack Start, Tanstack Query, and Shadcn

  • Backend: Hono with tRPC

  • Authentication: Better-Auth

  • Repo Management: Turborepo

I encourage you to check and share your opinion


r/bun • • 19d ago

Dependabot alerts don't read bun.lock, so transitive dependencies in Bun projects never get an alert

Post image
16 Upvotes

I noticed something odd on our Bun projects: every Dependabot alert was about a direct dependency. Never a transitive one.

It turns out GitHub's dependency graph doesn't read bun.lock yet. It supports package-lock.json, yarn.lock and pnpm-lock.yaml, but for Bun it falls back to package.json. So:

  • Transitive dependencies aren't in the graph at all, so they never get an alert.

  • Dependencies declared with catalog: are recorded with the literal version catalog:, which never matches an advisory.

In a minimal repro (zod, a package that pins an old uuid, and happy-dom through a catalog), bun audit finds 3 advisories and Dependabot raises 1.

Dependabot version updates do support Bun. This is only about alerts, which is what makes it easy to miss. And if you migrated from npm or Yarn, the alerts tied to your old lockfile get marked as fixed, even though the vulnerable packages are still in bun.lock.

Are you affected? Open Insights → Dependency graph. If your Bun projects only list package.json files, yes. Comparing your open alerts with bun audit makes it obvious.

Fix: until GitHub reads bun.lock itself, you can submit it through the dependency submission API. I made a GitHub Action for that: https://github.com/charpeni/bun-lock-submission

Full write-up, with a toggle that shows what GitHub reads versus what Bun installs: https://charpeni.com/blog/the-bun-dependabot-gap-dependabot-alerts-dont-see-bun-lock


r/bun • • 20d ago

Bun nest adapter

Thumbnail
reddit.com
3 Upvotes

r/bun • • 20d ago

VoltTS

0 Upvotes

Hey developers! 👋

I've been working on VoltTS ⚡, an open-source TypeScript backend framework designed to make building APIs fast, simple, and enjoyable.

I started this project because I wanted to explore whether I could combine the best ideas from frameworks like Express, NestJS, Fastify, Hono, and Elysia while keeping the developer experience simple.

⚡ What is VoltTS?

VoltTS focuses on:

- High-performance HTTP routing

- TypeScript-first development

- Simple and intuitive APIs

- Lightweight, modular architecture

- Developer-friendly tooling

- Scalable backend applications

📃 Initial Performance Results

In my local benchmarks using Bun, VoltTS achieved approximately 47K–49K requests per second on simple API scenarios.

I'm continuing to benchmark against Elysia, Hono, Fastify, and Express.

Of course, synthetic benchmarks don't tell the whole story. I'm also interested in real-world performance, maintainability, and developer experience.

🎯 My Goal

I'm not trying to reinvent everything from scratch just for the sake of it.

I want to build a modern backend framework that combines performance, simplicity, and an architecture suitable for both small APIs and larger applications.

💬 I'd Love Your Feedback!

I'm especially interested in hearing:

What makes you choose one backend framework over another?

What features would make you consider trying VoltTS?

What do you dislike about existing TypeScript backend frameworks?

What should I prioritize next?

I'm building this project openly and would really appreciate constructive criticism, suggestions, and contributions.

Documentation: https://voltts.chansythor.com

GitHub: https://github.com/chansy-khuexonglue/voltts

Thanks for checking it out! ⚡


r/bun • • 20d ago

Whats your the biggest Bun performance surprise?

1 Upvotes

For me its bun test its crazy fast compared to jest. (https://jestjs.io)

Jest is advertised as with a focus on simplicity. But configuration is complex for babel/ts/mocking/lint setups.


r/bun • • 25d ago

Bun v1.4.4

Thumbnail
bun.com
81 Upvotes

r/bun • • 27d ago

Knitting — a shared-memory concurrency runtime for JavaScript

Thumbnail
js.knitting.run
4 Upvotes

r/bun • • 27d ago

Elysia 2 RC is here

Thumbnail
next.elysiajs.com
58 Upvotes

r/bun • • 29d ago

Show HN: Nub – A Bun-like all-in-one toolkit for Node.js

Thumbnail
github.com
4 Upvotes

r/bun • • Oct 16 '26

pboss vs pm2 on Bun: pm2 can't cluster a Bun app at all, and fork mode is closer than you'd think

7 Upvotes

We ran pboss 1.8.0 against pm2 5.4.3 on Bun 1.3.14. Same server.ts, same Bun executable, same machine, same autocannon profile (10/100/500 connections, 60s, 5 repeats). Cold start of the whole manager stack every run, manager order alternating, CPU and RAM sampled across the entire process tree. The numbers below measure the cost of managing a Bun server, not Bun's raw HTTP performance.

Cluster mode: pm2 is "not supported", literally

Here's the headline, and it isn't a benchmark result. It's a capability table:

Featurepm2pboss
Cluster a Bun appnot supported--instances N, workers share one SO_REUSEPORT port
100 conns, 2 workers—73,204 req/sec, 0.78 ms mean, 0 errors
Worker killed, port stays up—respawns in 81 ms, /health up 100% of kills
50-restart storm, all workers back—178 ms median, 0 failures, 0 orphans

Why pm2 shows up as a blank column and not a losing one, straight from the report: pm2's cluster mode is node:cluster living inside its Node daemon. cluster.fork() always runs the daemon's own runtime and ignores --interpreter, and pm2 only enters cluster mode when the interpreter path contains "node". So pm2 start -i N --interpreter bun silently falls back to fork mode, and forcing exec_mode: "cluster_mode" runs your workers under Node instead of Bun. Rather than dress up fork-mode numbers in a cluster label, the benchmark records pm2 as not supported.

Meanwhile pboss runs a real process-based cluster for Bun: N workers of the same server.ts, kernel balancing connections across the shared port. At 500 connections it serves 66,007 req/sec mean with zero errors, and a SIGKILLed worker is replaced in 81 ms while the port never stops answering.

If you want HA for a Bun app today, the choice is pboss or hand-rolled.

Fork mode: closer than the Node report, and the trade-offs are clear

Fork mode at 100 connections, one managed process:

Metricpm2pboss
Mean req/sec73,89272,139 (-2.4%)
Median req/sec74,12672,798 (-1.8%)
RPS stdev2,9351,124 (-62%)
latency (mean)0.70 ms0.84 ms (+0.14 ms)
p50 latency0.00 ms0.00 ms (tie)
p99 latency25.00 ms25.00 ms (tie)
CPU avg (tree)67.0%66.9% (-0.1%)
memory avg (tree)119.5 MB117.9 MB (-1.3%)
cold start389 ms338 ms (-13%)
errors / timeouts / non-2xx0 / 0 / 00 / 0 / 0

Read honestly: pm2 takes mean throughput by 2.4% and mean latency by 0.14 ms at 100 connections. Both are small, and note the tail is identical (p99 tied at 25 ms, p50 tied at sub-millisecond). What pboss takes back: RPS spread cut by 62%, meaning the numbers you get every second are much more predictable, plus lower CPU, lower memory, and a 13% faster cold start.

At 10 connections it flips: pboss wins median RPS by 2.6% and mean by 4.4% (pm2's spread is tighter there). At 500 connections pm2 keeps a 1.5 to 1.7% throughput edge while pboss keeps the steadier RPS (-55% stdev), lower CPU at every percentile, 2.5% less memory, and the same 13% startup advantage.

So in fork mode on Bun, pm2 is a legitimate opponent on raw throughput. That's the honest version. Now the part where the fight actually gets decided.

Startup, recovery, and storms

Metricpm2pboss
cold start, fork385 ms337 ms (-12.5%)
warm start, fork192 ms117 ms (-39%)
warm start, cluster—158 ms
SIGKILL recovery, median66.5 ms66.0 ms
SIGKILL recovery, worst case74 ms66 ms (-11%)
50-restart storm, fork255 ms129 ms (-49%)
storm memory growth, fork+0.0 MB-0.1 MB
storm, cluster (all workers)—178 ms, 0 failures
idle daemon memory66.3 MB63.7 MB (-4%)

Warm restarts are 39% faster under pboss, which you feel in every watch-mode save and every rolling deploy. Fork-mode crash recovery is roughly tied here (Bun apps come back fast either way), but the storm numbers separate: 50 restarts at 129 ms vs 255 ms, memory flat or slightly down for pboss, zero failures and zero orphans for both. And the cluster storm column exists only for pboss, because again, pm2 can't run it.

The honest list of pm2 wins

  • Fork mode, 100 connections: mean throughput +2.4%, mean latency +0.14 ms.

  • Fork mode, 500 connections: median and mean throughput +1.5 to 1.7%, p90 latency 7 ms vs 8 ms.

  • Fork mode, 10 connections: tighter RPS spread.

  • Crash recovery (fork) is a tie at median, 66.5 vs 66.0 ms.

That's it. Tiny margins on raw throughput in the mode where both tools do the same thing. Everywhere the tools diverge in capability (cluster), or where operations are on the line (startup, storms, stability, memory), pboss wins or is the only entry on the board.

Everything around it

Health checks, cron restarts, log rotation with gzip, web dashboard, Prometheus /metrics, namespaces, dependency-ordered startup, replace-first rolling reloads. Under Bun the manager runs on Bun.spawn, Bun.serve and Bun.file directly. Open source, GPLv3.

Don't take our word for it. Every number traces to a raw file in results/raw/, the load generator shared CPUs with the servers so compare the columns rather than quoting absolutes, and the benchmark script is three commands:

cd benchmarks/bun && npm install
bash scripts/benchmark.sh

Rerun it on your own hardware and tell us what changes.


r/bun • • Oct 15 '26

bun lint - 26x faster ESLint-compatible linter that reads eslint & oxlint configs.

Post image
83 Upvotes

Also supports eslint plugins.

This is coming in the next version of Bun.


r/bun • • Oct 13 '26

From Mongoose to SQL

Thumbnail
uql-orm.dev
4 Upvotes

The first time I wrote MongoDB queries with Mongoose, ~2015 (IIRC), I felt the real power of JSON in a database. SQL databases were barely starting to support it (with jsonb in Postgres being former IIRC), and no ORM I knew treated JSON as more than a blob. I wanted an ORM that supported all of it, with one query language for SQL and MongoDB, so moving between them would be quick. UQL is that ORM, and that is why its queries look like MongoDB's.

Another part in the history of "why UQL" is because GraphQL felt like a monster to me (in most cases), so I had to write something better and cleaner, but that is another story my friend...


r/bun • • Oct 13 '26

bun fmt - 320x faster Prettier alternative builtin to Bun

Post image
125 Upvotes

This is coming in the next version of Bun


r/bun • • Oct 12 '26

Hono vs Elysia on Bun: matching the unknown-key cleaner closed about 70% of the /echo gap

5 Upvotes

Our first run of Elysia 2 (beta.12) vs Hono 4.13 on Bun came back with every window valid. Before we wrote it up, we noticed the two apps didn't validate the same way.

Elysia 2 compiles its schemas with typebox 1.3. Our Hono app was calling @sinclair/typebox 0.34 through Value.Default, Convert, Clean and Check, the interpreted path of an older major version. Hono's own @hono/typebox-validator compiles. So we'd measured Hono with an older, interpreted validator that we picked. The results file is still in the repo with a commit saying it's confounded on every validated route.

We moved Hono to compiled TypeBox 1.3.26 and expected the /echo gap to shrink. It got wider. A quick check showed it first, and the full rerun agreed.

So we looked at the step after validation. /echo drops unknown keys from the body (a parity check posts an extra field and expects it gone), and our Hono app did that with TypeBox's Clean, same as useClean in the official validator. Elysia uses exact-mirror for this. It's its own npm package, so we added a third config: the same Hono build with exact-mirror swapped in and nothing else touched. Parity passed 38/38 on all three.

Run of record, Bun 1.4.2, c=100, req/s, median of three 30 s windows:

route     elysia   hono+Clean   hono+exact-mirror
/health   142,489    139,202        139,159
/echo     126,490    103,350        119,576
/orders    30,789     26,373         30,907
/me        27,985     27,836         27,814

The cleaner swap recovered about 16k of the 23k req/s /echo gap, roughly 70%. Hono is still about 5% behind there. /orders, the other route with a validated body, is level once the cleaners match. Postgres and the load generator shared one laptop with the API, so absolute numbers are soft.

If you've benchmarked Hono with a schema validator, which cleaner did you end up on? We've only tried these two.


r/bun • • Oct 10 '26

Bun v1.4.3

Thumbnail
bun.com
81 Upvotes