Guide · Open source
How to use Hono: install, define routes and deploy
Updated · written with AI from the project's own documentation and checked against our catalogue data
Hono is a small web framework for JavaScript and TypeScript that is built on Web Standard APIs, so the same application code can run on several JavaScript runtimes. This guide shows how to create a project, define routes that handle requests and responses, and understand where Hono fits. You need basic familiarity with JavaScript or TypeScript and Node.js or another supported runtime.
Quick start
- 1Create the project. Run npm create hono@latest in the folder where you want your project.
- 2Open the entry file. Look at the generated app code, which creates a Hono instance and exports it.
- 3Add a route. Call app.get with a path and a handler that uses the context object to return a response.
- 4Add middleware if needed. Use built-in, custom, or third-party middleware for logic shared across routes.
- 5Check the docs for your runtime. Use hono.dev to find the steps for the runtime you deploy to, such as Cloudflare Workers or Node.js.
What Hono is and when to use it
Hono (the name means flame in Japanese) is described in its README as a small, simple, and fast web framework built on Web Standards. It works on Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, AWS Lambda, Lambda@Edge, and Node.js.
- Good fit: TypeScript or JavaScript HTTP APIs, teams that want one codebase on multiple runtimes, and projects targeting edge platforms like Cloudflare Workers.
- Less suited: full-stack apps that need a built-in database or UI layer, since the README describes only a web framework, and non-programmers, because it requires writing code.
Create a new Hono project
The README's quick start creates a new project with a single npm command. Run it in the folder where you want the project created. Hono is distributed under the MIT License.
npm create hono@latestDefine routes and handle requests
Hono apps are built by creating an instance and registering handlers for HTTP methods and paths. Each handler receives a context object, called c in the README example, which you use to build the response. The example below returns plain text from the root path.
Export the app as the default export so the runtime can serve it.
- Import Hono with import { Hono } from 'hono'.
- Register a route with app.get(path, handler).
- Return a response from the handler, for example with c.text().
import { Hono } from 'hono'
const app = new Hono()
app.get('/', (c) => c.text('Hono!'))
export default appUse middleware
The README says Hono includes built-in middleware, supports custom middleware you write yourself, and can use third-party middleware. Middleware sits between the request and your handlers, which is where shared logic such as logging or checks usually goes.
Check the documentation on hono.dev for the list of available middleware and how to register it, since the README does not list them.
Run the same code on different runtimes
Because Hono uses Web Standard APIs, the application code is meant to stay the same across the supported runtimes. The README states that the same code runs on all listed platforms. Runtime-specific deployment steps are not included in the README, so consult hono.dev for each target.
- Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, AWS Lambda, Lambda@Edge, Node.js.
Where to find more help
Full documentation is on hono.dev. The migration guide is at docs/MIGRATION.md in the repository, and contribution details are in docs/CONTRIBUTING.md. The maintainers also run an X account and a Discord channel.
What people use it for
- Building a JSON or text HTTP API in TypeScript
- Deploying one API codebase to Cloudflare Workers and Node.js
- Running a lightweight edge endpoint on platforms like Cloudflare Workers
- Creating a small web service with few dependencies
Frequently asked questions
How do I install Hono?
The README's install method is npm create hono@latest, which creates a new project. Node.js or another supported JavaScript runtime is needed. Run the command in the folder where you want the project.
Is Hono free to use?
Yes. Hono is distributed under the MIT License, as stated in the README and the LICENSE file in the repository. Check the LICENSE file for the full terms.
What do I need to run Hono?
You need Node.js or another supported JavaScript runtime. The README lists Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, AWS Lambda, Lambda@Edge, and Node.js.
Can Hono run on Cloudflare Workers?
Yes. The README lists Cloudflare Workers among the supported runtimes and says the same code runs on all listed platforms. It is also a common target for edge deployments.
How does Hono compare to Express or Fastify?
The source lists Express, Fastify, Elysia, and Koa as comparable projects, but it does not benchmark them against Hono. Hono's README emphasises its small size, Web Standard APIs, and multi-runtime support. Compare them on the features you need.
Is Hono a full-stack framework?
No. The README describes Hono as a web framework and does not mention a built-in database or UI layer. If you need those, pick a framework that includes them or add separate libraries.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Hono suits developers who write TypeScript or JavaScript HTTP APIs and want one codebase that runs on several runtimes, especially edge platforms like Cloudflare Workers. It is a poor choice if you need a full-stack framework with a database or UI layer, or if you are not comfortable writing code.
Install options & downloads