Configuration

UI

Configure how the viewer's layout is persisted.

UI

ui groups viewer-facing settings that aren't about extracting the graph itself. Today it holds one thing: how the viewer's saved arrangement of your graph — module positions, collapsed state, item positions — is persisted.

ui?: {
  layout?: {
    saveAs?: 'file' | 'runtime'
  }
}

This is a module-wide setting. It applies to every viewer and http output in your configuration; there is no per-output override.

saveAs

ValueBehavior
'file' (default)Saved to ./.muse, a fixed path relative to your process's working directory. Survives restarts, and can be committed to your repository so a saved layout ships with your team.
'runtime'Kept in memory only, inside the running process. Nothing is ever written to or read from disk. Resets to an empty layout every time the application restarts.

File mode (default)

NestGraphInspectorModule.forRoot({
  outputs: [{ type: 'viewer' }],
  // ui.layout.saveAs defaults to 'file' — no configuration needed
})

The viewer reads and writes this file through GET {path}/layout.json and POST {path}/layout, both gated behind the same access token as every other endpoint. Saves are written atomically — through a temporary file and a rename — and one at a time in arrival order, so an interrupted process or an overlapping request can never leave ./.muse holding a partial or interleaved layout.

./.muse is a plain JSON file. Commit it if you want your team to share one arrangement of the graph, or add it to .gitignore if each developer should keep their own.

Runtime mode

NestGraphInspectorModule.forRoot({
  outputs: [{ type: 'viewer' }],
  ui: { layout: { saveAs: 'runtime' } },
})

Use this when you don't want the inspector touching your filesystem at all — for example, in a read-only container, or a CI job that boots the application only to inspect it. The layout still round-trips through the same GET {path}/layout.json / POST {path}/layout endpoints and is still validated the same way; it simply lives in memory on the adapter instead of on disk, and is gone the moment the process restarts.

Example

NestGraphInspectorModule.forRoot({
  outputs: [
    { type: 'viewer' },
    { type: 'http', path: '/internal/graph' },
  ],
  ui: {
    layout: { saveAs: 'file' },
  },
})

Both outputs above share the one ./.muse file — layout persistence is not configurable per output.

Nest Graph Inspector · MIT License · © 2026