Hono

H

Hono

This is the official Hono discord server for the community

Join

How to share Hono RPC client type with frontend package?

We have a Hono backend application using Prisma ORM. One day our frontend application added the backend package as a dependency to use Hono RPC. However, this led to the following error since PrismaClient only works in a Node.js runtime: ```...

Component Library SSG

I'm having trouble with CSS imports on SSG. I have HonoX app that i'm trying to add Cloudscape components to. I've got it working on the React renderer, and the build itself works on dev mode. However, on building with SSG, it errors at the first Cloudscape import, because the css module cache returns an undefined. Cloudscape does a lot of internal CSS imports, which should (and do) work. It is only with the SSG plugin. Fine, i would ship dist/index.js and run in server-mode, but if I run without SSG plugin, I get a blank page?? (I would prefer SSG for this project)...

hono/jwt expiresIn

Does hono/jwt have experiesIn? As far as I can see, no, but how can I do it? I like the module because it has everything, so I wouldn't want to install another one separately (even though it's not a big problem).

Migrating from Express to Hono. Static files caching

Hi! Migrating from Express and I do have a hard time understanding how caching works in Hono. In Express we could do this: ```ts app.use( '/assets',...

How can I resolve bundle error with Hono and Bun in monorepo

Hi, could you please tell me how to resolve bundle error with Hono and Bun in monorepo? What I want to do I have created my own Web Components framework. I want to import this framework in the test application with Hono....

How do you manage CSS with server rendered HTML in Hono?

Do most of you just use built-in css helpers, which are basically executing javascript to generate stylesheets? I'm creating app which will be most likely 90% rendered on server, maybe creating static CSS files and serving them would be more efficient? On the other hand - I'd really like to use some UI framework, maybe even headless. Any opinions?...

static files 404 when in subdirectory of assets

Hello, i am using hono with a cloudflare worker to serve the asset folder 'assets' as seen in the examples: ``` <p> Try visiting: <a href="/my-file.txt">/my-file.txt</a> and <a href="/folder/nested-file.txt">/folder/nested-file.txt</a> </p>...

Versions of @hono/zod-openapi >= 0.17 will cause vscode to crash

When I upgraded package @hono/zod-openapi to >= 0.17, vscode's typescript server gets stuck and stays in the state of being loaded with IntelliSense. May I ask what is causing this?

Any lib for API rate limiter in hono CF worker?

I'm looking for something like this: https://www.npmjs.com/package/hono-rate-limit but maintained. Do you know anything? Even some side-code repo would be great...

Closing resources and streaming response

I'm running Hono on node.js and I had a bug the other day, we added an endpoint to our API that was streaming the response back to the client, however we got some weird connection error to our database while the stream was running. In one of our middleware we instanciate a postgres.js connection to the database, and we use this connection to generate streaming data to the client, however to avoid leaking connection we explicitly close the connection at the end of the middleware (I know there are some ways to re-use connection using pooling, but this is not the point here (for info, we are dynamically connecting to many different database depending on where the request is coming from, so we can't easily implement a pooling mecanism on this server). Of course the middleware is running as soon as the response (i.e the beginning of the stream) is send back to the user, which trigger the cleaning of the resource, and a failure of the generator to produce more results in the stream. The following reproducer explains the problems quite well I think:...

How to implement renderToPipeableStream with the streaming API?

```ts return stream(c, async (stream) => { const {pipe} = reactServer.renderToPipeableStream( <></> , {...

Getting isssues on adding data to KV store

Logs [wrangler:inf] POST /api/v1/renewal-reminders 200 OK (33ms) Code: const app = new Hono();...

Use zod schema generated with prisma with @hono/zod-openapi

Is there a way to use already generated zod schema with @hono/zod-openapi ? The Zod schemas generated by Prisma are not enhanced the way @hono/zod-openapi provides. Does anyone know a way to enhance them for use with createRoute from @hono/zod-openapi (request.params, json validator, ...)...

RPC types not working well inside a monorepo

I have a monorepo setup with packages/api for my hono api and app/www for the client code. I have set up rpc well but i am getting Type instantiation is excessively deep and possibly infinite.ts. I have tried the following - I have set strict to true on both my api and client package - have set composite true in my api package and set path reference in my client package. The above two helped to infer the types in the client from unknown to actual types but now its giving the type instantiation error....

Update the default validator to return custom error response

hey guys, I want to update the default zValidator of hono to return custom error objects. Right now, it returns something like this: ```json { "success": false, "error": {...

Get the username using basic auth

```jsx import { Hono } from 'hono' import { basicAuth } from 'hono/basic-auth' const page = new Hono()...

deno: react-pdf pitfall

If you are using deno+hono and react-pdf to create pdfs, do not use the default import like the docs of react-pdf say. Instead of ```typescript import ReactPDF from "@react-pdf/renderer";...
No description

correct type of this `Context`

from here https://hono.dev/docs/middleware/builtin/timeout#usage I tried ```ts context: Context<{ Bindings: Env }>...
No description

Honox scripts and styles not working in production

Hi Guys, Am currently trying to deploy a honox project in Deno deploy. The project is working well in the local machine but when deployed the islands and styles are not working. It might be a path issue but am unsure on how to proceed. _renderer.tsx ```...

Typing nested controlled

Hi, how can I get this param typed? ```typescript import { Hono } from "hono" // reviews controller...