Skip to main content
← Guides

Guide

Hono vs Express vs Fastify 2026

Updated PkgPulse Team9 min read
0

Hono vs Express vs Fastify compared for Node.js backends: performance in context, edge runtime support, TypeScript DX and middleware. Learn when to use each.

Contents

Fastify gives a new Node.js API built-in schema validation and scoped plugins. Hono fits APIs that need to run on Cloudflare Workers or share Fetch-based handlers across runtimes. Express remains a practical choice when your application already relies on its middleware.

TL;DR

Choose Fastify for a new Node.js API that benefits from request validation and schema-based serialization. Choose Hono for Workers or a shared app across Workers, Bun, Deno and Node.js with a Node adapter. Keep Express when existing middleware works and a measured bottleneck or deployment requirement gives you no reason to migrate.

Key Takeaways

  • Express has a supported release line and a large middleware ecosystem. Validate request bodies with your own middleware.
  • Fastify validates requests and serializes responses from schemas. Use encapsulated plugins to scope routes and hooks.
  • Hono builds on Fetch request and response primitives. Check every adapter and integration in the runtimes you plan to deploy to.
  • Performance depends on the workload. Benchmark a representative handler with its middleware, payload and database access before deciding to migrate.
  • TypeScript types ship with Fastify and Hono. Express uses community-maintained types.

At a Glance

CheckExpressFastifyHono
npm packageexpressfastifyhono
npm downloads194,586,55822,469,688106,015,460
TypeScriptCommunity typesBuilt-inBuilt-in
Schema validationAdd your own middlewareJSON SchemaValidator adapters such as Zod
Runtime fitNode.jsNode.jsFetch-based runtimes and Node.js via adapter
Middleware modelRequest, response and nextEncapsulated plugins and hooksFetch-based middleware and context
Best forExisting services and familiar middlewareSchema-driven Node.js APIsEdge and multi-runtime projects

The table counts npm downloads for November 23–29, 2026. Use it as package activity context. Choose a framework by runtime, middleware compatibility and validation needs.


Express: The Default That Refuses to Die

Express is the jQuery of Node.js web frameworks. Almost every tutorial, bootcamp, and "build a REST API" blog post uses Express. The ecosystem is enormous. If something needs to be done in Express, there's a package for it.

import express from 'express'

const app = express()
app.use(express.json())

app.get('/users/:id', async (req, res) => {
  const user = await db.users.findById(req.params.id)
  if (!user) return res.status(404).json({ error: 'Not found' })
  res.json(user)
})

app.post('/users', async (req, res) => {
  const { name, email } = req.body
  // No built-in validation — you add your own
  const user = await db.users.create({ name, email })
  res.status(201).json(user)
})

app.listen(3000)

Express 5 (released 2024): After years of waiting, Express 5 brings native async/await error handling (no more try/catch wrapping for async middleware), dropped support for some legacy patterns, and minor performance improvements. The API is intentionally backward-compatible.

The problems with Express in 2026:

  • No built-in schema validation — adds latency and bugs
  • Slow JSON serialization (uses JSON.stringify without fast-path optimization)
  • No TypeScript-native types — @types/express is community-maintained
  • No built-in request/response lifecycle hooks
  • Not compatible with edge runtimes (uses Node.js-specific APIs)

When Express is still correct: You have existing middleware that doesn't exist for other frameworks (complex auth flows, legacy payment processing libraries, decades-old session management code). You're a solo developer building an internal tool and the performance headroom is irrelevant. Your team knows Express and onboarding overhead isn't worth the switch.


Fastify: The Right Default for Node.js APIs

Fastify validates requests using JSON Schema. When you supply a response schema, it uses fast-json-stringify to serialize the response. Define both schemas when you want to reject invalid input and control which fields leave the API.

import Fastify from 'fastify'

const fastify = Fastify({ logger: true })

// Schema-first approach — validation + serialization in one
const userSchema = {
  body: {
    type: 'object',
    required: ['name', 'email'],
    properties: {
      name: { type: 'string', minLength: 1 },
      email: { type: 'string', format: 'email' },
    },
    additionalProperties: false,
  },
  response: {
    201: {
      type: 'object',
      properties: {
        id: { type: 'string' },
        name: { type: 'string' },
        email: { type: 'string' },
      },
    },
  },
}

fastify.post('/users', { schema: userSchema }, async (request, reply) => {
  // request.body is validated and typed
  const user = await db.users.create(request.body)
  return reply.code(201).send(user)
})

await fastify.listen({ port: 3000 })

Fastify's plugin lifecycle is one of its strongest features. Plugins can declare dependencies, encapsulate routes, and share decorators — it solves the code organization problem that Express leaves entirely to the developer:

// Fastify plugin encapsulation
fastify.register(async function authRoutes(fastify) {
  fastify.addHook('preHandler', authenticate)

  fastify.get('/profile', async (request) => {
    return request.user  // injected by authenticate hook
  })
}, { prefix: '/api' })

Fastify 5 (2024): Node.js 20+ required, TypeScript ESM support improved, new type providers for Zod and TypeBox alongside the existing JSON Schema system.

Limitation: Fastify is Node.js only. No Cloudflare Workers, no Bun-native, no Deno Deploy. If you need multi-runtime deployment, look at Hono.


Hono: Edge-Native, Anywhere the Fetch API Runs

Hono builds on standard Fetch requests and responses. The route handlers can move between Cloudflare Workers, Bun and Deno when the dependencies and platform bindings are portable. Use the Node.js or Lambda adapter where the runtime needs one.

import { Hono } from 'hono'
import { zValidator } from '@hono/zod-validator'
import { z } from 'zod'

const app = new Hono()

const createUserSchema = z.object({
  name: z.string().min(1),
  email: z.string().email(),
})

