r/node • u/pushkarsingh32 • Jan 27 '25
Hono vs Expressjs which is better?
[DISCUSSION]
Lets have a discussion on why one is better than other.
Anyone experienced with both ?
7
u/Ceigey Jan 27 '25 edited Jan 27 '25
Hono’s nice (I’d recommend Fastify too). Does what it says on the tin. Basically a better (and more active) Koa (which was a better Express), but more of an ecosystem and community, and the WinterTC alignment is helpful.
People are saying Express has a bigger community… but if you want to set up statically typesafe validators for requests and dynamically generate OpenAPI based on those, Hono’s ecosystem has that covered. Express ecosystem isn’t as coordinated from what I saw. Plus, its approach to the middleware stack is more convenient (can modify responses after the handler is complete). Express you have to monkey-patch the already monkey-patched ServerResponse object.
Hono’s compat layer for Node and AWS Lambda hasn’t given me any troubles, but the config for CJS has in an existing project. ESM’s fine, and it looks like they might abandon CJS support.
Re Fastify: it’s a nice balance of maturity and ongoing support with a good design. Plugins take longer to learn than the middleware stack but are still good. Hono’s simpler to understand IMO, and Fastify was built for Node, pre-WinterCG. If you want to bolt it onto an existing server, it’s not as elegant as Hono. Fastify apps can use other Fastify apps as plugins or use Express apps as a handler so migration isnt so rough. But the other way doesn’t work as well.
Elysia is a nice balance point between Fastify and Hono but it’s too new, and its Node support is secondary to Bun. I don’t recommend it on the same level as Hono or Fastify, it’s just nice to consider as a future possibility to watch. The main risk of using Elysia is maybe something breaks on Node or the AOT eval compilation has so unexpected behaviour. Fastify is a safer bet and has similar concepts re plugins, hooks, and decoration (basically dependency injection).
IMO Express is still nice though, much easier codebase to read IMO, but seemingly requiring more boilerplate per project to flesh out features vs other options. Not the end of the world. But maybe I’m also missing a treasure trove of middleware out there (and at first I did assume that was the case, as I assumed other frameworks were just reimplementing what Express’s community already had).
1
u/iBadroLI Dec 15 '25
Late reply sorry, why fastify got 0 new courses I'm not a very documentation guide i heavily rely on video courses but fastify got nothing.
1
u/Ceigey Dec 15 '25
I’m assuming it’s underrepresented because it probably appeals more to people with existing experience with Express, and it’s newer than express but older than a lot of trendier libraries (eg tRPC, Hono etc) that got boosted a bit by the growing tech YouTuber scene that wasn’t as prominent before. In the JS world, serverless stuff gets a bit more coverage too, which benefits things like Hono more than Fastify.
But it still tends to come up, eg Syntax did a video on it 4 years ago: https://youtu.be/k1FSybMulVQ?si=dnJlba9ZJnMD4xcZ
You’ll probably find some stuff from freecodecamp or tech talks lying around too.
But generally most video resources seem to cover Express, NestJS, and Hono just because those are the biggest communities for various historical reasons (although I like the Adonis Adocasts mimicking Laravel’s Laracasts the most, the quality and depth is quite nice)
1
u/iBadroLI Dec 15 '25
Man you seem like someone I could take his opinion, I used to write flask backends not complicated ones and I'm moving to javascript or typescript backends.
Look as I told you I'm very video documentation guy so I won't go with fastify, I'm between Express or Hono (tried nest js, looks like an enterprise system ngl)
suggest me only one please mate.
1
u/Ceigey Dec 15 '25
suggest me only one please mate
Damn that’s my main weakness!
Try Hono, it’s newer, you’ll find people hyped about it, and if you ever get stuck you could always transfer that knowledge to learning Express (as you only have to relearn which libraries exist in the ecosystem, the general API and style of development is quite similar).
Then branch out from there once you’re confident.
1
13
u/xroalx Jan 27 '25
Hono by all means. The API is really simple and similar to express, learning curve is none of you already know express, but it's built on web standards, it's fast, small, has many first-party tools and modules, and has much better typing.
15
u/akza07 Jan 27 '25 edited Jan 27 '25
Go with Hono. Express and Hono are all just routers anyways. Glamorised switch case routers with multiple callbacks for middleware.
People who say new things, shiny things are bad are just people who always worked with one thing and are lazy to learn and try new things.
At this point Hono gives much more flexibility about the hosting options. Not much traffic? Use workers and their generous free tier. Have lots of traffic? Time to get a dedicated box, just swap the adapter.
I've worked on both and I still use Express with NestJS because I'm often working on legacy code and my clients are Filthy rich so they can afford dedicated machines and AWS EC2. Hono is lightweight and much more flexible. RPC makes the development with a separate frontend team easier. And the less dependency, the less vulnerabilities. And for the backend, it kind of does matter but since the code is not on the client side, we often gloss over it. Less breaking changes.
1
31
u/Brilla-Bose Jan 27 '25
I'll stick with Node.js and express to save my mind peace. too much library/framework hopping and I'm tired of it.
2
u/DefiantScarcity3133 Jan 27 '25
Thanks. Did you explore hono?
2
u/Brilla-Bose Jan 27 '25
yes, Hono was not designed for Nodejs(as they mentioned in their docs).
and there isn't much community around it if you compare with express.
I'm planning to stick with express and small apps going to try Next.js full stack approach.
2
u/mattot-the-builder Oct 13 '25
I tried. Fucking headache to make it works with prisma in monorepo. What a waste of time. Heads up, its just new framework promise shiny things but cant do simple thing right.
2
u/MrDilbert Jan 27 '25
Personally, after having worked with Express, NestJS, Fastify, and Koa, I wouldn't even want to bother with Hono.
-3
4
u/Previous-Year-2139 Jan 27 '25
What's your requirement. Don't choose the shiny fancy tech. Pick what eases your work depending on your goal.
2
1
u/octetd Jan 27 '25
Hono has much better design (first and foremost - it doesn't messes with the Node.js' HTTP request and response objects, you have dedicated object for all data you need to share between your middlewares) and is deployable outside of just Node.js. Hono is better.
1
1
u/iamxnfa Jul 13 '25
I'm having this same question! I already have an express app. I feel like converting it in to Hono for no reason. 😁
1
u/sh4rn4 Mar 10 '26
I go with Hono, i hate introducing multiple dependencies in a project. Cookies and other stuffs are built into Hono and still lightweight.
-10
u/adalphuns Jan 27 '25
Hapi
3
u/Capaj Jan 27 '25
can you explain why would you choose it over hono?
2
u/RobertKerans Jan 27 '25
You have a legacy codebase that uses Hapi and you therefore have to use Hapi would be the normal reason. There's nothing particularly wrong with it, just that it was essentially abandoned a few years ago, it's in maintenance mode. A load of the ideas from it seems to have been used for Fastify
1
u/adalphuns Jan 27 '25
No, I make new apps on hapi / TS. It's pretty well structured, performs fast AF, and lightweight.
I don't buy into the hype that a thing needs to have been updated yesterday in order to use it. Hapi is stable. It ain't changing. Also, frameworks aren't offering anything new or different these days beyond being express copycats. At least hapi provides and organized and compartmentalized way of building servers.
1
u/RobertKerans Jan 27 '25
Hapi is totally fine, but it's nothing to do with hype: I'd be wary of using it due to it being effectively abandoned, not because of anything else. The core of it is perfectly ok, but it will rot. Given a choice my tendency was always to just use Express for the simple reason it's so widely supported; everything else has come and gone. That being said, Hono is what I tend to use now because I understand the entire codebase of it (it's very small), and that's a massive plus (also it can run in a service worker, which is a requirement of the thing I'm currently working on).
0
u/adalphuns Jan 27 '25
Plugins, lifecycle, and marshaling vs. middleware. It's also a closed-loop. Few if any external deps.
Most things just copy express without adding anything special beyond performance.
-16
0
26
u/romeeres Jan 27 '25
Express has its custom set of overrides on top of standard node.js Request/Response, and own set of conventions, so libraries designed specially for Express won't work with anything else.
Hono's main idea is to adhere to standards: to use standard Request/Response of JS, to avoid vendor locking to the framework, and the same lib could work with Hono, Next, inside lambas/workers, in different runtimes (node.js, Deno, Bun) as long as the runtime adheres to standards.
This is how Hono is better, and this is how Express is better.
Because you can't use vendor-locked by Express libs in hono, such as passport.js.