왜 나는 PM2 사용을 중단하고 내 자체 Bun 프로세스 매니저를 만들었는가
Source: Dev.to
I loved PM2. Then I switched to Bun.
Six months ago I migrated a handful of microservices from Node to Bun. The speed improvements matched the benchmarks: cold starts dropped dramatically and memory usage shrank. I was thrilled—until I realized that my process manager, PM2, had become the slowest part of the stack, often consuming the most memory. Running a Node‑based supervisor over hyper‑optimized Bun processes felt ironic, so I spent my weekends building a replacement.
The Breaking Point
The final straw wasn’t a single issue but a cascade of small frustrations:
- PM2 occasionally misreported memory usage for Bun processes.
- TypeScript integration required extra flags and workarounds.
- Maintaining a separate
ecosystem.jsonfelt disconnected from the rest of my Bun‑native tooling. - Each
pm2 startincurred a visible delay while the Node daemon spun up before launching a Bun process.
After cataloguing these friction points for a few weeks, the list was long enough to justify a project.
What I Built
BM2 is a process manager that does one thing: manage long‑running Bun processes without any Node dependency.
- No daemon running on a separate runtime.
- No compatibility layers—just Bun managing Bun.
- Familiar CLI syntax.
npm i -g bm2
bm2 start server.ts --name api
bm2 restart api
bm2 logs api --lines 100
bm2 list
Under the hood everything uses Bun’s native APIs:
- Subprocess spawning via
Bun.spawn. - File operations via
Bun.writeandBun.file. - Internal state stored in Bun’s built‑in SQLite.
No fs polyfills, no child_process from Node—pure Bun.
The Results
After migrating services from PM2 to BM2 I observed:
- The process manager starts almost instantly—no daemon boot delay.
- Memory overhead dropped significantly because the manager no longer runs a full Node runtime alongside Bun.
- TypeScript files work out‑of‑the‑box—no extra flags, config, or transpilation.
- The entire stack now runs on a single runtime, giving a coherent developer experience.
Should You Switch?
If you’re running Node services, PM2 remains an excellent, mature, battle‑tested solution.
However, if you’ve committed to Bun—runtime, package manager, test runner—consider whether your toolchain has caught up. Why keep a Node‑based process manager when everything else is Bun?
That question led me to build BM2. It might be the question you’ve been ignoring too.
Links
- Repository:
- Package: