A middleware framework for handling HTTP with Deno, Node.js, Bun, and Cloudflare Workers, inspired by Koa.
Oak is a middleware framework for building HTTP servers in JavaScript and TypeScript. It provides tools for handling requests, routing, static files, and errors across runtimes like Deno, Node.js, Bun, and Cloudflare Workers. It solves the need for a consistent, modern API to develop web applications and APIs without being locked into a single runtime.
JavaScript/TypeScript developers building web servers, APIs, or applications who need cross-runtime compatibility or are working in Deno, Node.js, Bun, or Cloudflare Workers environments.
Developers choose Oak for its clean, Koa-inspired middleware pattern, strong TypeScript support, and seamless multi-runtime deployment. It reduces boilerplate with a unified context API and offers built-in routing and static file serving.
A middleware framework for handling HTTP with Deno, Node, Bun and Cloudflare Workers 🐿️ 🦕
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Oak works seamlessly across Deno, Node.js, Bun, and Cloudflare Workers, as highlighted in the README's multi-runtime support, allowing developers to write once and deploy anywhere with minimal changes.
It uses an async middleware stack similar to Koa, enabling fine-grained control over request/response flow, demonstrated in the logging and timing examples where middleware can await next() and modify headers.
Includes a router with parameter parsing, nested routing, and path-to-regexp support, making it easy to define RESTful endpoints without external dependencies, as shown in the book API example.
Aligns with Fetch API standards for body parsing (e.g., .json(), .formData()) and uses Request/Response objects, reducing boilerplate and improving interoperability with web standards.
Offers a send() function with ETag and caching headers for serving static assets, automatically handling conditional requests to improve performance, as detailed in the static content section.
The README notes that send(), WebSocket upgrades, and TLS/HTTPS are not supported in Node.js, Cloudflare Workers, and Bun, limiting functionality for some use cases without workarounds.
Oak warns that .hasBody is an unreliable API due to HTTP/2 streaming, forcing developers to manually handle body parsing in edge cases, which can lead to bugs if not carefully implemented.
Compared to Express, Oak has a less mature ecosystem with fewer third-party middleware options, requiring more custom solutions for common tasks like authentication or validation.
Significant breaking changes were introduced in v13 (e.g., request body API overhaul), indicating potential future instability that could complicate upgrades for long-term projects.
oak is an open-source alternative to the following products:
Koa is a minimal and expressive web framework for Node.js designed by the creators of Express, using async functions to eliminate callback hell and improve error handling.
Express is a minimal and flexible Node.js web application framework that provides a robust set of features for building web and mobile applications. It simplifies server-side development with routing, middleware support, and HTTP utility methods.