What is the real difference between Hono and Express?

Express is a thin layer over Node's http module. Each handler receives Node's IncomingMessage and ServerResponse, extended with helpers such as req.params and res.json(). A handler responds by writing to the res object. The framework assumes a Node process with a socket underneath.

Hono is built on the Web Standard Request and Response objects defined by the Fetch API. A handler receives a context c, reads the request through c.req, and returns a Response, often built with helpers like c.json(). The app exposes a single fetch(request) entry point.

Express Hono
JSON endpoint res.json({ id: req.params.id }) return c.json({ id: c.req.param('id') })
Input object Node IncomingMessage (extended) Web Request (wrapped in context)
Output Write to ServerResponse Return a Response

The layering looks like this:

Layer Express Hono
Your handlers req, res c → Response
Framework core Express Hono (app.fetch)
Interface Node http objects Web Request / Response
Runtime Node only Node (via adapter), Deno, Bun, edge runtimes

This return-a-Response contract is what makes Hono portable. Router speed has little to do with it. Deno, Bun and most edge platforms already speak fetch(Request) → Response, so Hono plugs in directly. On Node, an adapter converts IncomingMessage into a Request and streams the returned Response back.

Express code that touches res is tied to Node's HTTP layer. Moving it to an edge runtime means changing how every handler produces its output.

// express-app.ts: the handler writes to Node's ServerResponse
import express from 'express';

const ex = express();
ex.get('/users/:id', (req, res) => {
  // Output is a side effect on `res`; nothing is returned
  res.json({ id: req.params.id });
});
ex.listen(3000); // needs a Node process and http server

// hono-app.ts: the handler returns a Web Standard Response
import { Hono } from 'hono';

const app = new Hono();
app.get('/users/:id', (c) => {
  // c.json() builds and returns a Response object
  return c.json({ id: c.req.param('id') });
});

// The whole app is one function: fetch(Request) -> Response.
// You can call it directly, with no server or socket involved.
// app.request() is a test helper that builds a Request from a path and calls app.fetch:
const res = await app.request('/users/42');
console.log(res.status, await res.json()); // 200 { id: '42' }

// Deno and Bun accept a default export that has a fetch method
export default app;

// Node needs an adapter that converts IncomingMessage into a Request:
// import { serve } from '@hono/node-server';
// serve({ fetch: app.fetch, port: 3000 });

The same JSON endpoint in both frameworks: the Express handler writes to Node's res object, while the Hono app is a plain fetch(Request) → Response function that you can call directly or pass to any runtime that speaks Fetch.

How does Hono work?

A Hono app is an object whose fetch(request, env, executionCtx) method the runtime calls once per request. The env and executionCtx arguments are optional. Runtimes such as Cloudflare Workers pass bindings and an execution context through them. Plain Node, Deno or Bun setups usually pass only the request.

For each request, Hono does the following:

  1. Builds a context. It wraps the incoming Request in a context object c. The context exposes c.req for reading the request, c.env for runtime bindings, response helpers such as c.json() and c.text(), and c.set()/c.get() for passing values between middleware and handlers.
  2. Matches the route. The router takes the method and path and returns every middleware and handler that matches, in registration order. Hono ships several router implementations. The default, SmartRouter, picks between RegExpRouter and TrieRouter based on the registered routes. You can pass a different router to the Hono constructor.
  3. Composes the chain. The matched functions run as an "onion". Each middleware receives c and next. Calling await next() runs the rest of the chain, then control comes back to the middleware, which can inspect or replace c.res.
  4. Produces a Response. The final handler returns a Response. Hono stores it on c.res, unwinds the middleware, and returns the final c.res from fetch.
  5. Handles failures. If nothing matches, the notFound handler builds the response. If anything in the awaited chain throws, onError builds it.

Express follows a different model. It walks a stack of layers, and each layer passes control with next() without getting it back. It finishes when some layer writes to res. In Hono the response is a value that flows back up through the middleware. In Express it is a side effect on a shared object.

Who should use Hono?

