I created a pet project (REST API) with Hono and I'm seriously considering using it for future projects instead of what has been my go-to stack for years (Express, lately with Zodios).

Hono's middlewares, especially zod-openapi[1] and @scalar/hono-api-reference[2], make it really easy to define your REST endpoints once and get full typesafe routes with request/response validation, an automatic OpenAPI spec, a beautiful OpenAPI browser and you can even reuse the typings in your frontend with Hono's RPC[3] middleware, essentially giving you end-to-end type-safety without any code-generation.

Its maintainer yusukebe is a really nice guy who is always being helpful and very active. I want Hono to become the modern successor of Express. :)




Recently, I've been looking for a suitable stack for another pet project. Personally my go-to stack is Remix.

But I want to use a server other than the default provided by Remix, i.e minimal Express. So, I found Hono. It looks interesting because it can run on many runtimes, and this time I want to try using Bun.

After researching Hono, it turns out it can render JSX directly from the server, which piqued my interest. Then I tried to make the JSX interactive, and finally, I used htmx. Lol.

And just yesterday, after spending hours I found a way to use PDFKit with Hono (Bun runtime), so I created a gist for reference:

Anyway I'm still cautious about putting this Hono + htmx stack into production use.

I've been using Hono + Bun + SQLite for all my personal projects, and I really like it. Essentially, I've replaced Express and Node with it. What I appreciate the most is how quickly I can set up a project with Bun, have native SQLite connector, and how minimal the Hono base app is. Additionally, I can use JSX without any setup hassle.
I'm curious what makes it so fast?

The says RegExpRouter uses no loops and just regular expressions, presumably it maps a route to a hashmap matched entry?

Related but slightly different:

I am curious because NFAs, deterministic automata are interesting to me. I remember one person on HN talked to me about using regular expressions to match event sequences. (That is: don't match against strings but match against tokens)

I am not a Rust developer, but the pattern of using Rust sum types and pattern matching or OCaml dispatch based on types are similar to me intuitively.

What are your thoughts on this style of programming?

I feel so much of modern business programming is dispatch logic!

If you think of Redux and state machines and event sequences in GUIs for behaviour, I feel there is a lot of untapped potential ideaspace here.

The benchmark that's provided says nothing, actually. Being able to serve half a million requests per second isn't a useful measurement for two reasons:

1. In a serverless environment, _the whole point_ is that the requests are essentially all concurrent. If you get 1000 requests at T+0, you get 1000 concurrent invocations of your function. The overhead of the worker doesn't stack unless you hit a concurrency limit, which most folks won't.

2. The overhead of the framework is a rounding error. The slowest framework benchmarked clocks in at over 200K QPS. That's ones of microseconds of overhead from the framework per request. HonoJS is still ones of microseconds per request. If your application code takes one millisecond to return meaningful output, that's _hundreds of times slower_ than the overhead, and the framework's performance is already moot.

Choose a framework that is nice to use and gives you all of the features you want. Shaving off a handful of kilobytes of source code _on the server_ is premature optimization. Shaving off a few microseconds from the request time is premature optimization. Even "heavy" frameworks like Koa and Express will give you good-enough performance that you probably wouldn't ever even notice. What matters is the tool you choose that helps you build useful stuff faster.

At first glance, Hono seems like the most standards-compatible framework.

> It works on any JavaScript runtime: Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, AWS Lambda, Lambda@Edge, and Node.js.

Not sure it counts as “any JS runtime” if it does not work in browser (e.g., worker context), but judging by the rest of the docs it might work there, too.

How often developers encounter performance issues coming from the slow framework, so they need to switch to a fast one? Which one is the slow?
> It works on any JavaScript runtime: Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, AWS Lambda, Lambda@Edge, and Node.js.

Does it work in the browser as well?

Hono is great! I used it to build a dev blog w/ Cloudflare workers, source is here if anyone's curious:
I've been mulling over this weird idea that we should all be using an Edge (Web) Framework that manages the layouts + static site content, then pulls in either JSON or pre-rendered HTML templates from the more dynamic db-driven backends (which can then be in any language, and mapped to any path, and can be a majestic monolith or many microservices, whichever).

It would free things up so much - the backend team can focus on JSON/HTML templates, the designers can work directly with the website without necessarily going through dev (for better or worse ;), marketing can add all their little trackers, easy to outsource parts, and you could build up an entire cross-language ecosystem of plugins that manage anything from user accounts, billing, wikis, blogs, knowledge base, admin CRUD systems, ... yet it's all on the same site from the end user's perspective.

I think there are multiple enterprises that have (also re-)invented this architecture, but I haven't seen any serious open source offering that focuses on this type of use.

It’s good but it’s not much of a framework.

To me a backend framework is more like Rails or ASP.NET. Hono is more like an http router.

Has anyone also used an interesting alternative, Elysia, and understand the differences? Both are quite modern, ergonomic frameworks.
Have used this a bit on personal projects. Being runtime agnostic was the selling point for me. Wanted to try Bun as the runtime but not use APIs that are Bun specific, in case I ran into issues and had to move to Node.
Been using Hono for a few months and have really enjoyed it. For me, it's been the perfect minimal HTTP/router functionality needed to structure an API that lives within a single edge function that's deployed to Supabase and interacts with the Postgres DB therein. Great project – simple, intuitive, fast, lightweight.
I've built POC apps with both this and Elysia recently. Elysia is really cool, it has a bit of its own ecosystem. Eden Treaty for example, is the way it handles backend to frontend type-safety. Hono on the other hand, seems like such a nice ExpressJS replacement. I wouldn't hesitate to ship either one.
I use this both on Cloudflare Workers and classic Node servers, it's fast and reliable.
OT: I met the author of Hono at a Cloudflare meetup, he was really cool and we chatted about how things are so different in Japan, his country of origin. Honestly that's why in-person is so much better for.
How does Hono compare to Elysia?

I often heared both mentioned together with Bun.

Hono is fantastic and I will always recommend it to anyone who'll listen to me talk about it. For me, the speed doesn't really matter - most of my apps are deployed to Workers - but the developer experience and the ease of using Hono is in my experience unparalleled.
This is interesting:

I was just thinking about implementing a trie based router for fun in a different language, I would have never guessed that this big RegEx method is the winner in terms of performance here.

Looks like a js version of mojolicious :D
Please could a fellow HNer who has experience using this explain in simple terms what Hono on a Cloudflare Worker enables that one cannot already do with a vanilla worker?

The docs[0] are not instructive on this point.


Hono still doesn’t support request cancellation well.

So if you’re streaming tokens from an LLM and you cancel the request from the client you’ll be wasting money.

> Batteries Included - Hono has built-in middleware, custom middleware, and third-party middleware. Batteries included

What does this mean?

we decided to base our GenAI framework - Edgechains on Hono. Primarily because of winterjs compatibility. We build a WASM compiler to compile our prompts and chains into webassembly. Honojs was a critical part of it.

This is my go to stack too.

Hono, Cloudflare workers solves most of my server problems at affordable price

Having proper routing for cloudflare workers will be nice, and it looks like Hono covers all the bases.
Supabase already offers a full REST API when i upload my db. How does this differ?
Looks interesting. Does anyone have a good example that uses Client Components?
Did something change w/ Hono or it just someone reposting about it?
Using it in production
Enough with all the web frameworks.