6 ms·
Hono v4.0
- arminluschin 3y agoI only ever used hono as a simple convenience router for my cloudflare functions. This feels ambitious. I’m a bit skeptical if this is the right direction frankly, I hope it doesn’t make the framework too bloated.
- cosbgn 3y agoSame, I'll probably move to https://github.com/unjs/h3 https://github.com/unjs/h3 since it's used anyway in Nuxt (which I use for other projects)
- eddd-ddde 3y agoNot too long ago I discovered itty-router and since then it's the only thing I need for my APIs. It's extremely minimalist, I just create a context object and implement in it any functionality I need such as headers, error handling, anything. I even use it for "CLIs" that I then call with curlie.
- lf-non 3y agoYeah, I like Hono, but it was surprising to see a react alternative from them. I am not sure why they are trying to compete with preact/atomico.
- evnix 3y agoHave to agree on this one. As a current user of Hono, I'll just switch to a proper router. I don't want those SSR oddities and react like "hooks" sneak into our backend codebase. They have been a constant source of confusion, bugs and performance issues in our frontend app. Let me save you from typing the obligatory HN response: YoU DoNt HaVe tO UsE ThOsE
- kkielhofner 3y agoSame. IMO Hono + Workers seems to be somewhat of a hidden gem but this largely comes down to Workers, of course. The performance (and especially pricing) is pretty wild and combined with various bindings (R2, KV, D1, AI, etc) general Cloudflare stuff, free egress, etc it can provide significant advantages. That said looking at this I’m confused, to put it mildly, and I may start looking elsewhere. Back to itty-router?
- drewbitt 3y agoDoesn't seem right to me either. Of note though, it has not bloated the core and you can continue using the backend portions the same as before.
- surprisetalk 3y agoI'm using Hono and Deno for https://flashcasts.com https://flashcasts.com Hono + Postgres.js is getting pretty close to my ideal web stack. IMO, SSR websites is the best way to get projects out quickly: predictable "builds", minimal surface area, boring tech, etc. It helps that Hono has a very clean API :)
- xrd 3y agoAnother thread here mentioned SQLite. Can you say more about why/how you are using postgres.js? I use pocketbase a lot and am curious how your stack handles auth, login, etc?
- surprisetalk 3y agoHere's two posts I wrote on how I do email tokens and async workers: • https://taylor.town/pg-email-token https://taylor.town/pg-email-token • https://taylor.town/pg-task https://taylor.town/pg-task Here's a condensed version of how I do login/signup: app.post("/signup", async c => { const body = await c.req.parseBody(); const usr = { email: body.email.toString(), password: sql`crypt(${body.password.toString()}, gen_salt('bf', 8))`, } as Record<string, unknown>; const [{ usr_id, email, token }] = await sql` with usr_ as (insert into usr ${sql(usr)} returning *) select usr_id, email, email_token(now(), email) as token from usr_ `; await sendVerificationEmail(email, token); await setSignedCookie(c, "usr_id", usr_id, cookieSecret); return c.redirect("/u"); }); app.post("/login", async c => { const { email, password } = await c.req.parseBody(); const [usr] = await sql` select *, password = crypt(${password.toString()}, password) AS is_password_correct from usr where email = ${email.toString()} `; if (!usr || !usr.is_password_correct) return c.html(<p>Your password was incorrect.</p>); if (!usr.email_verified_at) await sendVerificationEmail(usr.email, usr.token); await setSignedCookie(c, "usr_id", usr.usr_id, cookieSecret); return c.redirect("/u"); });
- xrd 3y agoHa, Taylor, of course this is you doing cool things in cool outfits. I should have known. Thanks! My favorite truth in that site: "Anyway, instead of learning biochem and spanish I went and built this stupid website." I don't know what you are talking about at all.
- deleted 3y ago[deleted]
- _heimdall 3y agoI've used deno + hono and a basic file-based router for a few projects now. The biggest win IMO is avoiding a build step, I hope HonoX and the hono project in general don't start walking down the same path as others, using Vite for a required build and bundle step. Astro already solves many of the problems HonoX will run into, if a build step with Vite is acceptable for you. What I personally really want is an easy way to deploy exactly what I have locally and keep my dependencies small enough that shipping it unbundled isn't a problem for your project.
- iainmerrick 3y agoHow does the "basic file-based router" work, out of interest?
- _heimdall 3y agoIt was a pretty lazy one-off router, nothing too fancy. I use deno's file API to scan a `routes` directory and modified a copy of Astro's router to parse filenames and prioritize route matching patterns. API-wise its very similar to most other file-based routers, including HonoX. Each file exports `GET`, `POST`, etc functions to handle requests.
- antifa 3y agoI've used it with nuxtjs (front-end) and it's the greatest thing ever. Forces Junior devs to make front-end files that can be inuitively found by the nature of what they are (the file's filename has a logical relationship with it's URL in the browser), no longer need to maintain large garbage piles called router files. Objectively, there's literally no advantage to manually managing a router file. NuxtJS proves this for the front-end SPA. I've been looking for a backend nodejs HTTP framework that is a) Typescript-first b) actually good that has file-system-based routing and so far haven't found anything. Adding HTTP methods on top of what nuxtjs' filesystem based routing does has me a little skeptical of what's possible, but I'll investigate Hono on this basis alone. Also the "Edge-first" thing tells me this backend framework is probably better tree-shakable than what most other ancient/modern nodejs http servers have been doing. Cold starts will be better no matter where you deploy.
- postepowanieadm 3y agoHono, Bun and SQLite are soo boring - I love it.
- rsx990 3y agoHey there. How do you host your sqlite dbs??
- joshstrange 3y agoHono looks very cool but in my experience you can quickly run out space in your lambda (package size) when you bundle your whole application together verses having each endpoint be it’s own package. Am I wrong or have others experienced this as well? Just having 1 package (to deploy vs 1 per endpoint) would be super nice in a number of ways and you could take advantage of things like provisioned concurrency (something much more difficult to plan for when you have a lambda per endpoint). Maybe I’ll just branch my main project and see what happens as I move my code into a monolith with Hono but I’d love some feedback if others have experienced this and/or how they worked around it. I guess you could still have multiple Hono-based packages that handle segments of your backend (verses all in one), is this how people are managing it?
- willsmith72 3y agohow much space is too much? curious how much you've had hono apps use i've done a few express apps on lambda, just because it was a free way to host fun projects and i didnt want to use a custom framework/tech, and they never got above 25MB zipped. big, but not really close to the limit (i believe 50MB)
- joshstrange 3y agoI’ve never used Hono, I’m just interested in it. I think the AWS Lambda limits are something like 50Mb compressed and maybe 200Mb uncompressed. I might be a little off, I’m on my phone right now. Prisma doesn’t help matters but right now I take that hit on every function package anyway. I might just need to try it one day (move my existing app to Hono to see if it would work).
- toinbis 3y agoAm very curious about the same very question. "I guess you could still have multiple Hono-based packages that handle segments of your backend" -> I am thinking the same - if you hit bundle size problems, you can just split your app. I'd also love to see some benchmarks how bigger bundle size impacts the performance - i.e. 1 MB adds additional 1ms on average, or so... My platform of interest is mostly Cloudflare Workers.
- pbronez 3y agoNever heard of this, took some digging to figure out what it is. Best blurb I found was in the docs, not the homepage: Hono - [炎] means flame in Japanese - is a small, simple, and ultrafast web framework for the Edges. It works on any JavaScript runtime: Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, Netlify, AWS Lambda, Lambda@Edge, and Node.js.
- Kennnan 3y agoI use hono a lot and im going to avoid these new features for certain. Hono already had a problem with documentation and feature completeness for anything beyond their simple REST api, such as their middlewares like graphql and RPC. The jump in complexity from a meh graphql plugin to a full stack SSR framework is so massive and I don't think the current dev team can do it justice. I highly recommend anyone looking into this to instead stick with larger, better community supported projects like Astro.
- lf-non 3y agoI formed a similar impression. I tried using their graphql plugin only to discover that there was no way to pass a context to the graphql handler (at the time) which was surprising. I went back to yoga after that.
- rozenmd 3y agoI rewrote OnlineOrNot's API to use Hono + Zod (almost a drop-in replacement for Express), and got an OpenAPI schema out of it for very little additional work. I highly recommend it, and wrote more about it here: https://onlineornot.com/built-my-http-docs-from-scratch#converting-openapi-schemas-to-markdown https://onlineornot.com/built-my-http-docs-from-scratch#conv...
- carstenhag 3y agoNowhere there's any explanation of what this is. Web standard? Fast? Workers? Ok, but what is it doing? How can it help me? The snippets subpage is empty. The examples have code directories with almost empty readmes.
- asplake 3y agoI agree that “fast, lightweight, web standards” isn’t much of a description but not too far down https://github.com/honojs/hono https://github.com/honojs/hono I did find this: > Hono … is a small, simple, and ultrafast web framework for the Edges. It works on any JavaScript runtime: Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, AWS Lambda, Lambda@Edge, and Node.js.
- MrAlex94 3y agoSorry, should’ve probably added a text description. Hono is a JavaScript framework designed to run on (but not just) Edge runtimes. It’s nice due to it being very “lightweight”. It was mainly for server side functionality but this release adds more front end functionality, which I find quite welcome. Personally I have found this works well if you’re targeting those platforms. For example, I use it on Cloudflare Pages with Page Functions and it works a dream. I haven’t found it to be a write once target anywhere platform (for example, serving static files differs between platforms), but it makes it significantly less effort to migrate to a new platform if necessary, which is always nice.
- deliriumchn 3y agoyeah, the text on their main landing page reads like a promo you see in a game; just a combination of fancy words lol "Hono Fast, Lightweight, Web-standards Runs on any JavaScript runtime."
- theultdev 3y agofast = fast routing / throughput lightweight = small code size web standards = not node apis (fetch, not http.createClient, etc.) runs on any JS runtime = runs in deno/node/bun/workers/etc --- But yes the project is meant to be read by someone already in the field. The people who actually know how to use it. Yes it seems like a fancy combo of words if you don't know what they mean, but that's true for anything.
- cacozen 3y agoI know AWS's LLRT was just announced, but it would be great if this would support it. (For reference: https://github.com/awslabs/llrt https://github.com/awslabs/llrt)
- davidy123 3y agoWould this be a sort of holy grail product, where we could write once for 'edge/function/lambda' systems? I am helping develop a new project that will be hosted on Azure, but would really like to make it as cloud portable as possible, including a cloud-free version. It is a significant product for a government agency, and it will be open source. I really want to get this piece right. Thanks! [edit] I notice Azure support is under development. But the time frame could be ok if it has good tests & the project is well supported.
- cranberryturkey 3y agohow does this compare to primatejs?
- pdyc 3y agoI am using it to build https://easyanalytics.win https://easyanalytics.win . Honojs is a nice framework for routing. I chose it because i was working on cloudflare functions and i did not wanted to tie my application to cf way of doing things. By using honojs i can use it in both serverless as well as server-full settings without any changes. However i am not liking the current direction this project is taking its becoming too bloated.
- lioeters 3y ago> not liking the current direction I agree, with this new major version the API surface of Hono became way too big, including so many features that don't seem to belong in the library. It's no longer small or simple. I will be searching for another library that stays true to its original simplicity.
- reactordev 3y agoThis is awesome! The server-side, the page gen, the router, jsx on the backside, outstanding work! In webdev, I’ve been a huge fan of vite since it came out. Not having to wrangle configurations and bundlers and everything was very welcome. I wrapped it all up into a useful internal tool to play nice with our packages and splice together express+vite frontend. Then koa+vite. After playing with bun, I’m very keen on stack setups with convention over configuration (with config options) to just do the typescript thing, do esm, do it well. I’m going to give this a go this weekend and see if this can replace our setup. Bun+Vite(React-TS)+Koa.