Skip to content

Add Koa: async/await Node.js framework by the Express team (~36k ⭐)#77

Open
BennyFranciscus wants to merge 2 commits intoMDA2AV:mainfrom
BennyFranciscus:add-koa
Open

Add Koa: async/await Node.js framework by the Express team (~36k ⭐)#77
BennyFranciscus wants to merge 2 commits intoMDA2AV:mainfrom
BennyFranciscus:add-koa

Conversation

@BennyFranciscus
Copy link
Collaborator

Koa

Language: JavaScript (Node.js)
Stars: ~35,747
Repo: https://github.com/koajs/koa

Koa is the spiritual successor to Express, designed by the same team (TJ Holowaychick) with a cleaner, more modern foundation built entirely on async/await. With ~36k stars, it's one of the most popular Node.js frameworks.

Why Koa in HttpArena?

The Node.js framework lineup now covers the full evolution:

  • bare node — raw http module, no framework
  • Express — the OG, callback-based middleware
  • Koa — Express team's rewrite with async/await
  • Fastify — schema-based, performance-focused
  • Hono — Web Standards (Request/Response API)
  • ultimate-express — Express API on µWebSockets

The key comparison everyone wants: Koa vs Express vs Fastify. Same ecosystem, different middleware philosophies. Express chains callbacks, Koa uses async/await with cascading middleware, Fastify uses schema-based validation for speed.

Implementation

  • Koa 2.x with koa-router
  • Cluster mode (one worker per CPU core)
  • Pre-computed JSON + gzip buffers (/json, /compression)
  • Raw body stream reading for POST endpoints (zero-overhead, no body-parser)
  • better-sqlite3 with mmap for /db
  • HTTP/2 via native http2 module on port 8443
  • Static files served from in-memory cache

All HttpArena endpoints implemented

  • /pipeline — simple text response
  • /baseline11 — GET/POST with query param summing
  • /baseline2 — GET with query param summing
  • /json — JSON serialization benchmark
  • /compression — gzip compressed JSON
  • /db — SQLite query benchmark
  • /upload — POST body size reporting
  • /static/{filename} — H2 static file serving

cc @dead-claudia @jonathanong @juliangruber — would be cool to see how Koa stacks up against Express and Fastify in HttpArena!

Koa is the spiritual successor to Express, built by the same team with a
focus on async/await middleware composition. It's one of the most popular
Node.js frameworks with ~36k GitHub stars.

Implementation details:
- Koa 2.x with koa-router for routing
- Cluster mode (one worker per CPU core)
- Pre-computed JSON and gzip buffers for /json and /compression
- Raw body stream reading for POST endpoints (no body-parser overhead)
- better-sqlite3 with mmap for /db
- H2 via native http2 module on port 8443
- All static file serving via in-memory cache
@BennyFranciscus BennyFranciscus requested a review from MDA2AV as a code owner March 18, 2026 14:09
@BennyFranciscus
Copy link
Collaborator Author

CI is consistently hitting Bind for 0.0.0.0:8080 failed: port is already allocated on the self-hosted runner. Same issue affecting PR #75 (Rocket). The Docker image builds successfully — it's a stale container on the runner holding port 8080.

A quick docker ps + docker stop on the runner should clear it. Build and implementation are ready to go! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant