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

@smounters/imperium

v1.4.2

Published

NestJS-like modular DI container with unified HTTP + Connect RPC server for TypeScript

Readme

@smounters/imperium

NestJS-inspired modular DI framework for TypeScript services. Unified HTTP + ConnectRPC + WebSocket server on a single Fastify instance.

Part of the Imperium monorepo. See also: @smounters/imperium-cron.

Features

  • Module system with @Module, @Injectable, guards, pipes, interceptors, filters
  • HTTP controllers with @HttpController, @Get, @Post, @Body, @Query, @Param
  • ConnectRPC with @RpcService, @RpcMethod (unary + server streaming)
  • WebSocket gateway with @WsGateway, @WsHandler, message routing, lifecycle hooks
  • Request-scoped DI via AsyncLocalStorage (tsyringe-based)
  • Typed config via Zod + ConfigService
  • Structured logging via tslog + LoggerService

Install

pnpm add @smounters/imperium reflect-metadata tsyringe fastify @connectrpc/connect @connectrpc/connect-fastify zod tslog

TypeScript config requires:

{
  "compilerOptions": {
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true
  }
}

Quick Start

import "reflect-metadata";
import { Application } from "@smounters/imperium/core";
import { Body, HttpController, Injectable, Module, Post } from "@smounters/imperium/decorators";

@Injectable()
class GreetService {
  greet(name: string) {
    return { message: `Hello, ${name}` };
  }
}

@HttpController("/api")
class ApiController {
  constructor(private readonly greetService: GreetService) {}

  @Post("/greet")
  greet(@Body("name") name: string) {
    return this.greetService.greet(name);
  }
}

@Module({
  providers: [GreetService],
  httpControllers: [ApiController],
})
class AppModule {}

await new Application(AppModule).start({ port: 3000 });

WebSocket

import { WsGateway, WsHandler, WsConnection, WsMessage } from "@smounters/imperium/decorators";
import type { WsGatewayLifecycle } from "@smounters/imperium/ws";
import type { WebSocket } from "@fastify/websocket";

@WsGateway("/ws")
class EventsGateway implements WsGatewayLifecycle {
  private clients = new Set<WebSocket>();

  onConnection(socket: WebSocket) { this.clients.add(socket); }
  onDisconnect(socket: WebSocket) { this.clients.delete(socket); }

  @WsHandler("ping")
  onPing(@WsConnection() ws: WebSocket) {
    ws.send(JSON.stringify({ type: "pong" }));
  }
}

Requires optional peer dependency: pnpm add @fastify/websocket

Import Paths

No root import. Use subpaths:

import { Application } from "@smounters/imperium/core";
import { Module, Injectable, HttpController, Get } from "@smounters/imperium/decorators";
import { ConfigService, LoggerService } from "@smounters/imperium/services";
import { ZodPipe } from "@smounters/imperium/pipes";
import { appConfigSchema } from "@smounters/imperium/validation";
import { registerWsGateways } from "@smounters/imperium/ws";

Documentation

Full guide and API reference: smounters.github.io/imperium

License

MIT