oak is a middleware framework for handling HTTP with Deno, Node.js, Bun, and Cloudflare Workers.
The framework addresses the need for a consistent middleware-based HTTP server abstraction across multiple JavaScript runtimes. It takes inspiration from Koa and its router, providing a familiar API for developers accustomed to middleware frameworks like Express. The core design centers on an Application class that coordinates HTTP server management, middleware execution, and error handling through `.use()` and `.listen()` methods, allowing developers to compose request handlers as a chain of middleware functions.
Developers should choose this tool if they need to write HTTP server code that runs across multiple runtimes without significant refactoring. It suits projects targeting Deno CLI, Deno Deploy, Node.js 16.5 and later, Cloudflare Workers, or Bun, particularly when code portability across these environments is valuable. The framework includes a built-in middleware router. Note that Send, WebSocket upgrades, and TLS/HTTPS serving are not currently supported on Node.js, Cloudflare Workers, or Bun. On Cloudflare Workers specifically, the execution context is not exposed to middleware.
The project maintains active development with regular updates across its multiple runtime targets. Documentation is comprehensive, including a dedicated FAQ section and a community resources site. The codebase is written in TypeScript and distributed through multiple package registries to accommodate different runtime ecosystems.