TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

HonoJS: Small, simple, and ultrafast web framework for the Edges

300 pointsby nateb2022about 1 year ago

32 comments

soulchild77about 1 year ago
I created a pet project (REST API) with Hono and I&#x27;m seriously considering using it for future projects instead of what has been my go-to stack for years (Express, lately with Zodios).<p>Hono&#x27;s middlewares, especially zod-openapi[1] and @scalar&#x2F;hono-api-reference[2], make it really easy to define your REST endpoints once and get full typesafe routes with request&#x2F;response validation, an automatic OpenAPI spec, a beautiful OpenAPI browser and you can even reuse the typings in your frontend with Hono&#x27;s RPC[3] middleware, essentially giving you end-to-end type-safety without any code-generation.<p>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. :)<p>[1] <a href="https:&#x2F;&#x2F;hono.dev&#x2F;snippets&#x2F;zod-openapi" rel="nofollow">https:&#x2F;&#x2F;hono.dev&#x2F;snippets&#x2F;zod-openapi</a><p>[2] <a href="https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;@scalar&#x2F;hono-api-reference" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;@scalar&#x2F;hono-api-reference</a><p>[3] <a href="https:&#x2F;&#x2F;hono.dev&#x2F;guides&#x2F;rpc" rel="nofollow">https:&#x2F;&#x2F;hono.dev&#x2F;guides&#x2F;rpc</a>
评论 #40055449 未加载
评论 #40051401 未加载
评论 #40056524 未加载
评论 #40053177 未加载
mansaripabout 1 year ago
Recently, I&#x27;ve been looking for a suitable stack for another pet project. Personally my go-to stack is Remix.<p>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.<p>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.<p>And just yesterday, after spending hours I found a way to use PDFKit with Hono (Bun runtime), so I created a gist for reference:<p><a href="https:&#x2F;&#x2F;gist.github.com&#x2F;mansarip&#x2F;eb11b66e7dc65cee988155275a17a119" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;mansarip&#x2F;eb11b66e7dc65cee988155275a1...</a><p>Anyway I&#x27;m still cautious about putting this Hono + htmx stack into production use.
评论 #40048580 未加载
评论 #40056688 未加载
评论 #40058353 未加载
_splabout 1 year ago
I&#x27;ve been using Hono + Bun + SQLite for all my personal projects, and I really like it. Essentially, I&#x27;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.
评论 #40050198 未加载
评论 #40053135 未加载
samsquireabout 1 year ago
I&#x27;m curious what makes it so fast?<p>The README.md says RegExpRouter uses no loops and just regular expressions, presumably it maps a route to a hashmap matched entry?<p>Related but slightly different:<p>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&#x27;t match against strings but match against tokens)<p>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.<p>What are your thoughts on this style of programming?<p>I feel so much of modern business programming is dispatch logic!<p>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.
评论 #40052694 未加载
bastawhizabout 1 year ago
The benchmark that&#x27;s provided says nothing, actually. Being able to serve half a million requests per second isn&#x27;t a useful measurement for two reasons:<p>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&#x27;t stack unless you hit a concurrency limit, which most folks won&#x27;t.<p>2. The overhead of the framework is a rounding error. The slowest framework benchmarked clocks in at over 200K QPS. That&#x27;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&#x27;s _hundreds of times slower_ than the overhead, and the framework&#x27;s performance is already moot.<p>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 &quot;heavy&quot; frameworks like Koa and Express will give you good-enough performance that you probably wouldn&#x27;t ever even notice. What matters is the tool you choose that helps you build useful stuff faster.
strogonoffabout 1 year ago
At first glance, Hono seems like the most standards-compatible framework.<p>&gt; It works on any JavaScript runtime: Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, AWS Lambda, Lambda@Edge, and Node.js.<p>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.
评论 #40051112 未加载
评论 #40072245 未加载
评论 #40050733 未加载
Ajnaszabout 1 year ago
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?
评论 #40055026 未加载
vaylianabout 1 year ago
&gt; It works on any JavaScript runtime: Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, AWS Lambda, Lambda@Edge, and Node.js.<p>Does it work in the browser as well?
评论 #40048978 未加载
评论 #40048953 未加载
amsterdornabout 1 year ago
Hono is great! I used it to build a dev blog w&#x2F; Cloudflare workers, source is here if anyone&#x27;s curious: <a href="https:&#x2F;&#x2F;github.com&#x2F;brycedorn&#x2F;blog">https:&#x2F;&#x2F;github.com&#x2F;brycedorn&#x2F;blog</a>
jacobnabout 1 year ago
I&#x27;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).<p>It would free things up so much - the backend team can focus on JSON&#x2F;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&#x27;s all on the same site from the end user&#x27;s perspective.<p>I think there are multiple enterprises that have (also re-)invented this architecture, but I haven&#x27;t seen any serious open source offering that focuses on this type of use.
评论 #40050068 未加载
评论 #40049869 未加载
评论 #40048937 未加载
评论 #40049691 未加载
评论 #40050484 未加载
评论 #40049336 未加载
评论 #40049827 未加载
评论 #40048983 未加载
pier25about 1 year ago
It’s good but it’s not much of a framework.<p>To me a backend framework is more like Rails or ASP.NET. Hono is more like an http router.
评论 #40050552 未加载
评论 #40049765 未加载
评论 #40050481 未加载
SpaghettiXabout 1 year ago
Has anyone also used an interesting alternative, Elysia, and understand the differences? Both are quite modern, ergonomic frameworks.
评论 #40079705 未加载
iansinnottabout 1 year ago
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.
bnjemianabout 1 year ago
Been using Hono for a few months and have really enjoyed it. For me, it&#x27;s been the perfect minimal HTTP&#x2F;router functionality needed to structure an API that lives within a single edge function that&#x27;s deployed to Supabase and interacts with the Postgres DB therein. Great project – simple, intuitive, fast, lightweight.
评论 #40052205 未加载
nobleachabout 1 year ago
I&#x27;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&#x27;t hesitate to ship either one.
rozenmdabout 1 year ago
I use this both on Cloudflare Workers and classic Node servers, it&#x27;s fast and reliable.
orliesaurusabout 1 year ago
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&#x27;s why in-person is so much better for.
k__about 1 year ago
How does Hono compare to Elysia?<p>I often heared both mentioned together with Bun.
评论 #40061827 未加载
dejaydevabout 1 year ago
Hono is fantastic and I will always recommend it to anyone who&#x27;ll listen to me talk about it. For me, the speed doesn&#x27;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.
__jonasabout 1 year ago
This is interesting:<p><a href="https:&#x2F;&#x2F;hono.dev&#x2F;concepts&#x2F;routers" rel="nofollow">https:&#x2F;&#x2F;hono.dev&#x2F;concepts&#x2F;routers</a><p>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.
jpahdabout 1 year ago
Looks like a js version of mojolicious :D
axhlabout 1 year ago
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?<p>The docs[0] are not instructive on this point.<p>[0] <a href="https:&#x2F;&#x2F;hono.dev" rel="nofollow">https:&#x2F;&#x2F;hono.dev</a>
评论 #40048799 未加载
orphabout 1 year ago
Hono still doesn’t support request cancellation well.<p>So if you’re streaming tokens from an LLM and you cancel the request from the client you’ll be wasting money.
rrr_oh_manabout 1 year ago
<i>&gt; Batteries Included - Hono has built-in middleware, custom middleware, and third-party middleware. Batteries included</i><p>What does this mean?
评论 #40048913 未加载
评论 #40049682 未加载
评论 #40049545 未加载
评论 #40048905 未加载
sandGorgonabout 1 year ago
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.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;arakoodev&#x2F;EdgeChains&#x2F;">https:&#x2F;&#x2F;github.com&#x2F;arakoodev&#x2F;EdgeChains&#x2F;</a>
评论 #40049866 未加载
prakashn27about 1 year ago
This is my go to stack too.<p>Hono, Cloudflare workers solves most of my server problems at affordable price
4star3starabout 1 year ago
Having proper routing for cloudflare workers will be nice, and it looks like Hono covers all the bases.
spxneoabout 1 year ago
Supabase already offers a full REST API when i upload my db. How does this differ?
renke1about 1 year ago
Looks interesting. Does anyone have a good example that uses Client Components?
dandigangiabout 1 year ago
Did something change w&#x2F; Hono or it just someone reposting about it?
guntaabout 1 year ago
Using it in production
0xeddabout 1 year ago
Enough with all the web frameworks.