Elysia and Hono are both lightweight TypeScript frameworks that prioritize performance and developer experience. Elysia is built for Bun with end-to-end type inference through Eden. Hono is built for edge runtimes with universal deployment across Cloudflare Workers, Deno, Bun, and Node.js. They're the two most popular choices for developers who want something lighter than Express but more capable than raw HTTP handlers.
The choice between them usually comes down to runtime: Bun-first or run-anywhere. This article compares them across the dimensions that matter and covers what to look at when your project outgrows either one.
| Aspect | Elysia | Hono |
|---|---|---|
| Runtime | Bun (primary), Node.js compatible | Cloudflare Workers, Deno, Bun, Node.js |
| Bundle Size | Small | ~14kb |
| Validation | TypeBox, Zod, Valibot, ArkType | Zod via @hono/zod-validator |
| Type-safe Client | Eden (treaty) | RPC client (hc) |
| Middleware | Plugin-based | Express-like middleware chain |
| OpenAPI | Built-in generation | Via plugins |
| WebSocket | Built-in | Built-in |
| Edge Support | Limited (Bun-focused) | First-class (CF Workers, Deno Deploy) |
| Infrastructure | None | None |
| Observability | None | None |
import { Elysia, t } from 'elysia';
const app = new Elysia()
.get('/users/:id', ({ params: { id } }) => getUser(id))
.post('/users', ({ body }) => createUser(body), {
body: t.Object({
email: t.String({ format: 'email' }),
name: t.String({ minLength: 1 }),
})
})
.listen(3000);
Elysia's method chaining with inline schema validation is concise. Types are inferred from the schema, so body is fully typed without explicit interfaces.
import { Hono } from 'hono';
import { zValidator } from '@hono/zod-validator';
import { z } from 'zod';
const app = new Hono();
app.get('/users/:id', (c) => {
return c.json(getUser(c.req.param('id')));
});
app.post('/users', zValidator('json', z.object({
email: z.string().email(),
name: z.string().min(1),
})), (c) => {
return c.json(createUser(c.req.valid('json')), 201);
});
export default app;
Hono uses a context object and Zod for validation. The syntax is familiar to Express developers.
Verdict: Elysia's chaining with inline schema is more compact. Hono's approach is more familiar and works with the broader Zod ecosystem.
Elysia is optimized for Bun. The framework uses Bun-specific APIs for performance and ships with Bun as the primary runtime:
bun create elysia myapp
cd myapp
bun run dev
Node.js compatibility exists but Bun is the intended target.
Hono runs the same code on any runtime:
// Cloudflare Workers
export default app;
// Node.js
import { serve } from '@hono/node-server';
serve(app);
// Bun
export default { fetch: app.fetch };
// Deno
Deno.serve(app.fetch);
Verdict: If you need edge deployment (Cloudflare Workers, Deno Deploy), Hono is the clear choice. If you're building exclusively on Bun, Elysia is more optimized for that runtime.
import { treaty } from '@elysiajs/eden';
const api = treaty<typeof app>('http://localhost:3000');
const { data } = await api.users['1'].get();
// data is fully typed
import { hc } from 'hono/client';
const client = hc<typeof app>('http://localhost:3000');
const res = await client.users[':id'].$get({ param: { id: '1' } });
const data = await res.json();
// data is fully typed
Verdict: Both provide end-to-end type safety between client and server. Eden's API is slightly cleaner. Both require the app type to be exported, which limits them to frontend-to-backend communication rather than service-to-service.
Both frameworks are fast. Elysia reports benchmark numbers exceeding 2 million requests per second. Hono is lightweight enough that cold starts on Cloudflare Workers are measured in single-digit milliseconds.
In practice, neither framework's raw performance will be your bottleneck. Database queries, network calls, and business logic dominate response times in real applications. Choose based on runtime requirements and developer experience, not benchmarks.
Elysia and Hono are HTTP routing frameworks. They handle requests, validation, and responses well. They don't handle:
hc provide type-safe clients, but they're designed for frontend-to-backend, not service-to-service. Service discovery, distributed tracing across services, and shared authentication are all manual.For single-service APIs or edge functions, this is fine. For production backends with databases, multiple services, and observability requirements, you end up assembling and maintaining a stack of libraries that neither framework was designed to orchestrate.
If your project needs infrastructure beyond HTTP routing, Encore.ts provides what Elysia and Hono don't: databases, Pub/Sub, cron jobs, object storage, and caching declared in your TypeScript code, with automatic provisioning locally and on your own AWS or GCP account. Type-safe service-to-service calls, built-in distributed tracing, and a service catalog come included.
import { api } from "encore.dev/api";
import { SQLDatabase } from "encore.dev/storage/sqldb";
import { Topic } from "encore.dev/pubsub";
// Provisions RDS on AWS or Cloud SQL on GCP with sensible defaults (uses Docker Postgres locally).
const db = new SQLDatabase("users", { migrations: "./migrations" });
// Provisions SNS+SQS on AWS or GCP Pub/Sub on GCP with sensible defaults (in-memory locally).
const userEvents = new Topic<{ userId: number }>("user-events", {
deliveryGuarantee: "at-least-once",
});
export const createUser = api(
{ method: "POST", path: "/users", expose: true },
async (req: { email: string; name: string }) => {
const user = await db.queryRow`
INSERT INTO users (email, name) VALUES (${req.email}, ${req.name})
RETURNING *`;
await userEvents.publish({ userId: user!.id });
return user!;
}
);
Encore also provides an MCP server for AI coding agents, giving tools like Cursor and Claude Code access to your service architecture, database schemas, and distributed traces.
For teams that started with Elysia or Hono and now need databases, Pub/Sub, and observability, Encore.ts provides the infrastructure layer that lightweight frameworks leave to you.
For a detailed comparison, see Elysia vs Encore.ts or Hono vs Encore.ts.
Want to jump straight to a running app? Clone this starter and deploy it to your own cloud.
Building something that outgrew your framework? Join our Discord community where developers discuss architecture decisions daily.