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

v0.8.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 @hono/node-server

Overview

Provides @Controller and HTTP method decorators (@Get, @Post, etc.) that mark classes and methods for route registration. At build time, the hono transformer plugin scans controller metadata on beans 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 bean — no need to add @Singleton.

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

Decorators

| Decorator | Target | Description | |-----------|--------|-------------| | @Controller(basePath?) | class | Marks a class as an HTTP controller (defaults to '/') | | @Get(path?) | method | Registers a GET route (defaults to '/') | | @Post(path?) | method | Registers a POST route | | @Put(path?) | method | Registers a PUT route | | @Delete(path?) | method | Registers a DELETE route | | @Patch(path?) | method | Registers a PATCH route |

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
  }
}

The hono plugin generates createRouter and startServer in AppContext.generated.ts:

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

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

Or for more control:

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

const ctx = await app.start();
const router = createRouter(ctx);
// Use router.fetch for testing or pass to a custom server

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 bean. Configure it via a JSON config file:

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

Or override at startup:

await startServer({ port: 8080 });

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 EmbeddedServer)
  • @hono/zod-validator >= 0.4.0 (optional — only needed for @Validate)
  • zod >= 3.0.0 (optional — only needed for @Validate)

License

MIT