Skip to content

didiamuri/bun-express

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧪 Bun + Express Benchmark Test

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.

🔧 Stack Used

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

⚙️ Comparison Metrics

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

📊 Observations

  • 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.

To install dependencies:

bun install

To Build

bun build

To run dev env:

bun run dev

To run prod env:

bun run start

This project was created using bun init in bun v1.2.16. Bun is a fast all-in-one JavaScript runtime.

About

Bun + Express Benchmark Test

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors