Web Development 1 min read 704 views

Hono: The Ultrafast Web Framework for Edge and Serverless

Hono is the fastest web framework for edge computing. Learn to build APIs that run on Cloudflare, Deno, and Bun.

E
Hono framework edge computing

Hono is the fastest web framework for the edge, designed to run anywhere - Cloudflare Workers, Deno, Bun, Node.js, and more.

Getting Started

import { Hono } from "hono";

const app = new Hono();

app.get("/", (c) => c.text("Hello Hono!"));

app.get("/api/users/:id", (c) => {
  const id = c.req.param("id");
  return c.json({ id, name: "User " + id });
});

export default app;

Middleware

import { cors } from "hono/cors";
import { logger } from "hono/logger";
import { jwt } from "hono/jwt";

app.use("*", logger());
app.use("/api/*", cors());
app.use("/api/*", jwt({ secret: process.env.JWT_SECRET }));

Deploy Anywhere

# Cloudflare Workers
wrangler deploy

# Deno Deploy
deno deploy

# Bun
bun run src/index.ts

Performance

Hono benchmarks show impressive results:

  • Cloudflare Workers: ~150k req/s
  • Bun: ~200k req/s
  • Node.js: ~80k req/s
Share this article:
ES

Written by Edrees Salih

Full-stack software engineer with 9 years of experience. Passionate about building scalable solutions and sharing knowledge with the developer community.

View Profile

Comments (0)

Leave a Comment

Your email will not be published.

No comments yet. Be the first to share your thoughts!