nestjs-pino
nestjs-pino is a logging module for NestJS that integrates Pino to provide structured JSON logging with automatic request context binding. Every log entry automatically includes request metadata (ID, method, URL, headers), making distributed tracing and debugging significantly easier.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | iamolegga/nestjs-pino |
| Owner | iamolegga |
| Primary language | TypeScript |
| License | MIT — OSI-approved |
| Stars | 1.5k |
| Forks | 109 |
| Open issues | 20 |
| Latest release | 4.6.1 (2026-03-13) |
| Last updated | 2026-07-07 |
| Source | https://github.com/iamolegga/nestjs-pino |
What nestjs-pino is
A TypeScript/NestJS integration layer over pino-http that binds request context via async local storage, exposing both standard NestJS Logger interface and direct PinoLogger access. Supports Express and Fastify platforms with configurable request ID generation and pino serializers.
Get the nestjs-pino source
Clone the repository and explore it locally.
git clone https://github.com/iamolegga/nestjs-pino.gitcd nestjs-pino# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Must import LoggerModule.forRoot() once in root module; async variant available for dynamic configuration.
- Requires explicit app.useLogger(app.get(Logger)) setup after NestFactory.create() to activate pino as NestJS app logger.
- Request ID generation is customizable; default is per-process counter but should be overridden (UUID, X-Request-ID header) for distributed systems.
- Argument handling differs between Logger (pino-style interpolation) and NativeLogger (NestJS-style separate entries); choose based on existing code.
- Platform detection is automatic (Express/Fastify); configuration via pinoHttp options and custom serializers available.
When to avoid it — and what to weigh
- Require human-readable plaintext logs in production — Pino outputs JSON by default; plaintext requires additional formatting layer (pino-pretty), which adds overhead and defeats performance gains.
- Using NestJS < 8 — Current version (v2+) requires NestJS 8+; older projects must use v1.4.0 or earlier, no longer maintained.
- Need vendor lock-in logging vendor (e.g., Datadog SDK) — nestjs-pino is Pino-only; integrating other logging vendors requires custom transports or additional middleware.
- Simple logging without structured fields — Request context binds automatically to every log; if that granularity is unwanted overhead, lighter loggers may be more suitable.
License & commercial use
MIT License: permissive, no commercial use restrictions, allows modification and distribution with attribution.
MIT is a standard OSI permissive license with no commercial restrictions. Commercial use is permitted under MIT terms, but consult legal if bundling or reselling the module itself.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Strong |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Strong |
| Assessment confidence | High |
Logs include full request headers and remote address by default; sanitize or filter sensitive data (auth tokens, PII) using pino serializers if logs are shipped to external systems. No security audit or vulnerability disclosure policy mentioned in provided data; monitor Snyk badges and GitHub security advisories.
Alternatives to consider
Winston
Mature, widely-used Node.js logger with rich plugin ecosystem; less performant than Pino for high-volume JSON logging but more flexible for custom formatting.
Bunyan
Older JSON-first logging library for Node.js; simpler than Pino but less optimized for modern performance requirements.
NestJS built-in ConsoleLogger
Zero-dependency, minimal setup; sufficient for development and small projects, but lacks structured JSON output and request context binding in production.
Build on nestjs-pino with DEV.co software developers
nestjs-pino provides production-ready logging with automatic request tracing. Devco can help integrate it into your NestJS application and set up log aggregation pipelines.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
nestjs-pino FAQ
Can I use nestjs-pino without changing my existing Logger() calls?
How do I generate unique request IDs across multiple instances?
Does nestjs-pino work with serverless (Lambda, Cloud Functions)?
How do I filter sensitive data from logs?
Work with a software development agency
From first prototype to production, DEV.co delivers software development services around tools like nestjs-pino. Our software development agency staffs experienced software developers and web developers for custom software development, web development, integrations, and ongoing support across open-source observability and beyond.
Implement Structured Logging in Your NestJS API
nestjs-pino provides production-ready logging with automatic request tracing. Devco can help integrate it into your NestJS application and set up log aggregation pipelines.