Getting Started

How to Use

Easily connect the inspector to start seeing your application architecture visually!

Setup

Enable the inspector in your main AppModule. We recommend the viewer output so you can interactively explore your graph directly from your browser.

app.module.ts
import { Module } from '@nestjs/common';
import { AppModule } from './app.module';
import { NestGraphInspector } from 'nest-graph-inspector';

@Module({
  imports: [
    NestGraphInspector.forRoot({
      outputs: [
        { 
          type: 'viewer', 
          origin: 'http://localhost:9999' 
        }
      ]
    }),
  ],
})
export class RootModule {}

See Result

Once configured, simply start your NestJS application as usual (npm run start).

The inspector will automatically print an accessible link in your application's console. You can click that link directly, or manually head over to the Viewer page and paste your NestJS application's origin URL to see your graph.

Async Setup

If your configuration depends on external services or variables, you can use forRootAsync instead.

app.module.ts
import { Module } from '@nestjs/common';
import { AppModule } from './app.module';
import { NestGraphInspector } from 'nest-graph-inspector';

@Module({
  imports: [
    NestGraphInspector.forRootAsync({
      useFactory() {
        return {
          outputs: [
            { 
              type: 'viewer', 
              origin: 'http://localhost:9999' 
            }
          ]
        };
      },
    }),
  ],
})
export class RootModule {}