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

@lyrolab/nest-shared

v1.12.0

Published

A collection of shared modules for NestJS applications

Readme

Nest Shared

A collection of shared NestJS modules published to npm as @lyrolab/nest-shared. Provides reusable infrastructure components for NestJS applications across LyroLab projects.

Installation

npm install @lyrolab/nest-shared

Note: @lyrolab/nest-shared declares many peer dependencies. You'll need to install the ones you actually use. See each module's README for its specific peer dependency requirements.

Module Catalog

| Module | Import Path | Description | Key Exports | Requires Config | |--------|-------------|-------------|-------------|:--------------:| | AI | @lyrolab/nest-shared/ai | OpenRouter AI service with response caching | SharedAiModule, AiService, AI_MODULE_OPTIONS | ✅ | | Auth | @lyrolab/nest-shared/auth | JWT/Keycloak authentication | SharedAuthModule, JwtAuthGuard, @Public(), @CurrentUser(), keycloakConfig() | ✅ | | Bootstrap | @lyrolab/nest-shared/bootstrap | Application setup (CORS, ValidationPipe, Swagger, filters) | configureApp() | ✅ | | Bull | @lyrolab/nest-shared/bull | BullMQ queue integration backed by Redis | SharedBullModule | ✅ | | Cache | @lyrolab/nest-shared/cache | Redis-backed caching (preferred over raw Redis) | SharedCacheModule | ✅ | | Database | @lyrolab/nest-shared/database | TypeORM + PostgreSQL connection with TestContainers | SharedDatabaseModule, TypeOrmExceptionFilter | ✅ | | ESLint | @lyrolab/nest-shared/eslint | Shared ESLint config with custom architecture rules | nestArchitecturePlugin | ❌ | | Health | @lyrolab/nest-shared/health | Health check endpoint via Terminus | SharedHealthModule | ❌ | | Queue | @lyrolab/nest-shared/queue | Job processing with decorator-based processors | SharedQueueModule, QueueService, @JobProcessor() | ✅ | | Redis | @lyrolab/nest-shared/redis | Low-level Redis configuration | SharedRedisModule, RedisConfig | ✅ |

Quick Start

// app.module.ts
import { Module } from "@nestjs/common"
import { ConfigModule } from "@nestjs/config"
import { SharedAuthModule } from "@lyrolab/nest-shared/auth"
import { SharedBootstrapModule } from "@lyrolab/nest-shared/bootstrap"
import { SharedCacheModule } from "@lyrolab/nest-shared/cache"
import { SharedDatabaseModule } from "@lyrolab/nest-shared/database"
import { SharedHealthModule } from "@lyrolab/nest-shared/health"
import { keycloakConfig } from "@lyrolab/nest-shared/auth"

@Module({
  imports: [
    ConfigModule.forRoot({ isGlobal: true }),
    SharedDatabaseModule.forRoot({
      entities: [__dirname + "/**/*.entity{.ts,.js}"],
    }),
    SharedAuthModule.forRoot(
      keycloakConfig(
        process.env.KEYCLOAK_URL ?? "http://localhost:8080",
        process.env.KEYCLOAK_REALM ?? "lyrochat",
      ),
    ),
    SharedCacheModule.forRoot(),
    SharedHealthModule,
  ],
})
export class AppModule {}
// main.ts
import { NestFactory } from "@nestjs/core"
import { configureApp } from "@lyrolab/nest-shared/bootstrap"
import { AppModule } from "./app.module"

async function bootstrap() {
  const app = await NestFactory.create(AppModule)
  configureApp(app) // Sets up CORS, ValidationPipe, Swagger, global filters
  await app.listen(process.env.PORT ?? 3000)
}
bootstrap()

Using Modules in Services

import { Injectable } from "@nestjs/common"
import { Inject } from "@nestjs/common"
import { CACHE_MANAGER } from "@nestjs/cache-manager"
import { Cache } from "cache-manager"
import { AiService } from "@lyrolab/nest-shared/ai"
import { QueueService } from "@lyrolab/nest-shared/queue"
import { generateText } from "ai"

@Injectable()
export class MyService {
  constructor(
    private readonly aiService: AiService,
    private readonly queueService: QueueService,
    @Inject(CACHE_MANAGER) private cache: Cache,
  ) {}

  async process(input: string) {
    const cached = await this.cache.get(`input:${input}`)
    if (cached) return cached

    const result = await generateText({
      model: this.aiService.model,
      system: "You are a helpful assistant.",
      prompt: input,
    })

    await this.cache.set(`input:${input}`, result.text)
    return result.text
  }
}

Environment Variables

| Variable | Required | Used By | Description | |----------|:--------:|---------|-------------| | DATABASE_URL | ✅ | Database | PostgreSQL connection string | | REDIS_URL | ✅ | Redis, Cache, Bull, Queue | Redis connection string | | FRONTEND_URL | ✅ | Bootstrap | Frontend origin for CORS | | JWKS_URI | ✅ | Auth | JWKS endpoint for JWT verification | | JWT_ISSUER | ✅ | Auth | JWT issuer to validate against | | PORT | ❌ | Bootstrap | App listen port (default: 3000) | | CACHE_TTL | ❌ | Cache | Cache TTL in seconds | | OPENROUTER_API_KEY | ✅ | AI | OpenRouter API key | | NODE_ENV | ❌ | All | Set to test for TestContainers mode |

Development

Local Setup

# Clone and install
git clone https://github.com/lyrolab/nest-shared.git
cd nest-shared
npm install

# Build
npm run build

# Run tests
npm test
npm run test:cov   # With coverage

# Watch mode
npm run dev

Adding a New Module

  1. Create src/<module>/ with index.ts barrel export.
  2. Write a README.md in the module directory.
  3. Add the export entry in package.json:
"./<module>": {
  "types": "./dist/<module>/index.d.ts",
  "import": "./dist/<module>/index.js",
  "require": "./dist/<module>/index.js"
}
  1. Add a row to the Module Catalog table in this README.

Code Quality

npm run lint        # ESLint
npx lint-staged     # Pre-commit checks
npm test            # Jest

Publishing

This package uses semantic-release for automated publishing on the main branch.

  • feat: commits → minor version bump
  • fix: commits → patch version bump
  • feat!: or fix!: commits → major version bump

See CLAUDE.md for detailed contribution conventions.