Tutorials
Step-by-step guides for using the profiler packages in a NestJS application.
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.
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.
TypeORM query profiling
Capture every SQL query executed by TypeORM and inspect them in the Database panel.
MikroORM query profiling
Capture every SQL query executed by 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.
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 |
| TypeORM query profiling | DataSource patching + QueryRunner wrap | @eleven-labs/nest-profiler-typeorm |
| MikroORM query profiling | Logger.logQuery wrap + CLS context | @eleven-labs/nest-profiler-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_PIPE + class-validator / nestjs-zod | @eleven-labs/nest-profiler-validator |
| GraphQL profiling | IContextAdapter + GraphQL execution ctx | @eleven-labs/nest-profiler-graphql |
| 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 application demonstrating all collectors working
together with a real PostgreSQL database, Redis cache, and JWT authentication. See the Example
application page.