Skip to main content

Hono vs Elysia in 2026: The Bun-Era Backend Frameworks Compared

·PkgPulse Team

TL;DR

Hono is the safer, more portable choice. Elysia is faster but Bun-only. Hono runs on Node.js, Bun, Deno, Cloudflare Workers, and AWS Lambda — one codebase, any runtime. Elysia is optimized for Bun specifically and achieves higher raw throughput (up to 2.5M req/s in benchmarks vs Hono's ~1.2M). Choose Hono for edge deployment and runtime portability; choose Elysia if you're all-in on Bun and throughput is the priority.

Key Takeaways

  • Hono: ~1.8M weekly downloads — Elysia: ~500K (npm, March 2026)
  • Elysia is faster in Bun — 2.5M req/s vs Hono's 1.2M req/s (Bun benchmarks)
  • Hono runs everywhere — Cloudflare Workers, Node, Bun, Deno, AWS Lambda
  • Elysia has Eden treaty — end-to-end type safety without code generation
  • Both are TypeScript-first — ergonomic API design with strong inference

The Context: Why These Frameworks Exist

Hono and Elysia emerged as answers to the same question: what does an Express-like API framework look like if you start from scratch with TypeScript, modern runtimes, and web standards in mind?

Express was built in 2010 for Node.js 0.x. It uses callbacks, lacks TypeScript, and can't run on edge runtimes. Hono (2021) and Elysia (2023) are the corrections.


Hono: The Portable Choice

// Hono — runs on any runtime
import { Hono } from 'hono';
import { zValidator } from '@hono/zod-validator';
import { z } from 'zod';

const app = new Hono();

app.get('/users/:id', async (c) => {
  const id = c.req.param('id');
  const user = await db.user.findUnique({ where: { id } });

  if (!user) return c.json({ error: 'Not found' }, 404);
  return c.json(user);
});

app.post('/users',
  zValidator('json', z.object({
    name: z.string().min(1),
    email: z.string().email(),
  })),
  async (c) => {
    const body = c.req.valid('json'); // Fully typed from Zod schema
    const user = await db.user.create({ data: body });
    return c.json(user, 201);
  }
);

// Deploy to Cloudflare Workers
export default app;

// Deploy to Node.js
import { serve } from '@hono/node-server';
serve(app);

// Deploy to Bun
Bun.serve({ fetch: app.fetch });

Hono's key differentiators:

  • hono/client for type-safe RPC-style clients (similar to tRPC)
  • Middleware ecosystem: JWT, CORS, rate limiting, caching
  • Cloudflare Workers native — used extensively in production at Cloudflare
  • @hono/zod-validator for request validation

Elysia: The Bun-Native Choice

// Elysia — Bun-optimized
import { Elysia, t } from 'elysia';

const app = new Elysia()
  .get('/users/:id', async ({ params: { id } }) => {
    const user = await db.user.findUnique({ where: { id } });
    if (!user) throw new Error('Not found');
    return user;
  })
  .post('/users', async ({ body }) => {
    return await db.user.create({ data: body });
  }, {
    body: t.Object({
      name: t.String({ minLength: 1 }),
      email: t.String({ format: 'email' }),
    })
  });

export default app;

Eden Treaty — End-to-End Types Without codegen

// Server
const app = new Elysia()
  .get('/health', () => ({ status: 'ok' as const }))
  .post('/sign-in', ({ body }) => signIn(body), {
    body: t.Object({ email: t.String(), password: t.String() }),
    response: t.Object({ token: t.String() }),
  });

export type App = typeof app;

// Client — fully typed, no codegen
import { treaty } from '@elysiajs/eden';
const client = treaty<App>('localhost:3000');

const { data, error } = await client.health.get();
// data is typed as { status: 'ok' }

const { data: auth } = await client['sign-in'].post({
  email: 'user@example.com',
  password: 'secret',
});
// auth.token is typed as string

Eden treaty is Elysia's signature feature — genuine end-to-end type safety that feels like tRPC but with a traditional REST API underneath.


Performance Comparison

Both significantly outperform Express and Fastify on Bun:

FrameworkRuntimeReq/s (Hello World)
ElysiaBun~2.5M
HonoBun~1.2M
HonoNode.js~350K
FastifyNode.js~230K
ExpressNode.js~80K

Important caveat: These are synthetic benchmarks. Real-world performance depends on database queries, JSON serialization, and middleware overhead — where differences shrink considerably.


Ecosystem Comparison

FeatureHonoElysia
Runtime supportNode, Bun, Deno, CF Workers, AWSBun (primary), experimental others
ValidationZod (via middleware)Built-in TypeBox (t.Object)
E2E type safetyhono/client RPCEden Treaty
Auth middleware✅ (JWT, Basic)✅ (plugins)
OpenAPI/Swagger@hono/swagger-ui@elysiajs/swagger
Weekly downloads~1.8M~500K

When to Choose

Choose Hono when:

  • You need to deploy to Cloudflare Workers or edge runtimes
  • Runtime portability matters (same code on Node and CF Workers)
  • Your team isn't ready to commit fully to Bun
  • You want the larger community and more middleware options

Choose Elysia when:

  • You're committed to Bun as your runtime
  • Eden Treaty's end-to-end type safety is compelling
  • You want maximum throughput in a Bun environment
  • You appreciate Elysia's opinionated, batteries-included approach

Compare Hono and Elysia package health on PkgPulse.

Comments

Stay Updated

Get the latest package insights, npm trends, and tooling tips delivered to your inbox.