app.post('/users',
  zValidator('json', createUserSchema),
  async (c) => {
    const data = c.req.valid('json')  // Fully typed
    const user = await db.users.create(data)
    return c.json(user, 201)
  }
)

// Deploy anywhere — same code:
export default app  // Cloudflare Workers
// or: serve(app)   // Bun
// or: serve(app)   // Deno
// or: const handler = handle(app)  // AWS Lambda

Hono RPC is a unique feature — generate a type-safe client from your route definitions with zero code generation:

// server.ts — define routes with return types
const routes = app
  .get('/users/:id', async (c) => {
    const user = await getUser(c.req.param('id'))
    return c.json(user)  // TypeScript infers the return type
  })

export type AppType = typeof routes

// client.ts — fully typed client, no schema definition needed
import { hc } from 'hono/client'

const client = hc<AppType>('https://api.example.com')
const user = await client.users[':id'].$get({ param: { id: '123' } })
// user is fully typed — same shape as the server response

Bundle size: If startup time matters, measure the built application with the Hono preset, middleware and dependencies you plan to ship. Package sizes alone omit the cost of loading the rest of the application.

The ecosystem gap: Hono's middleware library is growing but smaller than Express or Fastify. Complex auth flows, specialized database adapters, and enterprise middleware are better covered by the established frameworks. For new greenfield projects, the gap is increasingly irrelevant — @hono/auth-js, @hono/jwt, @hono/zod-validator cover most common needs.


Performance in Context

Measure the framework overhead with a small JSON route, then repeat the test with a representative endpoint that includes validation, middleware, serialization and a database call. Keep the runtime, request mix, concurrency and payload fixed when you compare throughput and tail latency. Compare edge deployments separately because the runtime and startup model differ.

A small route can expose per-request overhead. The representative route shows whether that overhead matters to your users. Use it to decide whether Fastify's built-in schema handling justifies moving an Express route. Choose Hono when the workload needs a Fetch-based runtime or a shared routing layer across deployments.


When to Use Each

Express → Legacy Node.js API that works, massive existing middleware needs, team deeply familiar with the ecosystem, internal tools where performance isn't measured.

Fastify → New Node.js service that stays on Node.js, high-throughput APIs where your workload tests justify the change, applications where request validation is critical (prevents entire classes of bugs), large codebases that benefit from the plugin lifecycle.

Hono → New projects targeting edge deployment, multi-runtime support required (same code runs on Node.js, Workers, Bun, Deno), lightweight APIs with cold-start sensitivity, projects that want Zod-based type safety throughout the request/response cycle, or teams building with Bun as the primary runtime.


Middleware and Ecosystem Maturity

Express middleware such as passport, helmet, express-rate-limit, and express-session uses its (req, res, next) interface. Inventory the middleware you rely on before migrating and verify that replacements preserve its behavior.

Fastify's middleware ecosystem uses a different adapter pattern via @fastify/middie to run Express middleware when needed, which gives it a practical upgrade path. Its native plugin registry covers the most critical production concerns: @fastify/jwt, @fastify/cors, @fastify/rate-limit, @fastify/multipart, and @fastify/swagger for OpenAPI docs. The plugin encapsulation model also means Fastify plugins are more composable than Express middleware — you can scope authentication hooks to specific route prefixes without global middleware pollution.

Hono's @hono/* scoped packages cover JWT, Zod validation, CORS, basic auth, bearer auth, and session management. The critical missing piece is complex session stores and OAuth flows — most production apps still reach for framework-agnostic libraries like jose for JWT or arctic for OAuth, which work fine in Hono's fetch-native environment. The Hono ecosystem's advantage is runtime portability: any @hono/* package works on Cloudflare Workers just as well as it does on Node.js.

Real-World Architecture Patterns

Where each framework truly differentiates is in how they encourage you to organize larger applications. Express applications inevitably end up with flat routers, global middleware arrays, and shared state via req object augmentation — patterns that work at small scale but become painful at 50+ routes.

Fastify's plugin system is its most underappreciated feature. Each plugin runs in an isolated scope: decorators added inside a plugin aren't visible outside it, hooks are scoped, and the dependency declaration system (fastify-plugin with fastify.register) enforces explicit dependency ordering. Teams building multi-service Node.js backends report that Fastify's structure prevents the "middleware order bugs" that plague Express codebases — the kind where a missing app.use(auth) before a router silently exposes endpoints.

Hono's architecture is closer to Express in structure but adds context isolation via c (the context object), which avoids the class of bugs where Express's shared req.user or similar augmentations get accidentally shared across requests. For edge-deployed applications where code isolation per-request is critical (Cloudflare Workers doesn't share memory between requests anyway), Hono's design fits naturally. The .use() middleware chain and c.set() / c.get() context store give you the Express mental model without Node.js-specific assumptions.

Migration Considerations

Migrating from Express to Fastify is the most common transition team attempt. The surface area change is larger than it looks. The most impactful difference isn't the route handler syntax — it's request lifecycle. Express's flat req → middleware array → handler becomes Fastify's eight-hook lifecycle: onRequest, preParsing, preValidation, preHandler, handler, preSerialization, onSend, onResponse. You gain granular control, but existing Express middleware won't slot in directly.

Practical migration advice: don't rewrite all at once. Teams that succeed typically run Express and Fastify side-by-side on different routes for 2-3 months, migrating high-traffic routes to Fastify while keeping complex legacy routes on Express until each can be properly rebuilt with schema validation. The @fastify/express compatibility plugin helps, but it disables some of Fastify's performance optimizations.

Source notes

Compare Hono, Express, and Fastify package health on PkgPulse.

Related: Hono vs Elysia 2026 · Hono RPC vs tRPC vs ts-rest · Express vs Fastify 2026