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

@boostkit/router

v0.0.3

Published

Decorator-based and fluent HTTP router for BoostKit. Supports route-level middleware, controller registration, and mounting onto any server adapter.

Readme

@boostkit/router

Decorator-based and fluent HTTP router for BoostKit. Supports route-level middleware, controller registration, and mounting onto any server adapter.

Installation

pnpm add @boostkit/router

Usage

Fluent routing

import { router } from '@boostkit/router'

router.get('/api/health', (_req, res) => res.json({ status: 'ok' }))
router.post('/api/users', async (req, res) => { /* ... */ })
router.delete('/api/users/:id', async (req, res) => { /* ... */ })

// Catch-all (matches any HTTP method)
router.all('/api/*', (_req, res) => res.status(404).json({ message: 'Not found' }))

router is the global singleton. Route is an alias for it.

Decorator-based routing

import { Controller, Get, Post, Delete, Middleware, router } from '@boostkit/router'
import type { AppRequest, AppResponse } from '@boostkit/contracts'

@Controller('/api/users')
@Middleware([authMiddleware])       // applies to all routes in this controller
class UserController {
  @Get('/')
  index(_req: AppRequest, res: AppResponse) {
    return res.json({ data: [] })
  }

  @Post('/')
  async create(req: AppRequest, res: AppResponse) {
    return res.status(201).json({ data: req.body })
  }

  @Delete('/:id')
  @Middleware([adminMiddleware])    // additional middleware for this route only
  async destroy(req: AppRequest, res: AppResponse) {
    return res.status(204).send('')
  }
}

router.registerController(UserController)

Route-level middleware (fluent)

router.get('/protected', handler, [authMiddleware])
router.post('/admin', handler, [authMiddleware, adminMiddleware])

Mounting onto a server adapter

// bootstrap/app.ts — called automatically by Application.configure()
router.mount(serverAdapter)

API Reference

Router

| Method | Description | |--------|-------------| | get(path, handler, mw?) | Register GET route | | post(path, handler, mw?) | Register POST route | | put(path, handler, mw?) | Register PUT route | | patch(path, handler, mw?) | Register PATCH route | | delete(path, handler, mw?) | Register DELETE route | | all(path, handler, mw?) | Register route matching any method | | add(method, path, handler, mw?) | Register route with explicit method string | | use(middleware) | Register global middleware (runs on every route) | | registerController(Class) | Register all routes from a decorator-based controller | | mount(serverAdapter) | Apply global middleware + routes to a server adapter | | list() | Return a copy of all registered RouteDefinition[] | | reset() | Clear all routes and global middleware |

All mutating methods return this for chaining.

Decorators

| Decorator | Target | Description | |-----------|--------|-------------| | @Controller(prefix?) | class | Marks a class as a controller with a route prefix | | @Middleware([...handlers]) | class or method | Applies middleware handlers | | @Get(path) | method | GET route | | @Post(path) | method | POST route | | @Put(path) | method | PUT route | | @Patch(path) | method | PATCH route | | @Delete(path) | method | DELETE route | | @Options(path) | method | OPTIONS route |

Middleware ordering

  • Class-level @Middleware runs before method-level @Middleware
  • Route registration order is preserved

Notes

  • router and Route are the same global singleton
  • Decorator controllers require reflect-metadata at the app entry point
  • Double slashes in composed paths (/api + /users) are normalised to /api/users