mjdi

Search documentation

Search the mjdi v0.10.0 documentation

mjdi docsv0.10.0latest

Dependency graph visualization (P1-02)

The documentation website ships an interactive graph viewer that

Source: mjdi/docs/graph-visualization.md

The documentation website ships an interactive graph viewer that consumes real graph_json exports — the same bytes graph_export produces for your registries.

Open the viewer: /graph-viewer — it renders the checked-in showcase fixtures and accepts your own export: paste a mjdi.graph/1 JSON or load one of the fixture files. This guide (/docs/0.8.0/graph-visualization) documents it.

Features

  • Zoom and pan (mouse wheel + drag, plus zoom buttons and a fit-to-view reset).
  • Search by service type — matches highlight nodes and their edges.
  • Node selection with a dependency-inspection panel: provider kind, registration source, effective lifetime, alias target, linear and copyable flags, scope requirement, validation problems.
  • Provider filtering — show/hide class, value, factory, and alias providers.
  • Lifetime filtering — show/hide transient, singleton, and scoped nodes.
  • Alias visualization — dashed edges and dashed node borders.
  • Cycle highlighting — nodes whose problems include a cycle (or missing dependencies) render with a red border; exports of invalid graphs — which the viewer is designed to help with before the composition root compiles — are visible at a glance.
  • Dependency path highlighting — selecting a node highlights its incoming and outgoing edges.
  • Export as SVG — serialize the current view.
  • Export as PNG — rasterize the current view (browser-dependent; the button falls back to SVG when the raster step is unavailable).
  • Export as DOT — regenerate a Graphviz document from the loaded graph.
  • Responsive layout and dark and light themes (the site's theme applies).

Where the data comes from

The viewer consumes actual graph JSON exported by mjdi:

  • website/public/graph-fixtures/showcase.json — the showcase registry from tools/graph_export.mojo (value, factory, class with every lifetime, and an alias),
  • website/public/graph-fixtures/before.json / after.json — the graph-diff fixtures.

All three are regenerated by scripts/export_graph_fixtures.sh, which runs the export tool with the Mojo toolchain; CI fails if the checked-in fixtures drift from the library's export. Nothing is hardcoded: the viewer parses the mjdi.graph/1 schema (nodes, edges, problems) exactly as graph export documents it.

Fixture regeneration

scripts/export_graph_fixtures.sh