Skip to content
On this page

Hono

Hono - [炎] means flame🔥 in Japanese - is a small, simple, and ultrafast web framework for the Edge. It works on Cloudflare Workers, Fastly [email protected], Deno, Bun, Vercel, Lagon, Node.js, and others. Fast, but not only fast.

ts
import { Hono } from 'hono'
const app = new Hono()

app.get('/', (c) => c.text('Hono!'))

export default app
import { Hono } from 'hono'
const app = new Hono()

app.get('/', (c) => c.text('Hono!'))

export default app

Quick Start

npm create [email protected] my-app
npm create [email protected] my-app

Features

  • Ultrafast - The routers are really fast and smart. Not using linear loops. Fast.
  • Multi-runtime - Works on Cloudflare Workers, Fastly [email protected], Deno, Bun, Lagon, or Node.js. The same code runs on all platforms.
  • Batteries Included - Hono has built-in middleware, custom middleware, and third-party middleware. Batteries included.
  • Delightful DX - First-class TypeScript support. Now, we've got "Types".
  • Small - About 20kB. Zero-dependencies. Using only Web Standard API.

Ultrafast

Hono is the fastest, compared to other routers for Cloudflare Workers.

Hono x 385,807 ops/sec ±5.02% (76 runs sampled)
itty-router x 205,318 ops/sec ±3.63% (84 runs sampled)
sunder x 287,198 ops/sec ±4.90% (74 runs sampled)
worktop x 191,134 ops/sec ±3.06% (85 runs sampled)
Fastest is Hono
✨  Done in 27.51s.
Hono x 385,807 ops/sec ±5.02% (76 runs sampled)
itty-router x 205,318 ops/sec ±3.63% (84 runs sampled)
sunder x 287,198 ops/sec ±4.90% (74 runs sampled)
worktop x 191,134 ops/sec ±3.06% (85 runs sampled)
Fastest is Hono
✨  Done in 27.51s.

See more benchmarks.

Why so fast?

RegExpRouter is the fastest router in the JavaScript world. And Smart Router is really smart. It automatically picks the best router from the following routers. Users can use the fastest router without having to do anything!

  • RegExpRouter - Match the route using one big Regex made before dispatch.
  • TrieRouter - Implemented with Trie tree structure. Supports all routing patterns.

See more information about routes.

Hono in 1 minute

A demonstration to create an application for Cloudflare Workers with Hono.

Demo

Not only fast

Hono is fast. But not only fast.

Run anywhere

Thanks to the use of the Web Standard API, Hono works on a lot of platforms.

And by using a Node.js adaptor, Hono works on Node.js.

See more information about Web Standard.

Do everything

Built-in middleware makes "Write Less, do more" a reality.

Out of the box, Hono provides middleware for:

For example, adding ETag and request logging only takes a few lines of code with Hono:

ts
import { Hono } from 'hono'
import { etag } from 'hono/etag'
import { logger } from 'hono/logger'

const app = new Hono()
app.use('*', etag(), logger())
import { Hono } from 'hono'
import { etag } from 'hono/etag'
import { logger } from 'hono/logger'

const app = new Hono()
app.use('*', etag(), logger())

See more information about Middleware.

Small

Hono is small. About 20KB when minified. There are many middleware and adapters, but they are bundled only when used. For context, Express bundle size is 572KB.

Developer Experience

Hono provides a delightful "Developer Experience". Easy access to Request/Response thanks to the Context object. Hono is written in TypeScript. Hono has "Types".

For example, the path parameters will be literal types.

SS

And the Validator and Hono Client hc enable the RPC mode. In RPC mode, you can use your favorite validator such as Zod and easily share server-side API specs with the client and build type-safe applications.

See Hono Stacks.

Released under the MIT License.