Tutorials
Step-by-step NestJS profiler tutorials - enable collectors for SQL, HTTP, GraphQL, cache and auth, and build your own custom collector and entrypoint types.
These tutorials show how to integrate each profiler collector in a real NestJS application. Each tutorial starts from a concrete use case and includes the full application-side code.
Tutorials are task-oriented walkthroughs. For the exhaustive option reference, peer dependencies and captured fields of each collector, see its package page instead of repeating them here.
Set up the profiler
Install @eleven-labs/nest-profiler and inspect HTTP requests in the built-in profiler UI.
Log capture with context
Wrap your logger so request-scoped logs with structured payloads appear in the Logs tab.
SQL query profiling
Capture every SQL query executed by TypeORM or MikroORM and inspect them in the Database panel.
MongoDB query profiling
Capture every Mongoose query and aggregation and inspect them in the MongoDB panel.
Cache profiling
Track cache HIT/MISS/SET/DEL operations and analyse the hit ratio in the Cache panel.
Command profiling
Profile nest-commander CLI commands and inspect their runs in the Command panel at /_profiler.
Auth/Security profiling
Display authenticated user info and JWT claims in the Security panel.
HTTP client profiling
Capture outgoing HTTP requests - with the axios adapter or any client of your own - and inspect them in the HTTP Client panel.
Configuration profiling
Inspect resolved configuration values with sensitive key masking in the Config panel.
DTO validation profiling
Inspect DTO validations - both successful and failed - in the Validator panel.
GraphQL profiling
Profile GraphQL queries and mutations with Apollo, Mercurius, or graphql-yoga, and inspect them in the profiler UI.
RabbitMQ profiling
Profile the messages your app consumes with @RabbitSubscribe and the ones it publishes, in the RabbitMQ panel.
Domain event profiling
Profile @nestjs/event-emitter emissions and every @OnEvent handler execution in the Events panel.
Build a custom collector
Create your own profiler panel with a custom EJS template and toolbar badge.
Build a custom entrypoint type
Give a non-HTTP entrypoint its own data shape, list table and detail tab - profiling WebSocket messages end to end.
File-based profile storage
Persist profiles to disk so they survive restarts and can be inspected across debug sessions.
Covered patterns
| Tutorial | NestJS pattern | Package |
|---|---|---|
| Set up the profiler | Middleware + interceptor + global guard | @eleven-labs/nest-profiler |
| Log capture with context | app.useLogger proxy + argument parsing | @eleven-labs/nest-profiler |
| SQL query profiling | DataSource patching / Logger.logQuery wrap | @eleven-labs/nest-profiler-typeorm, -mikro-orm |
| MongoDB query profiling | Query/Aggregate.exec patch + CLS context | @eleven-labs/nest-profiler-mongoose |
| Cache profiling | CACHE_MANAGER proxy + CLS context | @eleven-labs/nest-profiler-cache |
| Command profiling | CommandRunner wrap + CommandFactory | @eleven-labs/nest-profiler-commander |
| Auth/Security profiling | request.user + JWT decode | @eleven-labs/nest-profiler-auth |
| HTTP client profiling | HttpProfilerRecorder + bundled axios adapter | @eleven-labs/nest-profiler-http |
| Configuration profiling | ConfigService internalConfig + registerAs | @eleven-labs/nest-profiler-config |
| DTO validation profiling | app-owned pipe + class-validator / nestjs-zod | @eleven-labs/nest-profiler-validator |
| GraphQL profiling | IContextAdapter + GraphQL execution ctx | @eleven-labs/nest-profiler-graphql |
| RabbitMQ profiling | @RabbitSubscribe wrap + publish patch | @eleven-labs/nest-profiler-rabbitmq |
| Domain event profiling | EventEmitter patch + @OnEvent wrap | @eleven-labs/nest-profiler-event-emitter |
| Build a custom collector | @ProfilerCollector + EJS template | @eleven-labs/nest-profiler |
| Build a custom entrypoint type | IContextAdapter + registerEntrypointType | @eleven-labs/nest-profiler |
| File-based profile storage | storageType: 'file' + LRU/TTL eviction | @eleven-labs/nest-profiler |
Example application
The examples/api directory contains a complete marketplace application demonstrating all
collectors working together: a SQL catalog over TypeORM or MikroORM (REST + GraphQL),
MongoDB-backed reviews publishing RabbitMQ events, review authors resolved over HTTP from an
external user directory, an external content API with caching, JWT auth and CLI commands. A single
GraphQL query walks the three sources at once, with or without DataLoader batching. See the
Example application page.