NestJS Profiler
Packages

nest-profiler-config

Inspect a @nestjs/config snapshot grouped by namespace in the Config panel.

@eleven-labs/nest-profiler-config

@eleven-labs/nest-profiler-config takes a snapshot of the application configuration at startup and displays it in a Config panel. Secret values are automatically masked.

Config panel — flattened configuration keys with secret values masked

Installation

pnpm add @eleven-labs/nest-profiler-config@alpha @nestjs/config

There is no stable release yet — install every @eleven-labs/nest-profiler* package with the @alpha dist-tag (@latest resolves to nothing).

Peer dependencies: @nestjs/config ^4.0.0

Setup

app.module.ts
import { ConfigModule, ConditionalModule } from '@nestjs/config';
import { ConfigCollectorModule } from '@eleven-labs/nest-profiler-config';

const isProfilerEnabled = (env: NodeJS.ProcessEnv) => env['PROFILER_ENABLED'] === 'true';

@Module({
  imports: [
    ConfigModule.forRoot({ isGlobal: true }),
    ConditionalModule.registerWhen(
      ConfigCollectorModule.forRoot({ maskKeys: ['DATABASE_URL', 'JWT_SECRET'] }),
      isProfilerEnabled,
    ),
  ],
})
export class AppModule {}

Enabling / disabling — gate the collector with ConditionalModule.registerWhen(..., isProfilerEnabled) as shown, so it loads only when PROFILER_ENABLED is on. Wire the core ProfilerModule once at the root — the recommended setup bundles the root-level profiler modules into a single ProfilingModule behind a ConditionalModule gate (see Enabling and disabling the profiler and the example app). A top-level enabled option is also supported as an alternative.

What it collects

The full configuration object (from ConfigService's internal store), grouped by namespace. Each top-level namespace registered with registerAs — whether loaded via ConfigModule.forRoot({ load: [...] }) or ConfigModule.forFeature(...) — becomes its own collapsible section, with its keys shown relative to the namespace. Top-level scalar values are gathered under a synthetic General group:

▸ General
    port      = 3000
    NODE_ENV  = development
▸ database
    host      = localhost
    port      = 5432
    password  = ***

Within a group, nested objects are flattened with . separators (e.g. pool.max). Grouping is purely structural: @nestjs/config merges forRoot and forFeature configuration into the same store, so their origin is not distinguished — a namespace is identified by its shape (a nested object at the top level), not by how it was loaded.

Automatic masking

Keys matching the pattern /password|secret|key|token|credential|api_key|apikey/i are automatically replaced with ***. Additional keys can be specified via maskKeys.

Toolbar badge

Number of configuration keys loaded (e.g., 12).

How it works

At OnApplicationBootstrap, the collector accesses ConfigService's internal configuration store via configService.internalConfig (an internal property, not part of the public API). The snapshot is captured once at startup and returned for every profile — it does not re-read config on each execution.

Powered & maintained by

On this page