Overview
The core profiler module and its /_profiler web UI.
@eleven-labs/nest-profiler
@eleven-labs/nest-profiler provides execution profiling for NestJS applications. Each profiled execution receives a unique token, and the collected data (request, response, performance, logs, exceptions, custom collectors) can be inspected at /_profiler/{token}.

Installation
pnpm add @eleven-labs/nest-profiler@alpha nestjs-clsThere is no stable release yet — install every
@eleven-labs/nest-profiler*package with the@alphadist-tag (@latestresolves to nothing).
nestjs-cls is a required peer dependency used for per-execution context propagation.
Want the profiler in
devDependenciesonly, with zero production footprint? Install it withpnpm add -D @eleven-labs/nest-profiler@alpha nestjs-clsand use the dev-entry split instead of the runtime gate below.
Quick start
The recommended way to wire the profiler is to gate it with Nest's ConditionalModule.registerWhen, so it loads only when you want it:
import { Module } from '@nestjs/common';
import { ProfilerModule } from '@eleven-labs/nest-profiler';
import { ConditionalModule } from '@nestjs/config';
const isProfilerEnabled = (env: NodeJS.ProcessEnv) => env['PROFILER_ENABLED'] === 'true';
@Module({
imports: [
ConditionalModule.registerWhen(
ProfilerModule.forRoot({ isGlobal: true, maxProfiles: 100 }),
isProfilerEnabled,
),
],
})
export class AppModule {}Start the application, make a few requests, and open http://localhost:3000/_profiler. Every non-profiler response also carries an X-Debug-Token-Link header pointing straight to its profile.
If a service injects
ProfilerServicedirectly (customstartSpan, events, exceptions…), also registerProfilerNoopModule.forRoot({ isGlobal: true })gated on(env) => !isProfilerEnabled(env)so that injection still resolves when off. Log capture never needs it —createProfilerLoggeris DI-free. A top-levelenabledoption is also supported as an alternative, documented once in Configuration → Enabling and disabling the profiler.
Documentation
Each capability has its own focused guide:
| Guide | What it covers |
|---|---|
| Configuration | forRoot / forRootAsync, the full options reference, securing the UI with a Bearer token |
| Log capture | Wrapping any logger so every entry lands in the profile, supported argument conventions |
| Browsing profiles | UI endpoints, debug headers, list filters (built-in and custom), exporting a profile |
| Timeline & custom collectors | startSpan() timing, writing a collector with @ProfilerCollector(), custom EJS panels |
| Extending the UI with JavaScript | CSP-friendly compiled bundles, the window.NestProfiler runtime, registering your own client script |
| Custom protocol adapters | Profiling gRPC, Kafka, WebSockets… via IContextAdapter |
| Storage backends | In-memory (default), file system, custom IProfilerStorageAdapter |
| Performance impact & testing | Deferred persistence, why it is free, flush() in automated tests |
The Getting started guide covers the full setup including the optional collector packages (TypeORM, MikroORM, Mongoose, Axios, cache, auth, config, validator, GraphQL, commander), and the Profiler UI page gives a visual tour of every panel.
Public API
import {
ProfilerModule,
ProfilerNoopModule,
ProfilerService,
NoopProfilerService,
ProfilerStorageService,
ProfilerViewsSetup,
CollectorRegistry,
ProfilerCollector,
TimelineCollector,
ClientAssetRegistry,
PROFILER_STORAGE_ADAPTER,
MemoryStorageAdapter,
FileStorageAdapter,
createProfilerLogger,
parseLogArgs,
DEFAULT_LOG_METHODS,
} from '@eleven-labs/nest-profiler';
import type {
ProfilerModuleOptions,
ProfilerModuleAsyncOptions,
IProfilerCollector,
IProfilerStorageAdapter,
StorageFindOptions,
CollectorPanelInfo,
Profile,
LogEntry,
ExceptionEntry,
TimelineSpan,
SecurityContext,
LogMethodMap,
LogArgsParser,
ParsedLogCall,
ProfilerLoggerOptions,
} from '@eleven-labs/nest-profiler';The full generated reference lives at API reference — nest-profiler.
Agent skills
Install and configure @eleven-labs/nest-profiler with your coding agent — npx skills teaches Claude Code, Cursor, Codex and others to wire the profiler and the collectors that match your stack.
Configuration
Register ProfilerModule with forRoot or forRootAsync, tune every option, and protect the profiler UI with a pluggable security strategy.