Statically analyze any Angular (v17+) app's routing and get a self-contained interactive graph — no runtime, no server, no CDN. One HTML file you can open or commit.
npx angular-routing-viewer --open- Workspace-aware — detects Angular CLI and statically configured Nx workspaces, then selects the requested application.
- Deep static analysis — follows app and library route fragments,
loadChildren/loadComponent, path constants (ROUTES.WELCOME), barrel re-exports, and tsconfig path aliases. - Self-contained output — one
index.htmlwith all CSS/JS inlined. Drag, pan, search, inspect. - Runs on plain Node — no Bun required to use it.
If you have Node (every Angular dev does), run it straight from npm:
npx angular-routing-viewer # analyze the current Angular projectFor a short, repeatable ngrv command:
npm install -g angular-routing-viewer
ngrv # now available everywhereUpgrade with npm update -g angular-routing-viewer, remove with npm uninstall -g angular-routing-viewer.
The published package is named
angular-routing-viewer; the command it installs isngrv.
For contributors or to run the latest main. Requires Bun ≥ 1.0.
git clone https://github.com/neogenz/angular-routing-viewer.git
cd angular-routing-viewer
bun install
bun run bin/ngrv.ts /path/to/angular-app # run directly, no build neededTo expose a global ngrv from your checkout, build the bundle first (the bin points at dist/), then link it:
bun run build && bun linkFrom the root of any Angular project:
ngrv # analyze cwd → ./angular-routing/index.html
ngrv --open # ...and open it in the browser| Option | Description |
|---|---|
[path] |
Angular project path to analyze (default: cwd) |
--output <dir> |
Output directory (default: ./angular-routing) |
--entry <file> |
Explicit root routes file (default: auto-detected) |
--project <name> |
Project name in a multi-app workspace |
--open |
Open the graph in the browser after generation |
--json |
Write data.json only to stdout (no HTML) |
--verbose |
Print analyzed files and full warnings |
--help, -h |
Show help |
ngrv ./my-app --open # analyze a path + open the graph
ngrv --entry src/app/app.routes.ts # force the entry file
ngrv --project admin # pick an Angular app in a multi-app or Nx workspace
ngrv --json > routes.json # raw JSON export, no HTMLRun the command from the workspace root and select the application when the workspace contains more than one:
ngrv /path/to/nx-workspace --project admin --openNx discovery reads static project metadata from project.json and package.json#nx; it does not run Nx plugins or application code. If the target path is inside an application root, that application is selected automatically. Otherwise a multi-app workspace requires --project <name>.
Workspace libraries can contribute routes through:
Routes,Route[], default exports, named exports, and nested barrel re-exports.- Imported
children, local or imported route-array spreads, and statically resolvableloadChildrencallbacks. - Relative imports, inherited tsconfig aliases,
baseUrl, and Nx library package names. - Standalone routes and NgModule routing through
RouterModule.forRoot/RouterModule.forChild.
File locations in CLI JSON, warnings, and generated graph data are workspace-relative, including sources reached through libraries.
| Action | Result |
|---|---|
| Drag empty canvas | Pan |
| Drag node | Move |
| Click node | Full details in side panel |
| Hover node | Highlight its branch |
| Search (top bar) | Filter by path / component / guard |
| Export JSON | Download data.json |
Node types
| Type | Color | Meaning |
|---|---|---|
route |
blue | Standard route with a component |
lazy-module |
purple | loadChildren (lazy sub-routing) |
lazy-component |
cyan | loadComponent (lazy component) |
redirect |
orange | redirectTo |
wildcard |
gray | path ** |
- Static analysis only — no code is evaluated. Runtime-computed routes, dynamic providers, and Nx projects available only through plugin inference are outside the compatibility guarantee.
- Module Federation and other runtime-selected loaders cannot be traversed unless their import and exported route array are statically visible. Unresolved route imports, exports, loaders, spreads, and cycles are reported as analyzer warnings rather than silently treated as complete.
...(cond ? [...] : [])spreads are flattened to the truthy branch (with a warning); other spreads must resolve to a static local or imported route array or they are skipped with a warning.canLoadguards are shown but flagged deprecated — prefercanMatch.
bun install
bun run bin/ngrv.ts [path] [flags] # run the CLI from source (no build step)
bun tsc --noEmit # typecheck
bun test # tests
bun run build # bundle to dist/ngrv.js (the published artifact)The CLI is authored in TypeScript and runs directly under Bun in dev. For npm it's bundled to a single Node-runnable file at dist/ngrv.js via scripts/build.ts (bun build --target node, with ts-morph and @clack/prompts kept as external deps). End users run it under plain Node — no Bun needed.
To verify the published artifact locally:
bun run build
node dist/ngrv.js /path/to/angular-app --json # exercise the bundle under NodePublishing to npm is automated by .github/workflows/release.yml — pushing a v* tag builds the bundle and runs npm publish.
Per release:
-
Bump the version in both places so they agree:
package.json→version(what npm publishes)src/index.ts→const VERSION(whatngrv --helpprints)
npm version <patch|minor|major>bumpspackage.jsonand creates the matching git tag in one step — just remember to updatesrc/index.tstoo. -
Push the tag:
git push --follow-tags
-
The workflow then builds
dist/ngrv.jsand publishes to npm with provenance.
Users get the new version automatically the next time they npx angular-routing-viewer, or via npm update -g angular-routing-viewer.
One-time setup: publishing uses npm Trusted Publishing (OIDC) — no token to create or store. On npmjs.com → the package → Settings → Trusted Publisher, add:
- Provider: GitHub Actions
- Repository:
neogenz/angular-routing-viewer - Workflow:
release.yml
The workflow already has the required id-token: write permission.
Or skip CI entirely and publish from your machine: npm version patch && npm publish (the prepublishOnly hook builds the bundle first; you must be npm login'd).
Issues and PRs welcome — see CONTRIBUTING.md for setup and the pre-PR checks. By participating you agree to the Code of Conduct. To report a vulnerability, follow the Security Policy.
MIT © Maxime De Sogus