ChuloWay/nestjs-dependency-analyzer
A command-line tool for analyzing and visualizing dependencies in NestJS applications.
A command-line tool for analyzing and visualizing dependencies in NestJS applications. This tool parses your NestJS modules and creates visual representations of their relationships, helping you understand the architecture of your application.
For generating visual graphs, you'll need to install Graphviz:
Windows (using Chocolatey):
choco install graphviz
macOS (using Homebrew):
brew install graphviz
Ubuntu/Debian:
sudo apt-get install graphviz
# Clone the repository
git clone https://github.com/ChuloWay/nestjs-dependency-analyzer.git
# Install dependencies
cd nestjs-dependency-analyzer
npm install
# Build the project
npm run build
# Link globally (optional)
npm link
npm run analyze -- [options]
Options:
-p, --path <path> Project path (default: current directory)
-f, --format <format> Output format (json|dot) (default: "json")
-d, --depth <depth> Dependency resolution depth (default: "2")
-o, --output <output> Output file path
-h, --help Display help information
npm run analyze
npm run analyze -- -p ../my-nestjs-project -f dot -o dependencies.dot
No download data available
No tracked packages depend on this.
npm run analyze -- -p ../my-nestjs-project -f dot -o ./output/dependencies.dot
The tool will automatically attempt to generate a PNG file if Graphviz is installed.
Generates a DOT file that can be visualized using Graphviz. The output includes:
Example:
digraph {
rankdir=LR;
node [shape=box, style=filled, fillcolor=lightgray];
"AppModule" [label="AppModule\nControllers: 1\nProviders: 1\nImports: 16"];
"AuthModule" [label="AuthModule\nControllers: 1\nProviders: 8\nImports: 3"];
// ...
}
Provides detailed information about each module including:
Example:

The analyzer examines:
@Module() decoratorsnestjs-dependency-analyzer/
āāā src/
ā āāā analyzers/
ā ā āāā dependency.analyzer.ts
ā āāā parsers/
ā ā āāā ast.parser.ts
ā āāā visualizers/
ā ā āāā dot.visualizer.ts
ā āāā types/
ā ā āāā modules.types.ts
ā |āā cli/commands/
ā | āāā analyze.command.ts
| |āā main.ts
āāā tests/
āāā package.json
npm run build
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
For support, please create an issue in the GitHub repository or contact the maintainers.