Hono fits these cases well:

  • Teams starting a new TypeScript API. Route-inferred types and the hc client pay off from the first endpoint, and there is no Express middleware to port.
  • Services that deploy to edge runtimes, Deno or Bun, or to more than one runtime. The fetch(Request) → Response contract runs on all of them without a rewrite.
  • Small, focused services such as proxies, webhooks, BFF layers and auth gateways. These use few middleware dependencies, and Web Standard APIs cover most of their needs.
  • Teams that want to unit-test handlers without a server. You can call app.request() or app.fetch() directly and assert on the returned Response.

Express still fits mature Node services, teams with deep operational experience on Express, and codebases that depend on its middleware ecosystem.

When should you avoid Hono?

Skip Hono, or delay a move to it, in these situations:

  • The app depends on Express-specific middleware with no equivalent. Examples include Passport strategies, express-session stores and multer upload pipelines. Each one has to be replaced or rewritten. The rewrite cost estimate later in this article shows how quickly that adds up.
  • The code relies on Node streams or raw sockets. Libraries that pipe into req/res, patch ServerResponse, or take over the underlying socket have nothing to attach to in the Web Request/Response model.
  • You need Express's server-side rendering conventions. Apps built around res.render() and Express view engines would need a different rendering approach. Hono's main rendering path is JSX.
  • The runtime will always be Node and the service is stable. Hono's main advantage is portability. If you will never use it, you pay the migration cost and the Node adapter's translation overhead for little benefit.
  • Your team doesn't use TypeScript, or can't absorb heavy type inference. Hono works from JavaScript, but much of its value comes from its types. Very large chained route trees can also slow the editor and tsc.

How do routing and middleware work in Hono vs Express?

Express keeps one ordered stack of layers per app or router. Each request walks that stack from the top, and every layer whose path and method match gets a turn until something sends a response. app.use('/api', …) matches by prefix and strips that prefix from req.url for the mounted handler. Hono also runs matching handlers in registration order, but a pluggable router does the matching. Its default picks a regex-based or trie-based implementation, and you can choose another explicitly. The parameter syntax looks familiar (:id, :id?, *), and Hono adds inline patterns such as :id{[0-9]+}.

The matching rules differ in ways that break migrations:

