Configuration

Outputs

Choose where Nest Graph Inspector publishes your dependency graph.

Outputs

outputs tells Nest Graph Inspector where to publish the generated dependency graph. Use one output for a focused workflow, or combine several outputs when your team needs an interactive viewer, committed documentation, and machine-readable data at the same time.

Stability note: outputs beyond Web Viewer are under active iteration, and format-level breaking changes may land between releases while we shape the long-term contract. For dependable day-to-day usage, you can always upgrade to the latest Nest Graph Inspector version to stay aligned with the Viewer experience.
The Web Viewer and HTTP outputs serve over the network, so by default their endpoints are gated behind a short-lived access token. The viewer link printed to your console already carries one, and the gate can be turned off with accessToken.enabled.
Both Web Viewer and HTTP outputs install the same graph layout endpoints, and share one module-wide setting for how that layout is persisted — ui.layout.saveAs — rather than a per-output option.

Web Viewer

Usage

{ type: 'viewer' }

Description

The Viewer output is the fastest way to understand a NestJS application visually. It installs a graph endpoint inside your app and connects it to the hosted interactive viewer, so you can explore modules, providers, controllers, imports, exports, and dependencies without opening generated files by hand.

API

APIDescriptionBenefit
type: 'viewer'Enables the interactive web viewer output.Gives developers a visual graph they can open from the console message after the app starts.
origin?: stringThe public or local origin of your running NestJS app, for example http://localhost:3000.Prints a direct viewer link that already knows where to load graph data from. This is ideal for shared local setup, demos, and environment-based configuration.
path?: stringThe route path used to serve the graph endpoint. Defaults to /__graph-inspector.Lets you avoid route conflicts and match your app's internal route naming.
directRun?: { enabled?: boolean; allowUnsafeMethods?: boolean; maxBodySizeBytes?: number }Controls Direct Run for this viewer. enabled defaults to true.Set enabled: false to keep serving the graph without registering Direct Run or trace-history routes. The viewer graph also omits Direct Run metadata, so the UI does not advertise runnable methods. allowUnsafeMethods and maxBodySizeBytes tune what an enabled Direct Run accepts — see below.

Direct Run

Direct Run reaches both providers and controllers. A request names a target ("provider" or "controller") alongside the method to call, so a provider and a controller of the same name can never be confused for one another. Which methods it can invoke depends on directRun.allowUnsafeMethods — the same setting governs both target types:

  • Permissive (default, true). Any callable method found on a provider's instance or prototype chain may be invoked, including ones TypeScript marks private or protected — that keyword is erased at compile time and is not a runtime boundary. Only constructor is refused outright. This favors local development ergonomics: the default assumes Direct Run is reached by a trusted developer, not exposed to the open internet. Controller permissive mode is narrower: only a method the controller itself has — one declared on its own class, or a function-valued property of the instance — may be invoked. The constructor, Nest lifecycle hooks, getters, and inherited methods (from a base class, or built-ins such as toString) are refused, even with this setting on.
  • Strict (false). Only the exact public prototype method advertised for that provider or controller in its Direct Run metadata may be invoked, and only when it is not shadowed on the instance. Constructors, Nest lifecycle hooks, inherited methods, instance-shadowed methods, and TypeScript-private or -protected methods are refused.

The request body is limited to directRun.maxBodySizeBytes of encoded bytes, which defaults to 50 MiB; set it to 0 or a negative number to remove the limit. Oversized requests receive a generic 413 response; UTF-8 decoding works transparently across request chunks. Completed runtime-trace history retains at most 100 traces in memory and evicts the oldest first.

Direct Run is not a Nest HTTP request pipeline. For a controller method, it is a direct JavaScript instance method call: no guards, interceptors, or pipes run, and @Body()/@Param()/@Query() are never consulted — arguments bind positionally to the method's plain parameter list. The HTTP verb and path shown alongside a routed controller method (read from Nest's own route metadata) are informational only; Direct Run never sends that method an HTTP request. The path is the @Controller() prefix joined to the method's own path — it does not include a RouterModule path, your global prefix, URI versioning, or any prefix but the first — so it can differ from the URL your application serves.

Markdown

Usage

{ type: 'markdown', path: 'graph.md' }

Description

The Markdown output turns your dependency graph into durable project documentation. It writes a .md file with a Mermaid diagram and module-by-module details, making it a strong fit for repository docs, pull request reviews, architecture notes, and onboarding material.

API

APIDescriptionBenefit
type: 'markdown'Enables Markdown file generation.Produces readable documentation that can live beside your source code.
path: stringFile path for the generated Markdown file, resolved from the current working directory.Keeps the graph easy to find, commit, review, or publish with your existing docs workflow.
Mermaid diagrams render natively on GitHub. For local viewing, use a Mermaid-compatible Markdown viewer or install a VSCode extension.

JSON

Usage

{ type: 'json', path: 'graph.json' }

Description

The JSON output gives you the raw module map in a structured format. Use it when you want to build custom checks, compare graph snapshots, feed another visualization tool, or automate architecture reporting in CI.

API

APIDescriptionBenefit
type: 'json'Enables JSON file generation.Creates a stable data artifact for tools, scripts, and automated analysis.
path: stringFile path for the generated JSON file, resolved from the current working directory.Makes the output predictable and easy to consume from CI jobs, local scripts, or custom dashboards.

HTTP Endpoint

Usage

{ type: 'http' }

Description

The HTTP output serves the graph directly from your running NestJS application. It is useful when another service, dashboard, test runner, or browser-based tool needs live graph data without reading from the filesystem.

With the default path, the graph is available at:

  • /__nest-graph-inspector for the JSON graph endpoint used by the viewer
  • /__nest-graph-inspector/output.json for the raw JSON graph output
  • /__nest-graph-inspector/output.md for the markdown graph output

Unless you turn the gate off with accessToken.enabled, these endpoints require an access token. The token to use is printed alongside the endpoint URLs when your application starts.

API

APIDescriptionBenefit
type: 'http'Enables JSON and markdown graph endpoints in your NestJS app.Makes the current dependency graph available over HTTP as soon as the app is running.
path?: stringRoute path used to serve the graph. Defaults to /__nest-graph-inspector.Lets you expose graph data at a route that fits your app conventions, such as /internal/graph or /debug/dependencies.
Nest Graph Inspector · MIT License · © 2026