npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@routegraph/hono

v1.0.0

Published

Hono v4 adapter for RouteGraph — runs on Node, Bun, Deno, and Cloudflare Workers.

Readme

@routegraph/hono

Hono adapter for RouteGraph — turns a loaded RouteGraph into a Hono app.

Runtime coverage

| Runtime | Supported | |---|---| | Node.js (via @hono/node-server) | ✓ | | Bun | ✓ (Hono's native support) | | Deno | ✓ (Hono's native support) | | Cloudflare Workers | ✓ (Hono's native support) |

This adapter contains no runtime-specific code — it only builds on Hono's own Context API, so it inherits whatever runtimes Hono itself supports. It is exercised in this monorepo's tests and examples on Node.js via @hono/node-server.

Installation

pnpm add @routegraph/hono @routegraph/core hono zod

hono is a peer dependency (>=4.0.0). On Node.js, you'll also need @hono/node-server to actually listen on a port.

createHonoRouter(graph)

function createHonoRouter(graph: RouteGraph): Hono

Usage (Node.js)

import { Hono } from 'hono'
import { serve } from '@hono/node-server'
import { RouteGraph } from '@routegraph/core'
import { createHonoRouter } from '@routegraph/hono'

const graph = new RouteGraph({ routesDir: './routes' })
await graph.load()

const app = new Hono()
app.route('/api', createHonoRouter(graph))

serve({ fetch: app.fetch, port: 3000 })

For Bun, Deno, or Cloudflare Workers, mount createHonoRouter(graph) the same way (app.route('/api', ...)) and export/serve app.fetch using that runtime's own entry point — there is nothing Node-specific in the adapter itself.

Hono-specific notes

  • Body parsing: the adapter calls await c.req.json() itself for POST/PUT/PATCH requests — you don't need a separate body-parsing middleware. A missing or invalid JSON body is treated as undefined, letting your route's Zod body schema (if any) report the real validation failure instead of a generic parse error.
  • Query arrays: built from c.req.queries() — a key that appears once resolves to a string, a key that appears more than once resolves to string[]. This matches what @routegraph/client produces when serializing an array-valued query field.
  • Error handling: unlike Express, thrown handler errors are caught by the adapter itself and turned into a 500 { error: 'Internal server error' } JSON response — there's no equivalent of forwarding to next(err). Use Hono's own app.onError(...) at the app level if you want centralized logging of those.
  • Docs UI: routegraph dev's automatic docs-UI mounting is not implemented for Hono yet — see examples/with-express/index.hono.ts for the manual bridging pattern (wrapping createDocsMiddleware's Connect-style signature into a Hono middleware).

Validation error format

Identical across every adapter:

{ "error": "Validation failed", "issues": [{ "field": "body.email", "message": "Invalid email", "code": "invalid_string" }] }

Accessing the raw Hono Context

const handler: RouteHandler<typeof config> = async (req, res) => {
  const c = req.raw as import('hono').Context
  console.log(c.req.header('x-request-id'))
}