npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ngrx-graph

v1.0.2

Published

Generate NgRx actions graph

Readme

ngrx-graph

CLI to scan an Angular NgRx codebase and produce a structure JSON and DOT/SVG graphs.

Motivation:

Working with a very big NgRx store in an angular application will lead to having lots of actions/effects and lots of interactions between components/actions/reducers. It gets very tedious very quickly to follow an action from the start to the end, and it is very easy to miss an action dispatched in an effect somewhere along the chain of actions.

This package tries to collect all actions/components/reducers participating in a particular flow and generate dot files for that flow, with the idea that following a graph visually is easier than following effects and actions in code.

It is also possible to see the whole net with all actions/components/reducers, but that is more important is to follow a particular action from the start to the end (the optional argument)

Notes

  • The CLI always writes the JSON payload to the file specified by --out (default: ngrx-graph.json).
  • DOT and SVG files are written under the directory specified by --dir.
  • DOT files are generated only when --dot or --svg is passed. Use --json to re-generate the JSON first; combine with --dot/--svg to continue generating DOT/SVG.
  • Default concurrency: the CLI computes a sensible default of max(1, CPU_COUNT - 2) (number of CPUs minus two, minimum 1). This keeps CPU available for other tasks while enabling parallel parsing. Override with -c/--concurrency <n>.
  • Prefer viz.js for SVG: pass --viz to prefer using viz.js (a WASM/JS renderer) for SVG generation. With --viz the CLI tries viz.js first and falls back to Graphviz dot if viz.js fails. Without --viz the CLI prefers the native dot executable and uses viz.js only as a fallback.

Install globally (optional):

npm install -g ngrx-graph
# or run with npx: npx ngrx-graph ...

Quick examples

  • Generate the structure JSON (always written to --out, default ngrx-graph.json):
ngrx-graph -d ./src --out ./out
# writes: ./out/ngrx-graph.json
  • Generate an action-focused DOT (and optional SVG):
ngrx-graph "MyAction" -d ./src --out ./out --dot --svg
  • Generate a single aggregated DOT for the whole project (writes all.dot):
ngrx-graph -a -d ./src --out ./out --dot --svg
  • Re-generate the JSON only (stop after JSON):
ngrx-graph -d ./src --out ./out --json
ngrx-graph -d ./src --out ./out

Note: caching is enabled by default. To force a re-scan and regenerate the JSON payload, pass -f or --force.

Common flags: -d/--dir, -o/--out, -a/--all, -s/--svg, -j/--json, -v/--verbose, -c/--concurrency, -f/--force

| | | | --------------- | -------------------------------------------- | | Component | component | | Action | component | | Action in focus | component | | Nested Action | component | | Reducer | component |

Case 1:

Input:

Input files (see the canonical example sources under docs/examples/case1/src):

  • Actions: docs/examples/case1/src/case1.actions.ts
  • Component: docs/examples/case1/src/case1.component.ts
  • Effects: docs/examples/case1/src/case1.effects.ts
  • Reducer: docs/examples/case1/src/case1.reducer.ts

Output:

npx ngrx-graph -j
npx ngrx-graph action1
npx ngrx-graph action3

Case 2 (nested actions):

Input:

Input files (see the canonical example sources under docs/examples/case2/src):

  • Actions: docs/examples/case2/src/case2.actions.ts
  • Component: docs/examples/case2/src/case2.component.ts
  • Effects: docs/examples/case2/src/case2.effects.ts
  • Reducer: docs/examples/case2/src/case2.reducer.ts

Output:

npx ngrx-graph -j
npx ngrx-graph action1
npx ngrx-graph action3

Case 3 (reachability filtering):

Input:

Input files (see the canonical example sources under docs/examples/case3/src):

  • Actions: docs/examples/case3/src/case3.actions.ts
  • Component: docs/examples/case3/src/case3.component.ts
  • Effects: docs/examples/case3/src/case3.effects.ts
  • Reducer: docs/examples/case3/src/case3.reducer.ts

Output:

npx ngrx-graph -j
npx ngrx-graph action1
npx ngrx-graph action3
npx ngrx-graph action2

Case 4 (aliases and re-exports):

Input:

Input files (see the canonical example sources under docs/examples/case4/src):

  • Actions: docs/examples/case4/src/case4.actions.ts
  • Barrel / re-exports: docs/examples/case4/src/index.ts
  • Component: docs/examples/case4/src/case4.component.ts
  • Effects: docs/examples/case4/src/case4.effects.ts
  • Reducer: docs/examples/case4/src/case4.reducer.ts

Output:

npx ngrx-graph -j

Generate a combined graph for the whole example:

npx ngrx-graph -a -d docs/examples/case4/src -o docs/examples/case4/out

Generate a graph for a specific action (produces per-action DOT only when an action is supplied):

npx ngrx-graph actionA -d docs/examples/case4/src -o docs/examples/case4/out
$ npm install -g ngrx-graph
$ ngrx-graph COMMAND
running command...
$ ngrx-graph (--version)
ngrx-graph/1.0.2 linux-x64 node-v16.20.2
$ ngrx-graph --help [COMMAND]
USAGE
  $ ngrx-graph COMMAND
...

ngrx-graph help [COMMAND]

Display help for ngrx-graph.

USAGE
  $ ngrx-graph help [COMMAND...] [-n]

ARGUMENTS
  [COMMAND...]  Command to show help for.

FLAGS
  -n, --nested-commands  Include all nested commands in the output.

DESCRIPTION
  Display help for ngrx-graph.

See code: @oclif/plugin-help

  • change version in package.json
  • run npm run version
  • run ./scripts/test-npm-pack.sh to check that package would work if published.
  • commit and push/merge to main
  • draft and release a release on github

Status:

This project is still young and it encourages collaborations. If you have an ideas/questions/fixes please do not hesitate to open an issue or provide a pull request.

I work on this on my own free time only.