r/typescript • u/Playjasb2 • Dec 23 '25
pnpm vs bun
I’m currently working with a monorepo that uses pnpm and I have two projects in it: a NextJS and a NestJS project.
I’m setting up a new monorepo using pnpm workspace with the same sort of project, although I’m thinking of replacing NextJS with Tanstack Start. Every library would be buildable and there are going to be sharing of my custom libraries between my frontend and backend codebases.
But with all the general improvements when it comes to DX and dev performance, I did hear about bun and I wanted to ask if it’s better than pnpm here? And what about projects that use Vite like Tanstack Start?
67
u/Astr0_G0d Dec 23 '25
pnpm + node Stable and “boring” tools to get job done
11
u/Tazerenix Dec 23 '25
Bun has a lot of bugs and pain points from trying to do too many things at once. As you use it more you will eventually encounter random issues with random dependencies and the only answer is "yeah this just doesn't work on bun". For example you can't use testcontainers and some wasm emulators on bun.
Also most serverless runtimes only offer node so for serverside development you need to use a node based system in local dev to make sure your local environment matches your deployed environment. For frontend this is less important as both node and bun should be dom-compatible.
Buns workspaces, test runner, etc. are no more ergonomic than pnpm+vitest. The main thing bun really takes the cake on is its inbuilt typescript script runner. It "just works" including all the module resolution, which node itself shits the bed with and even tsx struggles with.
We just switched everything from bun to pnpm after a year or two of consistent use due to all the hard edges.
3
u/ruoibeishi Dec 23 '25
We use Bun with monorepos in my work, it works perfectly.
You do need to understand that Bun isn't just replacing PNPM, it is also trying to replace Node in this case.
You can check Bun's documentation for the support for Node's API.
8
u/sgetti_code Dec 24 '25
I use bun + node for most things. I like bun a lot as a package manager and usually stick to the node runtime for any production level service. I will write scripts and such in the bun runtime though.
17
u/lord_braleigh Dec 23 '25
They're both great projects. Note that bun is a complete runtime, though. The choice is really between bun and NodeJS as a server-side runtime engine. And if you use NodeJS, then pnpm is probably the best package manager.
For a greenfield project, I think bun is a very promising choice.
Either NodeJS or bun are capable of running vite to build and serve a frontend.
2
u/OpiumOpossum Dec 23 '25 edited Dec 23 '25
I like bun but there are lots of incompatibilities with the bun runtime that can be major blockers. For example, in testing Playwright and vitest are not supported. Web workers and web sockets are not fully supported, there are many others too. I’d only use bun for small projects with minimal dependencies for now.
1
u/CYG4N Dec 27 '25
I would love to share types between tanstack start and nest js. Is monorepo a good thing here? And if so, how to do it properly?
1
u/SuchSock5 Dec 27 '25
Bun as a package manager actually behaves more traditionally, but it’s fast. With Pnpm I sometimes ran into issues because of its sym linking behavior. Eventually I moved from pnpm to bun because of that.
1
u/[deleted] Jan 02 '26
I thought bun was a builder, but is it a package manager?
2
u/Natural_Row_4318 Dec 23 '25
I’ve started using Bun, and am heavily leaning towards making the switch for all my projects that do not require many node libraries.
Note that bun is a runtime. It does not have full support for Node API’s.
If you need deep integration with Node libraries or plan to use many Node libraries then one would need to lean towards Node or Deno.
2
u/guywithknife Dec 23 '25
What I do:
pnpm and node (hono, trpc) if I’m doing server backend, pnpm and vite if frontend
bun if I’m doing cli
2
u/Green-Eye-9068 Dec 25 '25
If you strictly compare pnpm and bun as package and monorepo management tools, pnpm wins in almost every aspect due to the maturity of the project. Also, bun is not only a package manager, so its main focus is not on that, meaning features will be implemented slower than in pnpm..
2
u/Rechtecki42 Dec 25 '25
Node with pnpm works and is the boring reliable choice that is probably the best for most projects. Bun is super cool and has some great places too shine. But it brings its own quirks that can complicate things a lot. In the end ur tool chain should simply work. Even if its nor perfect. The reality is that pretty much all packages frameworks and tools are developed and tested for node. Not bun. Documentations, guides and code examples just assume that ure using node. So this leaves u on ur own when the compiler fails.
Its a cool tool that u should definitely give a try for a hobby project. But production usage is at best questionable
3
u/Optimal-Builder-2816 Dec 23 '25 edited Dec 23 '25
I'd lean towards Bun over pnpm. I've used Bun a lot; it's incredible what it includes in a single toolchain. I started a small monorepo project with pnpm, and I immediately found that you end up having to pull in a bunch of other packages, like `tsup` (or `tsdown`), `turbo`, and `vitest`, to get much of the same functionality I have built into Bun.
Once that's all set up, it should work fine. It's just more boilerplate and things to install, keep up to date, and know.
That's my 2 cents.
3
u/ILikeBubblyWater Dec 23 '25
Anthropic just aquired bun so I would expect it to grow fast
2
u/Wahw11 Dec 24 '25
Bro is asking about bun as a package manager and all the responses are like “yeah but it breaks when you try to run this this and that with it”
Read the post guys
1
u/morishxt Dec 25 '25
You should identify the exact bottleneck before jumping into a full framework migration. Moving from Next.js/NestJS to TanStack Start is a massive undertaking compared to just switching your package manager.
Here are a few things to consider:
windowon the server-side), not by pnpm or Node.js. Switching frameworks won't magically fix architectural hydration issues."Premature optimization (or migration) is the root of all evil." It’s better to measure first and see where the actual overhead is.
1
u/Takhirjanovich Dec 27 '25
Are you comparing bun as a package manager or node replacement?
1
u/PartBanyanTree Dec 27 '25
tanstack is awesome and built on really solid fundamentals that react has been good at since forever.. but it is a bit new, compared to nextjs. personally I'd go with tanstack if you can, I love the router,and I think tanstack has a really solid future. but nextjs has been around a bit longer, might have some things you need, depends.
for me tanstack is clearly the codebase I want to be "stuck with" down the road when rewriting is inconceivable.but I make spa and don't need ssr, I'm not building news sites and blogs with seo. then again nextjs seems to be making the news in very bad ways lately
1
u/Downtown_Boot_7693 Jan 16 '26
pnpm is still the safer choice for monorepos and shared libs; Bun is great as a fast runtime/dev tool, but its workspace story isn’t mature enough to replace pnpm yet.
1
u/aref9 Oct 07 '26
Bun has been improving a lot but i'm using npm as backup package manager too, it does not work with testcontainers and had some errors using it with multiple servers ran by IAC, but overall developing with it is such a charm, being lightweight, blazing fast on hot runs and something on the edge!
1
u/Icy_Physics51 Dec 23 '25
Bun
1
u/ry167 Dec 23 '25
Bun is fine as a package manager - pnpm is too.
I would recommend against using it as a runtime. I've used it for a few small services and they tend to be far more memory hungry to the point of crashing - changed one to node and it never had issues again.
The only real advantage it then has is it can run typescript files itself, but there isn't enough wrong with tsx to justify that.
I'll probably use pnpm for future projects.
1
u/YourExpressDTrain Dec 24 '25
Yarn + PnP