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

@signa-app/nest-modules

v0.2.5

Published

Reusable NestJS modules for Signa services.

Readme

signa-modules

Reusable NestJS modules for Signa services.

Package Shape

This repository is a single npm package with independent module entry points. The root entry point exports the public API for all stable modules, while subpath exports allow consumers to import only the area they need.

import { CloudStorageModule } from "@signa-app/nest-modules";
import { CloudStorageService } from "@signa-app/nest-modules/cloud-storage";
import { KafkaModule } from "@signa-app/nest-modules/kafka";

Source Layout

src/
  index.ts
  modules/
    <module-name>/
      index.ts
      <module-name>.module.ts
      <module-name>.service.ts
      <module-name>.options.ts
      <module-name>.tokens.ts
      providers/
      types/

Use src/modules/<module-name>/index.ts as the only public export file for a module. Keep internal providers, helpers, and implementation details unexported.

Module Contract

Reusable modules should be application-agnostic:

  • expose forRoot() and forRootAsync() when configuration is required;
  • accept dependencies through options, injection tokens, or imported modules;
  • avoid reading process.env directly inside providers;
  • avoid importing application modules;
  • keep controllers optional and export services intentionally;
  • declare Nest packages and shared runtime packages as peerDependencies;
  • keep DTOs, option interfaces, tokens, and public services stable and exported;
  • keep persistence, transport, and third-party clients replaceable where possible.

Adding A Module

Create a folder under src/modules:

src/modules/cloud-storage/
  index.ts
  cloud-storage.module.ts
  cloud-storage.service.ts
  cloud-storage.options.ts
  cloud-storage.tokens.ts

Then export it from src/index.ts only after the public API is ready:

export * from "./modules/cloud-storage";

If a module needs a direct subpath import, add it to package.json exports:

"./cloud-storage": {
  "types": "./dist/modules/cloud-storage/index.d.ts",
  "default": "./dist/modules/cloud-storage/index.js"
}

Configuration

Environment variables belong to the consuming application. Modules in this package accept ready-to-use options through forRoot() or forRootAsync().

CloudStorageModule.forRoot({
  bucketName: "signa-files",
  accountId: "cloudflare-account-id",
  accessKeyId: "access-key",
  secretAccessKey: "secret-key",
  uploadContentType: "application/zip",
  uploadUrlExpiresInSeconds: 3600,
});

Kafka modules use the same contract:

KafkaModule.forRoot({
  clientId: "payments-api",
  brokers: ["localhost:9092"],
  asConsumer: true,
  asProducer: true,
  defaultTopic: "signa-payment-status.local",
  consumerConfig: {
    groupId: "payments-api-group",
  },
});

With @nestjs/config in a client application:

CloudStorageModule.forRootAsync({
  imports: [ConfigModule],
  inject: [ConfigService],
  useFactory: (config: ConfigService) => ({
    bucketName: config.getOrThrow("CLOUD_STORAGE_BUCKET_NAME"),
    accountId: config.getOrThrow("CLOUD_STORAGE_ACCOUNT_ID"),
    accessKeyId: config.getOrThrow("CLOUD_STORAGE_ACCESS_KEY_ID"),
    secretAccessKey: config.getOrThrow("CLOUD_STORAGE_SECRET_ACCESS_KEY"),
    uploadContentType: "application/zip",
  }),
});

With Kafka:

KafkaModule.forRootAsync({
  imports: [ConfigModule],
  asConsumer: true,
  asProducer: true,
  inject: [ConfigService],
  useFactory: (config: ConfigService) => ({
    clientId: config.getOrThrow("KAFKA_CLIENT_ID"),
    brokers: config.getOrThrow<string>("KAFKA_BROKERS").split(","),
    defaultTopic: config.get("KAFKA_TOPIC"),
    ssl: config.get("KAFKA_SSL") === "true",
    sasl: {
      mechanism: "plain",
      username: config.getOrThrow("KAFKA_USERNAME"),
      password: config.getOrThrow("KAFKA_PASSWORD"),
    },
    consumerConfig: {
      groupId: config.getOrThrow("KAFKA_CONSUMER_GROUP_ID"),
    },
  }),
});

Without a Nest application context:

const logService = new LogService();
const cloudStorageService = new CloudStorageService(
  {
    bucketName: "signa-files",
    accountId: "cloudflare-account-id",
    accessKeyId: "access-key",
    secretAccessKey: "secret-key",
  },
  logService,
);

Build

npm install
npm run build
npm run pack:check

Publishing

npm version patch
npm publish --access public --registry=https://registry.npmjs.org/