Skip to main content
Alias: nx dep-graph nx graph opens an interactive visualization of your workspace’s project dependency graph in the browser. You can also export the graph as JSON or HTML, filter by project, or show only affected projects.

Options

Output

string
Write the graph to a file instead of opening the browser. Supports .json for raw data and .html for a self-contained interactive page.
boolean
Print the project graph to stdout in the terminal instead of opening the browser.

View mode

string
default:"projects"
Choose whether to visualize the project graph or the task graph. Choices: projects, tasks.
string
The targets to show when viewing the task graph (--view=tasks). Accepts comma-separated values.

Filtering

string
Highlight a single project and all of its ancestors and descendants. All other projects are dimmed.
string
Comma-separated list of projects to hide from the graph.
boolean
Highlight only the projects that are affected by recent changes. Requires git context (uses the same base/head logic as nx affected).
string
Base git ref for computing affected projects. Implies --affected.
string
Head git ref for computing affected projects. Implies --affected.
string
Treat specific files as changed when computing affected projects. Implies --affected.
boolean
Include uncommitted changes when computing affected projects. Implies --affected.
boolean
Include untracked files when computing affected projects. Implies --affected.

Display

boolean
Group projects visually by their folder path in the interactive graph.
boolean
default:"true"
Watch for workspace changes and automatically update the graph in the browser.
boolean
default:"true"
Open the graph in the default browser. Set to false to start the server without opening.

Server

string
IP address to bind the graph server to. Defaults to localhost.
number
Port to bind the graph server to.
boolean
Print additional information about the command.

Examples

The nx affected:graph command is a deprecated alias for nx graph --affected. Use nx graph --affected instead.

Using the interactive graph

When the graph opens in the browser, you can:
  • Click a project node to see its dependencies and dependents
  • Use the sidebar to search for and filter projects
  • Toggle between Projects and Tasks views
  • Enable Group by folder to organize nodes by directory structure
  • Use Focus to isolate a project’s subgraph
  • Export the current view as a PNG or JSON