DEV Community

Alex Spinov
Alex Spinov

Posted on

Hono Has a Free Ultrafast Web Framework That Runs on Every JavaScript Runtime

Hono is an ultrafast web framework for Cloudflare Workers, Deno, Bun, Node.js, and every JavaScript runtime. It is 3.5x faster than Express.

What You Get for Free

  • Multi-runtime — works on Workers, Deno, Bun, Node.js
  • Ultrafast — based on RegExpRouter
  • TypeScript native — full type inference
  • Middleware — JWT, CORS, logger, compress, etc.
  • RPC — type-safe client-server communication
  • JSX — server-side rendering built-in
  • Zero dependencies — tiny bundle

Hello World

import { Hono } from 'hono';

const app = new Hono();
app.get('/', (c) => c.text('Hello Hono!'));
app.get('/api/users', (c) => c.json([{ id: 1, name: 'Alice' }]));

export default app;
Enter fullscreen mode Exit fullscreen mode

Middleware

import { jwt } from 'hono/jwt';
import { cors } from 'hono/cors';

app.use('/api/*', cors());
app.use('/api/*', jwt({ secret: 'my-secret' }));
Enter fullscreen mode Exit fullscreen mode

Hono vs Express

Feature Hono Express
Speed 3.5x faster Baseline
Runtime Any JS runtime Node.js
TypeScript Native Manual
Size 14KB 200KB+

Need web framework help? Check my work on GitHub or email spinov001@gmail.com for consulting.

Top comments (0)