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

@sculptor/router

v0.1.1

Published

The SculptorTS router package provides decorators and router assembly for controller-based and hybrid app styles.

Readme

@sculptor/router

The SculptorTS router package provides decorators and router assembly for controller-based and hybrid app styles.

What This Package Does

  • Defines controller and method decorators
  • Attaches middleware metadata to classes and methods
  • Scans decorated controllers
  • Builds an Express router from controller classes and router instances

Public API

import {
  Controller,
  Get,
  Post,
  Put,
  Delete,
  Use,
  createRouter
} from "@sculptor/router";

Decorators

Controller(prefix)

Marks a class as a controller and stores its route prefix.

If you omit the prefix, it defaults to /.

Get(path), Post(path), Put(path), Delete(path)

Attach HTTP method metadata to a controller method.

If you omit the path, it defaults to /.

Use(...middlewares)

Attaches Express middleware.

If you use Use() on a class, the middleware applies to all routes in that controller.

If you use Use() on a method, the middleware applies only to that route.

Router Assembly

createRouter() accepts:

  • controllers
  • routes
  • prefix

It returns an Express router.

Controller Path Behavior

When you pass controller classes, the router:

  1. Instantiates each controller
  2. Scans its metadata
  3. Registers all decorated routes

Route Path Behavior

When you pass Express routers in routes, they are mounted directly onto the resulting router.

Prefix Behavior

If you pass a prefix:

  • it is normalized to a leading slash
  • trailing slashes are removed
  • the router is mounted under that prefix

If you do not pass a prefix, the router is returned unwrapped.

Behavior Matrix

| If you do this | Then this happens | | --- | --- | | Add @Controller("/health") | The controller routes are grouped under /health | | Add @Get("/") to a method | The method is registered for GET / relative to the controller prefix | | Add @Use(logger) to a controller class | Every controller route uses logger | | Add @Use(auth) to a single method | Only that route uses auth | | Pass prefix: "/api" to createRouter | The mounted router appears under /api | | Pass prefix: "api" | The prefix is normalized to /api | | Pass prefix: "/api/" | The trailing slash is removed | | Pass no controllers and no routes | An empty router is returned | | Pass both controllers and routes | Both styles are mounted into one router |

Example

import { Controller, Get, createRouter } from "@sculptor/router";

@Controller("/health")
class HealthController {
  @Get("/")
  health() {
    return { status: "ok" };
  }
}

const router = createRouter({
  controllers: [HealthController],
  routes: [],
  prefix: "/api"
});

Types

The package exports the core router types used by the framework:

  • ControllerClass
  • ControllerMetadata
  • CreateRouterOptions
  • HttpMethod
  • MethodRouteMetadata
  • ParameterResolverContext
  • RouteDefinition

Package Scripts

  • npm run build compiles the package
  • npm run prepack builds before publish

License

MIT