Express is slow. Fastify is fast. Hono is ultrafast — and runs on every JavaScript runtime that exists.
What Is Hono?
Hono (炎 — flame in Japanese) is a lightweight web framework built on Web Standards. It runs on Cloudflare Workers, Deno, Bun, Node.js, Vercel, Netlify, AWS Lambda — anywhere JavaScript runs.
import { Hono } from 'hono'
const app = new Hono()
app.get('/', (c) => c.text('Hello Hono!'))
app.get('/api/users', (c) => c.json([{ name: 'Alice' }, { name: 'Bob' }]))
app.post('/api/users', async (c) => {
const body = await c.req.json()
return c.json({ created: body }, 201)
})
export default app
Middleware Ecosystem
import { cors } from 'hono/cors'
import { logger } from 'hono/logger'
import { bearerAuth } from 'hono/bearer-auth'
import { cache } from 'hono/cache'
import { compress } from 'hono/compress'
import { validator } from 'hono/validator'
import { zValidator } from '@hono/zod-validator'
const app = new Hono()
app.use('*', cors())
app.use('*', logger())
app.use('/api/*', bearerAuth({ token: 'secret' }))
app.get('/static/*', cache({ cacheName: 'my-app', cacheControl: 'max-age=3600' }))
// Zod validation
const createUserSchema = z.object({ name: z.string(), email: z.string().email() })
app.post('/users', zValidator('json', createUserSchema), (c) => {
const data = c.req.valid('json') // Fully typed!
return c.json(data, 201)
})
RPC Client (Type-Safe API Calls)
// Server
const routes = app.get('/api/users/:id', (c) => {
return c.json({ id: c.req.param('id'), name: 'Alice' })
})
export type AppType = typeof routes
// Client — full type safety!
import { hc } from 'hono/client'
import type { AppType } from './server'
const client = hc<AppType>('http://localhost:3000')
const res = await client.api.users[':id'].$get({ param: { id: '1' } })
const data = await res.json() // { id: string, name: string } — fully typed!
Benchmark
| Framework | Requests/sec |
|---|---|
| Hono (Bun) | 130,000 |
| Fastify | 65,000 |
| Express | 15,000 |
Why Hono
- Ultrafast — RegExpRouter is the fastest JS router
- Tiny — 14KB minified, zero dependencies
- Universal — one codebase, any runtime
- Type-safe — RPC client, validated inputs
- JSX — built-in JSX/TSX for server-side rendering
Building web APIs? Check out my developer tools or email spinov001@gmail.com.
Top comments (0)