DEV Community

Alex Spinov
Alex Spinov

Posted on

Hono Has a Free API: The Ultra-Fast Web Framework That Runs on Every JavaScript Runtime

Express is slow. Fastify is Node-only. Hono is a web framework that runs everywhere — Cloudflare Workers, Deno, Bun, Node.js, AWS Lambda — with the same code and blazing-fast performance.

What Is Hono?

Hono is an ultra-lightweight web framework for JavaScript/TypeScript. It runs on every major JavaScript runtime and edge platform. The core is tiny (14KB), the router is the fastest in JavaScript benchmarks, and it has zero dependencies.

The Free Framework

Hono is completely free and open source:

  • Multi-runtime: Cloudflare Workers, Deno, Bun, Node.js, Lambda, Vercel
  • Ultra-fast: Fastest JavaScript router in benchmarks
  • Tiny: 14KB core, zero dependencies
  • TypeScript-first: Full type inference for routes and middleware
  • Built-in middleware: CORS, JWT, basic auth, logger, compress
  • RPC mode: Type-safe client-server communication
  • JSX: Built-in JSX support for HTML rendering

Quick Start

npm create hono@latest my-app
cd my-app
npm run dev
Enter fullscreen mode Exit fullscreen mode

Build an API:

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

const app = new Hono();

// Middleware
app.use('/api/*', cors());
app.use('/api/*', jwt({ secret: 'your-secret' }));

// Type-safe request validation
const createUserSchema = z.object({
  name: z.string().min(1),
  email: z.string().email(),
});

app.post('/api/users', zValidator('json', createUserSchema), async (c) => {
  const { name, email } = c.req.valid('json');
  // name and email are typed!
  return c.json({ id: 1, name, email }, 201);
});

app.get('/api/users/:id', async (c) => {
  const id = c.req.param('id');
  return c.json({ id, name: 'John' });
});

// Works on every runtime
export default app;
Enter fullscreen mode Exit fullscreen mode

RPC mode (type-safe client):

// server.ts
const routes = app
  .get('/api/users', async (c) => c.json([{ id: 1, name: 'John' }]))
  .post('/api/users', zValidator('json', createUserSchema), async (c) => {
    const data = c.req.valid('json');
    return c.json({ id: 2, ...data }, 201);
  });

export type AppType = typeof routes;

// client.ts — fully typed!
import { hc } from 'hono/client';
import type { AppType } from './server';

const client = hc<AppType>('http://localhost:3000');
const users = await client.api.users.$get();
const data = await users.json(); // typed as { id: number, name: string }[]
Enter fullscreen mode Exit fullscreen mode

Deploy anywhere:

# Cloudflare Workers
npx wrangler deploy

# Deno Deploy
deno deploy --project my-app src/index.ts

# Bun
bun run src/index.ts

# Node.js
node --import tsx src/index.ts
Enter fullscreen mode Exit fullscreen mode

Why Developers Choose Hono

A startup ran their API on Express with Node.js. Response times averaged 50ms. After migrating to Hono on Cloudflare Workers, response times dropped to 3ms globally — the API ran at the edge in 200+ locations. The migration took a day because Hono's API is similar to Express, and the same handlers worked on both platforms.

Who Is This For?

  • Edge developers building APIs on Cloudflare Workers, Vercel Edge, Deno Deploy
  • Full-stack developers wanting one framework across all runtimes
  • Performance-focused teams needing the fastest possible routing
  • TypeScript developers wanting end-to-end type safety with RPC

Start Building

Hono gives you the fastest JavaScript web framework that runs everywhere. One codebase, any runtime.

Need help building APIs or edge applications? I build custom web solutions — reach out to discuss your project.


Found this useful? I publish daily deep-dives into developer tools and APIs. Follow for more.

Top comments (0)