Tiny Core, Async by Default, No Middleware Bundled
What Is Koa?
Koa is a minimal Node.js web framework by the Express team that replaces callbacks with async/await and collapses req + res into a single ctx object.
What you'll learn
- Understand what Koa is and who built it
- Recognize the core design choices that set Koa apart from Express
- Compare Koa with Express, Fastify, and Hono at a high level
Koa is a web framework for Node.js created by the same team that built Express.
Where Express ships with routing and several built-in helpers, Koa strips
everything back to its smallest useful core: a middleware runner and a single
context object (ctx) that wraps Node’s native request and response.
Why Koa Exists
Express was designed in the callback era. Error handling required four-argument
middleware (err, req, res, next), and async errors could crash the process if
you forgot to pass them to next. Koa was written from scratch to make
async/await the default, so a thrown error inside any middleware is
automatically caught and forwarded.
The Two Core Ideas
Single ctx object. Instead of separate req and res arguments, Koa
merges everything into one context. ctx.method, ctx.path, ctx.body, and
ctx.status are all on that one object.
Cascading middleware via await next(). Each middleware is an async
function. Calling await next() yields to the next layer and resumes when
it finishes — giving you a clean before/after hook in a single function.
Framework Comparison
| Feature | Koa | Express | Fastify | Hono |
|---|---|---|---|---|
| Built-in router | No | Yes | Yes | Yes |
| Built-in body parser | No | Yes (4.x+) | Yes | Yes |
| Middleware model | await next() | next() callback | Hooks + plugins | await next() |
| req + res | Single ctx | Separate | Separate | Single c |
| TypeScript types | Community | Community | First-class | First-class |
| Target runtime | Node | Node | Node | Edge + Node |
When to Choose Koa
Koa is a good fit when you want full control over your stack — you pick your own router, body parser, and auth layer. It is especially popular for JSON APIs, GraphQL servers, and projects where the team values explicit dependency choices over convention.
Koa requires Node 20+ and uses ES modules throughout this course.
Up Next
Install Koa and run your first “Hello World” server in under two minutes.
Installing Koa →