This test aimed to compare the performance and integration of Bun with an existing Node.js backend stack built with Express, Inversify, MongoDB, and Redis. The backend is a REST API microservice for the AnywrPOS platform.
Bun v1.2.16 vs Node.js v22
Express v4.21.1
MongoDB (via mongoose)
Redis (via ioredis)
InversifyJS (with inversify-express-utils)
Build tool: bun build vs esbuild (pnpm build)
Containerization: Multi-stage Dockerfile for both environments
Metric Bun Node.js
-----------------------------------------------------------------------
Docker build time ~7.3 seconds ~25.0 seconds
Final image size ~295 MB ~290 MB
App startup time ~83 ms ~81 ms
API TTFB (via APIDog) ~28 ms ~79 ms
- Bun provides faster build and startup times.
- Node.js is more compatible, especially with packages like socket.io.
- Both are viable for production, especially when containerized via Docker.
bun installbun buildbun run devbun run startThis project was created using bun init in bun v1.2.16. Bun is a fast all-in-one JavaScript runtime.