Concern Express Hono
use('/api') Prefix match, path rewritten Exact path; needs /api/*
Trailing slash Ignored by default Significant unless strict: false
Handler signature (req, res, next), callback async (c, next), returns Response
Post-processing Hook res events or patch methods Code after await next()

Express's next() returns nothing useful, so middleware can't see what happened downstream. To add a timing header you have to intercept the moment headers are written. In Hono, next() resolves after downstream handlers finish. Code placed after await next() can read c.res, set an X-Response-Time header on it, or replace it by assigning a new Response to c.res, for example to rewrite a body.

Common migration bugs:

  • Dropping the await on next(). The middleware returns before the handler runs, so its post-processing sees no response.
  • Mutating a Response that came from fetch(). Its headers can be immutable, so setting one throws. Construct a new Response from it and modify that copy instead.
  • Expecting Express-style prefix mounting. A use('/api') call that matched every /api/... route in Express silently matches only /api in Hono.
import { Hono } from 'hono'

const app = new Hono()

// Exact match in Hono: '/api' alone would NOT cover '/api/users/1'.
app.use('/api/*', async (c, next) => {
  const start = Date.now()
  // Must be awaited, or the code below runs before the handler has produced c.res.
  await next()
  // Downstream has finished, so c.res holds the final Response.
  c.res.headers.set('X-Response-Time', `${Date.now() - start}ms`)
})

// Response rewrite: replace c.res instead of mutating a body that is already built.
app.use('/api/*', async (c, next) => {
  await next()
  if (!c.res.headers.get('content-type')?.includes('application/json')) return
  const body = await c.res.text()
  const headers = new Headers(c.res.headers) // copy, so immutable fetch() headers are not a problem
  headers.delete('content-length') // the old length no longer matches the new body
  c.res = new Response(body.replaceAll('internal-host', 'api.example.com'), {
    status: c.res.status,
    headers,
  })
})

// Inline pattern: only numeric ids match; '/api/users/abc' falls through to 404.
app.get('/api/users/:id{[0-9]+}', (c) =>
  c.json({ id: c.req.param('id'), self: c.req.path })
)

export default app

Hono middleware runs code after await next() to add an X-Response-Time header and to rewrite a JSON body by assigning a new Response to c.res, and it uses /api/* because Hono matches use() paths exactly rather than by prefix.

How do you handle errors correctly in each framework?

Express identifies error middleware by its arity: a function declared with four parameters, (err, req, res, next), is skipped during normal routing and invoked only after something calls next(err) or throws synchronously. Arity is the whole signal, so dropping the unused next turns it into ordinary middleware. Register it after all routes. A custom 404 is a regular three-argument middleware placed after the routes and before the error handler.

Async behavior depends on the major version. Express 5 forwards a rejected promise from a handler to next(err). Express 4 does not, so a rejection becomes an unhandled rejection and the client waits until it times out. On Express 4, wrap each async handler in try/catch and call next(err), or use a small wrapper that attaches .catch(next). If headers are already sent, your handler should delegate to next(err) so Express can close the connection.

Hono uses two app-level hooks. app.onError((err, c) => ...) handles errors, and app.notFound((c) => ...) handles unmatched routes. Any error thrown inside an awaited chain reaches onError, including from middleware that awaits next(). A promise you start without await or return runs outside that chain, so its rejection never reaches onError and the response may already be sent. On edge runtimes, pass intentional background work to c.executionCtx.waitUntil() and give it its own .catch.

In both frameworks, return one error shape from every path, for example { error: { code, message } }. Map known error classes, such as Hono's HTTPException, to their status codes. Return a generic 500 for everything else and log the details on the server.

import express, { Request, Response, NextFunction } from "express";
import { Hono } from "hono";
import { HTTPException } from "hono/http-exception";

declare function loadUser(id: string): Promise<{ id: string } | null>;
declare function recordView(id: string): Promise<void>;
// One error shape for every path in both apps
const errBody = (code: string, message: string) => ({ error: { code, message } });

// --- Express 4: forward async rejections to next(err) yourself (Express 5 does this for you)
const wrap = (fn: (req: Request, res: Response) => Promise<unknown>) =>
  (req: Request, res: Response, next: NextFunction) => { fn(req, res).catch(next); };

const ex = express();
ex.get("/users/:id", wrap(async (req, res) => { res.json(await loadUser(req.params.id)); }));
// 404: ordinary 3-arg middleware, after routes and before the error handler
ex.use((req, res) => { res.status(404).json(errBody("NOT_FOUND", "Route not found")); });
// Four parameters mark this as error middleware; keep `next` even if rarely used
ex.use((err: Error, req: Request, res: Response, next: NextFunction) => {
  if (res.headersSent) return next(err); // let Express close the connection
  console.error(err);
  res.status(500).json(errBody("INTERNAL", "Internal server error"));
});

// --- Hono: app-level hooks
const hono = new Hono();
hono.notFound((c) => c.json(errBody("NOT_FOUND", "Route not found"), 404));
hono.onError((err, c) => {
  if (err instanceof HTTPException) return c.json(errBody("HTTP_ERROR", err.message), err.status);
  console.error(err); // log details server-side, return a generic 500
  return c.json(errBody("INTERNAL", "Internal server error"), 500);
});
hono.get("/users/:id", async (c) => {
  const user = await loadUser(c.req.param("id")); // awaited: a rejection reaches onError
  if (!user) throw new HTTPException(404, { message: "User not found" });
  // Not awaited, so onError will never see it: hand it to waitUntil with its own catch
  c.executionCtx.waitUntil(recordView(user.id).catch((e) => console.error(e)));
  return c.json(user);
});

Side-by-side Express 4 and Hono error handling: Express uses an async wrapper, a 404 middleware and a four-argument error handler, while Hono uses notFound and onError, maps HTTPException, and routes background work through waitUntil with its own catch so both apps return the same error shape.

What does running an edge API actually require from your code?

Edge runtimes run on V8 isolates with Web Standard APIs (fetch, Request, Response, ReadableStream, Web Crypto). They are not stripped-down Node processes. Some offer a partial Node compatibility layer, but you cannot assume fs, net, child_process or Node streams exist. There is no writable disk. Native addons can't load because there is no binary to link against. CPU time per request is capped. Isolates are created and discarded at will, so module-level caches, connection pools and in-memory sessions don't persist reliably.

This is why Express code rarely moves to the edge unchanged. Express builds req and res on Node's IncomingMessage and ServerResponse, which are Node streams. Middleware that pipes, buffers or patches those objects has nothing to attach to. Hono's own code is portable, but your app is only as portable as its least portable dependency. One transitive import of fs or a native hashing library breaks the deploy.

Auditing a dependency tree

  • Search the bundle for node: imports and bare fs, net, stream, crypto.
  • Flag any package with native build steps or .node binaries.
  • Check whether database drivers use TCP sockets or HTTP.
  • Look for module-level state that assumes a long-lived process.
  • Build for the target runtime in CI so incompatibilities fail early.
Concern Node Edge isolate
File system Full None
Native modules Yes No
Process lifetime Long-lived Ephemeral
Request objects Node streams Web Standard

On plain Node, Hono's Node adapter (@hono/node-server) converts each incoming Node request into a Web Request and writes the returned Response back. That conversion adds per-request overhead. It can also surface edge cases, such as streaming responses that buffer unexpectedly or multi-value headers like Set-Cookie. Test these paths explicitly before you rely on them.

// app.ts: runtime-agnostic. Uses only Web Standard APIs, no node: imports.
import { Hono } from 'hono'
import { streamText } from 'hono/streaming'

export const app = new Hono()

app.post('/hash', async (c) => {
  // Web Crypto instead of node:crypto or a native hashing addon
  const body = new Uint8Array(await c.req.arrayBuffer())
  const digest = await crypto.subtle.digest('SHA-256', body)
  const hex = [...new Uint8Array(digest)]
    .map((b) => b.toString(16).padStart(2, '0'))
    .join('')
  return c.json({ sha256: hex })
})

app.get('/events', (c) => {
  // Streaming goes through a Web ReadableStream, not a Node stream.
  // Behind the Node adapter, test this route: flushing and client
  // disconnects are where translation edge cases tend to show up.
  return streamText(c, async (stream) => {
    for (let i = 0; i < 3; i++) {
      await stream.writeln(`tick ${i}`)
      await stream.sleep(500)
    }
  })
})

// node.ts: Node-only entry point. Keep Node-specific code in this file.
// The adapter converts IncomingMessage to a Web Request and writes the
// returned Response back to ServerResponse on every request.
// Requires Node 20+ so that globalThis.crypto is available without flags.
import { serve } from '@hono/node-server'
import { app } from './app'

serve({ fetch: app.fetch, port: 3000 }, (info) => {
  console.log(`listening on port ${info.port}`)
})

A Hono app that uses only Web Standard APIs (Web Crypto and a Web stream) in a portable module, plus a separate Node entry point that serves it through @hono/node-server's request and response translation.

Is Hono faster than Express, and how should you benchmark it?

Hono's router is designed to do little work per request, so in a minimal hello-world test it can look much faster than Express's layer stack. Hello-world tests measure little besides the framework. They do no body parsing, no validation and no network call. A real handler spends most of its time waiting on a database or upstream service, so the framework's share of each request shrinks. On Node, Hono also runs through its adapter, which converts Node's request and response objects to Web Standard ones. That conversion gives back part of the advantage Hono can have on runtimes that implement the Fetch API natively. Measure on your own workload instead of relying on headline numbers.

Worked example (illustrative estimate)

These per-request costs are assumed, not measured. The endpoint is a typical POST that runs one database query.

Component Express (assumed) Hono on Node (assumed)
Routing + middleware 0.15 ms 0.08 ms
JSON parse + validation 0.30 ms 0.30 ms
Database round trip 8.00 ms 8.00 ms
Serialization 0.10 ms 0.10 ms
Total 8.55 ms 8.48 ms
Framework share ~1.8% ~0.9%

With these assumed inputs, switching frameworks saves under 1% of request time in this illustrative estimate.

A fair benchmark

  1. Implement the same handler in both frameworks. It should parse JSON, validate with the same schema library, make a real database or upstream call with production-like latency, and serialize the response.
  2. Run it on your actual target runtime.
  3. Warm up first, then drive load at several concurrency levels.
  4. Record p50, p95 and p99 latency, requests per second and CPU usage.

If the difference falls within run-to-run variance, it is not a reason to migrate. Framework overhead matters mainly for high-RPS, cache-hit or proxy workloads, where little I/O hides it.

How do type safety, ecosystem and team cost compare?

Hono is written in TypeScript, and its types follow the route definition. A path such as /users/:id gives c.req.param('id') a typed key. Validator middleware, either the built-in validator or a schema-library adapter, passes the parsed body type to the handler. Hono's hc client can derive request and response types from the exported app type. If a server field is renamed, the client fails to compile instead of failing in production. Express is typed through community definitions (@types/express). Those types are accurate, but req.body and req.params stay loosely typed unless you add generics or a separate contract layer.

The cost of inference shows up in large route trees. Chaining hundreds of routes into one app type can slow the editor and tsc, and type errors can run to dozens of lines. Splitting the app into sub-apps and exporting narrower types helps.

Concern Express Hono
Typing Community @types Built in, inferred from routes
Client contract Separate (OpenAPI, shared types) hc from the app type
Auth, sessions, uploads, logging Mature packages (Passport, express-session, multer, morgan) Built-in and third-party middleware, fewer options
Tutorials and operational knowledge Very large Smaller, growing

To estimate migration cost, list every app.use call and every middleware dependency. Mark each one as having a built-in equivalent, a third-party equivalent, or no equivalent.

Illustrative estimate (assumed numbers, not a benchmark): Assume 20 middleware, of which 12 have direct equivalents at 0.5 days each and 8 need a rewrite at 3 days each.

rewrite cost = (direct × days per swap) + (missing × days per rewrite) = (12 × 0.5) + (8 × 3) = 30 engineer-days

This figure excludes regression testing.

When should you choose Hono, keep Express, or migrate incrementally?

That cost only matters if the move buys you something. Weigh it against the deployment and maintenance gains below, not against the appeal of a newer framework.

Situation Recommendation Why
Mature Node-only service, many Express middleware dependencies Keep Express Rewrite cost is high and the runtime never changes, so Hono's portability goes unused
New TypeScript service, or edge/multi-runtime target Choose Hono Web-standard Request/Response and typed routes pay off from the first endpoint
Heavy schema-driven validation, or long-lived connections as the core workload Evaluate other options Neither framework is built around these needs
Service is stable, rarely changed, or scheduled for retirement Don't migrate Any rewrite risk outweighs a benefit you will never collect

Migrating incrementally

Don't rewrite in place. Put a shared gateway in front of both services and route new endpoints to a separate Hono service. Once the Express service stops growing, move existing routes one at a time, starting with those that have the fewest middleware dependencies. Each move can be reversed with a routing change.

Running a mixed estate

The real cost of a mixed estate is drift. Two services gradually invent two log schemas, two error bodies and two ways to read a token. Before you route the first request to Hono, standardize three things:

  • Logging: use one structured format with the same field names, and pass correlation IDs from the gateway.
  • Errors: define a single error response shape. Write it as a contract, test both services against it, and let clients rely only on the contract.
  • Auth: verify tokens at the gateway and forward the verified claims, so neither framework carries its own auth logic.

If you treat these as gateway-level contracts, finishing the migration becomes optional rather than urgent.

How OneEnv can help

Disclosure: OneEnv is the product behind this blog.

OneEnv (oneenv.io) is a workspace-based governance platform for the things services share — environment variables, database structure, API routes and validation rules. A change to a shared value is staged on a branch, reviewed once, and then every affected service explicitly approves or rejects it before it goes live, so you can see who a change touches before it ships instead of finding out in production.

Applied to hono vs express, this is where it helps:

Saves time

  • Every service that inherits a shared value is listed in one place, so nobody searches repos and chats to find out who is affected.
  • One review per branch replaces coordinating each team separately; each service still keeps its own approve/reject.
  • Changing a shared variable is one edit and one review instead of editing every service's .env by hand.

Saves cost

  • Fewer production incidents and rollbacks caused by a shared value, route or column changing under a consumer unannounced.
  • Less duplicated configuration to maintain: one shared definition inherited by many services.
  • A wrong or stale value is caught at review time by the services it affects, not by a failed deploy.
  • OneEnv has a free plan (1 workspace, unlimited services and members, full governance), so trying it costs nothing.

These are qualitative benefits, not measured results — how much you save depends on how many services share the value.

Want to try it? Start at oneenv.io.