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

@emeritus-engineering/growth-platform-core

v0.1.2

Published

Modular Growth Platform utilities: rate limiting, Keycloak auth, and white-label theme data.

Downloads

507

Readme

@emeritus-engineering/growth-platform-core

NestJS package for Growth Platform Core auth, rate limiting, and white-label theme data.

Install

yarn add @emeritus-engineering/growth-platform-core

Peer dependencies:

@nestjs/common
@nestjs/core
@nestjs/config
@nestjs/throttler
@nestjs/axios
axios
rxjs
reflect-metadata

Imports

import {
  KeycloakAuthModule,
  KeycloakAuthGuard,
  RolesGuard,
  Roles,
  Public,
  Role
} from '@emeritus-engineering/growth-platform-core/auth'

import {
  RateLimiterModule,
  RateLimitGuard,
  ApiThrottleMiddleware,
  API_THROTTLE_REDIS_CLIENT
} from '@emeritus-engineering/growth-platform-core/rate-limiter'

import {
  WHITE,
  WhiteLabelColorValue,
  getWhiteLabelTheme
} from '@emeritus-engineering/growth-platform-core/white-label'

The package root re-exports the same symbols for convenience; subpath imports are preferred for tree-shaking.

Keycloak Auth

Introspection mode (default)

KeycloakAuthModule.forRoot({
  validationMode: 'introspection',
  keycloakBaseUrl: process.env.KEYCLOAK_BASE_URL,
  keycloakRealm: process.env.KEYCLOAK_REALM,
  clients: [{ clientId: 'growth-api', clientSecret: process.env.KEYCLOAK_GROWTH_SECRET! }],
  authBypassHeaders: [
    { headerName: 'x-internal-api-key', expectedValueConfigKey: 'INTERNAL_API_SECRET' }
  ]
})

JWKS mode

KeycloakAuthModule.forRoot({
  validationMode: 'jwks',
  keycloakBaseUrl: process.env.KEYCLOAK_BASE_URL,
  keycloakRealm: process.env.KEYCLOAK_REALM,
  audience: 'growth-api'
  // jwksUrl / issuer optional; built from baseUrl + realm when omitted
})

Set verifyIssuer: false (or KEYCLOAK_VERIFY_ISSUER=false) to disable the iss claim check while keeping signature, expiry, and audience checks. Default is true.

@nestjs/jose is loaded dynamically; no extra peer dependency required (the package depends on jose directly).

Async config from ConfigService

KeycloakAuthModule.forRootAsync({
  imports: [ConfigModule],
  inject: [ConfigService],
  useFactory: (config: ConfigService) => ({
    validationMode: config.get('KEYCLOAK_VALIDATION_MODE', 'introspection'),
    keycloakBaseUrl: config.getOrThrow('KEYCLOAK_BASE_URL'),
    keycloakRealm: config.getOrThrow('KEYCLOAK_REALM'),
    isAuthDisabled: config.get<boolean>('IS_KEYCLOAK_AUTH_DISABLED', false)
  })
})

configKeys lets you map non-default env names; see KeycloakAuthConfigKeys in the public types.

Rate Limiting

Nest ThrottlerModule wrapper

RateLimiterModule.forRoot({
  throttlers: [{ name: 'default', ttl: 60_000, limit: 100 }]
})

Provides RateLimitGuard (alias for ThrottlerGuard) and RateLimiterService (imperative storage access).

Growth-style API throttle middleware

RateLimiterModule.forApiThrottle({
  configKey: 'API_THROTTLE_CONFIG',
  redisClientProvider: {
    provide: API_THROTTLE_REDIS_CLIENT,
    useExisting: RedisService
  }
})

Apply ApiThrottleMiddleware with Nest's MiddlewareConsumer:

configure(consumer: MiddlewareConsumer) {
  consumer.apply(ApiThrottleMiddleware).forRoutes('*')
}

Set API_THROTTLE_CONFIG (JSON in env or object via config) with this shape:

{
  "enableRateLimit": true,
  "global": { "limit": 100, "cooldown": 60 },
  "excludeIps": ["127.0.0.1"],
  "excludedPaths": ["/health"],
  "apiLimits": {
    "/growth/api/v1/programs/:id": { "limit": 10, "cooldown": 60 }
  },
  "dynamicRules": [
    { "headerKey": "x-client-type", "value": "partner", "limit": 20, "cooldown": 60 }
  ]
}

cooldown is in seconds. Limit breaches throw ApiRateLimitExceededError (HTTP 429 with diagnostic metadata).

The Redis client provided to API_THROTTLE_REDIS_CLIENT must implement hget, hset, hdel, hgetall, and multi.

White-label

const emeritusTheme = getWhiteLabelTheme('emeritus')
const white = WHITE
const allThemes = WhiteLabelColorValue

Build

npm install
npm run build

Outputs ESM + CJS bundles under dist/. Decorator metadata (required for Nest DI) is emitted via tsup's swc plugin (@swc/core is a dev dependency).