Hono

H

Hono

This is the official Hono discord server for the community

Join

`args?` is blank despite using zValidator

Set up details Using Deno (2.4.2, the latest version) And all the other packages are also up-to-date (Hono 4.8.5, zod-validator 0.7.1, Zod 4.0.5) I'm getting the packages from NPM, not JSR...

How to Achieve Full Type-Safe Communication Between a Hono Server and a Next.js Client in a Monorepo

I have a Hono server running on port 8787 and a Next.js client on port 3000. Both are in a monorepo. How can I achieve full type safety between them? I also want the requests to be written in a very professional way,...

Discriminated Unions from AppType

Hi there! I had a question about the returned type of hc<typeof app>. I have an API route that returns 400 and { success: false, error: SomeTypes } . Generally I would expect this to create a discriminated union on result.ok or on body.success (or both!) but neither seems to work. This seems to be related to returning c.json() multiple times in my route, but in theory I would expect this to consolidate types. I've attached some screenshots as an example. In the last screenshot instead of success: boolean it should be a literal, success: false which would allow me to use it as a discriminate. Would love any insight folks have!...
No description

HTTP Status bug

Getting a weird bug when returning a response in my project for a post request. Previous get requests return data correctly, but this one is giving me problems for some obscure reason. This results in an Internal server error Error message: The status provided (0) must be 101 or in the range of [200, 599]...

How to serve hono streamSSE via nginx reverse proxy

2025/07/07 12:40:30 [error] 22#22: *1 upstream sent duplicate header line: "Transfer-Encoding: chunked", previous value: "Transfer-Encoding: chunked" while reading response header from upstream, client: 192.168.65.1, server: localhost, request: "GET /api/v1/robots HTTP/1.1", upstream: "http://192.168.1.120:5002/api/v1/robots", host: "192.168.1.120"

Serving a SPA with Hono breaks on Chrome but not Firefox.

Hi, I'm serving a vite-react app as described in the docs: ``` app.use("", serveStatic({ root: "./dist" })); app.get("", serveStatic({ path: "./dist/index.html" }));...
No description

Use hono with Turborepo's JIT packages?

I'm trying to setup a monorepo with Turborepo. One of the concepts are just-in-time packages. These packages export TypeScript files and are transpiled by the consuming application. My understanding is that these types of packages require a bundler. However, the hono server typically just relies on tsc. https://turborepo.com/docs/core-concepts/internal-packages#compilation-strategies Is there still a way I can use just-in-time packages with hono?...

Lazy routers?

Hi, does hono support lazy routers? I made a really huge router with some heavy dependencies and now I'm getting spikes on cold starts

Issue with c.req.formData() on Vercel

Hi I have a Hono API deployed on Vercel. I have a function that starts like this ```ts // Pusher auth route const pusherAuth = factory.createHandlers(authMiddleware, async (c) => { // Get socket_id and channel_name from the request...
No description

ERR_UNKNOWN_FILE_EXTENSION when running `bun create hono my-app`

``` $ bun create hono api
node:internal/errors:497 ErrorCaptureStackTrace(err); ^...

hono c.set() showing error but what is wrong and also prisma error

i dont understand what i am doing wrong like i understand the error but don't know how to resolve
No description

Cannot use `c.get` in `hono-rate-limiter`

I am trying to use the hono-rate-limiter package to create a middleware that enforces rate limits based on which consumer is accessing the API. Here's my implementation: ```ts const consumerRateLimitMiddleware = rateLimiter({...

Auth0 and Hono

I am building an SPA in angular to run on cloudflare with Hono as the back end. I'm trying to add some third party user authentication so I don't have to do it myself, and as this is a small project, Auth0 seems fine. The front-end part of angular+auth0 is working, however, I cannot get the back-end to work. I've tried both the auth-js middleware with an Auth0 provider, as well as just using the OIDC middleware and the jwt middleware. The auth-js just rejects the token (I have verified that the token was being sent), while the OIDC gives me a CORS error. I have no idea which of these is even close to working. I am also okay just switching to something else as long as its simple to implement in angular (better-auth has no angular support nor could I find any easy examples). I'm not terribly knowledgeable about this sort of thing, so I apologize if I get terminology wrong. Is there a good example of how to implement either the OIDC middleware or the auth-js middleware? Auth0 has an express example doing something with JWT, but I think its the same as the JWT in hono....

Does anyone have any recommendations for handling RPC response errors?

I want to do something like the parseResult function below so I can have consistent error handling across my app, but I've been struggling with getting type generics to work on the parseResult function such that the result type is correct. I'm kind of curious if anyone has recommendations on how to best handle using the rpc client throughout the app, or maybe I'm just over complicating things. ```ts...

Route is cached. Can't clear it even after ending server.

I had a hono app running a route as such: ```ts export const app = new Hono(); app.use(cors()); export default app;...

Changing the response in the middleware breaks it

As seen on the #Extending the Context type , I'm trying to do an arriValidator now to create a new middleware for the @arrirpc/schema validator (like the zValidator, which should actually just be standard validator, but whatever) But, when I add the created arriValidator to the handler, the handler just doesn't return anything, even when the middleware clearly said for it to ```ts export function arriValidator<T extends AObjectSchema>(schema: T): MiddlewareHandler { const problemSchema = problemResponse(schema);...
No description

Extending the Context type

So, I've made a function to work to with @arrirpc/schema (yes, it's a validator), so I can use it like this ```js export const routes = new Hono() .get("/", async (c) => { return respondWith(c, HealthSchema, { status: 200,...

Question about CSRF

Hey everyone Trying to use CSRF protection, and I'm wondering if that work like Laravel CSRF protection (input hidden with a CSRF token) ...

Looking for tips about best practices

hey everyone, question trying to use factories with my routes factory.handlers should contain one method ?...

honox asset caching

I'm using honox in my project. In production it creates a signed css and js files + adds all static files located in the public folder as expected. The issue is their cache control is set to public, max-age=0, must-revalidate Is there anyway to control it? I want to cache the css, js and static files forever