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

@dltech/nestjs-core

v1.0.1

Published

Essential NestJS utilities: typed env config, structured request logging, a declarative module builder for TypeORM/Mongoose/BullMQ, a TypeORM dev seeder, an SSE async-generator decorator, and a shutdown guard.

Downloads

449

Readme

@dltech/nestjs-core

Shared NestJS utilities used across all Cubix backend services.

pnpm add @dltech/nestjs-core

Modules


Env

Type-safe environment configuration backed by @nestjs/config.

// env.service.ts
@Injectable()
export class EnvService extends BaseEnvService<IEnvConfig> {}

// app.module.ts
EnvModule.forRoot({ envService: EnvService, validationSchema: envConfigValidation })

BaseEnvService<T> wraps ConfigService so that envService.get('KEY') is fully typed against your IEnvConfig interface with no casting required.


Logger

Drop-in structured logger module.

// app.module.ts
import { LoggerModule } from '@dltech/nestjs-core';

@Module({ imports: [LoggerModule] })
export class AppModule {}

Decorators

@CreateModule

Convenience decorator that applies common module-level defaults.

@CreateModule({ imports: [...] })
export class AppModule {}

@SseGenerator

Helper decorator for Server-Sent Events endpoints.


TypeORM — Seeder

A file-based, idempotent seeding system for local development. Mirrors the TypeORM migrations pattern: numbered files, sorted alphabetically, each run in order.

Setup (per project)

1. Add the db:seed script to package.json:

"db:seed": "cross-env NODE_ENV=development pnpm env:inject -- pnpm db:ts-node cli/seed-runner.ts",
"db:recreate": "pnpm db:schema:drop && pnpm db:migrate && pnpm db:seed"

2. Create cli/seed-runner.ts — the entry point:

import { resolve } from 'path';
import { runSeeds } from '@dltech/nestjs-core';
import { AppDataSource } from './data-source';

async function main(): Promise<void> {
  if (process.env.NODE_ENV !== 'development') {
    console.log('seed: NODE_ENV is not "development" — exiting safely');
    process.exit(0);
  }

  await AppDataSource.initialize();
  try {
    await runSeeds(AppDataSource, resolve(__dirname, '../seeds'));
    console.log('seed: all seeds complete');
  } finally {
    await AppDataSource.destroy();
  }
}

void main();

3. Create numbered seed files in seeds/:

// seeds/001-dev-user.ts
import type { Seeder } from '@dltech/nestjs-core';

export default (async (ds) => {
  const repo = ds.getRepository(User);
  if (await repo.findOne({ where: { email: '[email protected]' } })) return;
  await repo.save(repo.create({ email: '[email protected]', ... }));
}) satisfies Seeder;

How it works

| Concern | Detail | |---|---| | Ordering | Files sorted alphabetically — use 001-, 002-, … prefixes | | Idempotency | Each seed must guard against duplicate data (findOne → skip) | | Safety | seed-runner.ts exits with code 0 if NODE_ENV !== 'development' | | DataSource | Caller initializes and destroys — runSeeds only runs the files |

API

// Type for a seed file's default export
type Seeder = (ds: DataSource) => Promise<void>;

// Discovers and runs all .ts / .js files in seedsDir, sorted alphabetically
function runSeeds(ds: DataSource, seedsDir: string): Promise<void>;