bm2: A 2.8 MB pm2 Replacement Written in MoonBit
Most pm2 deployments use only a few commands but carry the full weight of a Node.js runtime and dozens of unused features. A 2.8 MB native binary that idles at 2.7 MB of RAM makes process management viable on low-resource VPS instances and edge devices where Node-based tooling is too heavy.
bm2 strips pm2 down to the handful of commands most developers actually use: start, stop, status, and auto-restart. A single TOML config file defines apps, instance counts, and base ports. The tool ships as two files and runs a background service that stays under 3 MB of resident memory with 3 ms command response times.
MoonBit compiles to a compact native binary with no runtime, which directly produces the 2.8 MB binary size and low memory overhead. The language's concise syntax also makes the codebase easy to maintain and extend.
Multi-instance execution with automatic port assignment, memory-limit protection, and a confirmation prompt before stopping all apps are built in. Background service upgrades happen without restarting managed applications.
MoonBit's native compilation eliminates the Node.js runtime dependency that makes pm2 itself a non-trivial resource consumer, which is ironic for a process manager meant to be lightweight.
The two-file distribution model (binary plus config) sidesteps npm entirely, which matters on minimal Linux images where a Node toolchain isn't installed.
Porting a well-understood tool like pm2 into a newer language is a practical way to stress-test that language's standard library and FFI for system-level work.