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

@goodie-ts/hono

v2.1.0

Published

Hono HTTP controller integration for goodie-ts

Readme

@goodie-ts/hono

HTTP controller routing decorators for goodie-ts with Hono.

Install

pnpm add @goodie-ts/hono hono

Overview

Hono HTTP integration for goodie-ts. Provides route decorators (@Controller, @Get, @Post, etc.), security (@Secured, @Anonymous), OpenAPI support via hono-openapi, the transformer plugin for compile-time route wiring, @Validate for request validation, and multi-runtime EmbeddedServer.

The hono transformer plugin scans controller metadata on components and generates a createRouter(ctx) function that wires controllers from the DI container to Hono routes. No runtime scanning required.

@Controller implicitly registers the class as a singleton component — no need to add @Singleton.

The package also ships ServerConfig (configurable via @ConfigurationProperties('server')) and EmbeddedServer as library components, auto-discovered at build time.

Usage

import { Controller, Get, Post, Delete } from '@goodie-ts/hono';
import type { Context } from 'hono';

@Controller('/api/todos')
export class TodoController {
  constructor(private todoService: TodoService) {}

  @Get('/')
  async getAll(c: Context) {
    const todos = await this.todoService.findAll();
    return c.json(todos);
  }

  @Post('/')
  async create(c: Context) {
    const body = await c.req.json<{ title: string }>();
    const todo = await this.todoService.create(body.title);
    return c.json(todo, 201);
  }

  @Delete('/:id')
  async delete(c: Context) {
    await this.todoService.delete(c.req.param('id'));
    // Returning void/null produces a 204 No Content
  }
}

HonoServerBootstrap is a library component that extends OnStart — it automatically starts the HTTP server after context creation:

import { app } from './AppContext.generated.js';

// Starts the DI context, wires routes, and listens on configured port
await app.start();

For testing, use createRouter directly:

import { createContext, createRouter } from './AppContext.generated.js';

const ctx = await createContext({ 'datasource.url': testDbUrl });
const router = createRouter(ctx);
// Use router.request() for in-process HTTP testing

RPC Client (Type-Safe)

The plugin generates typed RPC clients using Hono's hc. Per-controller clients are generated for use with larger applications:

// Full app client
import { createClient } from './AppContext.generated.js';

const client = createClient('http://localhost:3000');
// client.api.todos.$get(), client.api.todos.$post(), etc.
// Per-controller client (better for larger apps)
import { createTodoControllerClient } from './AppContext.generated.js';

const todoClient = createTodoControllerClient('http://localhost:3000/api/todos');
// todoClient.$get(), todoClient.$post(), etc.

Per-controller types are also exported for custom use:

import type { TodoControllerRoutes } from './AppContext.generated.js';

Server Configuration

ServerConfig is auto-discovered as a library component. Configure it via a JSON config file:

// config/default.json
{ "server": { "host": "localhost", "port": 3000, "runtime": "node" } }

Multi-Runtime Support

EmbeddedServer supports multiple runtimes via server.runtime:

| Runtime | Serve API | Package | |---------|-----------|---------| | node (default) | @hono/node-server | @hono/node-server | | bun | Bun.serve() | Built-in | | deno | Deno.serve() | Built-in |

Server host/port are configured via config/default.json under server.host and server.port.

Route Handler Return Values

| Return type | Behavior | |------------|----------| | Response | Passed through directly | | undefined / null | Returns 204 No Content | | Any other value | Serialized as JSON via c.json(result) |

Peer Dependencies

  • hono >= 4.0.0
  • @hono/node-server >= 1.0.0 (optional — only needed for runtime: 'node')
  • zod >= 3.0.0 (optional — only needed for @Validate)

License

MIT