Observability Recipes: Compodoc, Devtools, Sentry & AsyncLocalStorage
Observability Recipes: Compodoc, Devtools, Sentry & AsyncLocalStorage
A production NestJS team needs visibility into architecture and runtime behavior. Compodoc documents modules and classes, NestJS Devtools visualizes the graph, Sentry captures failures, and AsyncLocalStorage carries request context through async calls.
Core idea
This feature is about controlling how the application is organized and how it behaves at runtime. These are the points a developer should understand before using it in a real project:
- Compodoc creates human-readable technical documentation from TypeScript decorators and comments.
- NestJS Devtools helps inspect modules, providers, routes, and graph relationships.
- Sentry integration should capture exceptions with request IDs, user IDs where safe, and release versions.
- AsyncLocalStorage stores per-request context such as correlation IDs without threading parameters through every method.
- Context propagation should be initialized at the edge of the request and read by logging, tracing, and audit services.
Practical example
The following example shows the idea in a practical NestJS project. The goal is not to memorize the snippet, but to understand where it belongs in the architecture:
Production checklist
- Generate architecture docs for large teams with Compodoc.
- Use Devtools or graph inspection when module dependencies become confusing.
- Attach release and request context to Sentry events.
- Propagate correlation IDs through logs, outgoing HTTP calls, and broker messages.
Summary
This lesson covers an advanced NestJS area that matters when building enterprise applications. Focus on clear boundaries, testable behavior, and choosing the right tool for the context instead of using every feature everywhere.