Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

dep-tree

> DevOps
Open source

Tool for helping developers keep their code bases clean and decoupled. It allows visualising a code base complexity using a 3d force-directed graph of files and

1.7K stars0 likes4 views
WebsiteGitHub

About

Tool for helping developers keep their code bases clean and decoupled. It allows visualising a code base complexity using a 3d force-directed graph of files and


Visualize the entropy of a code base with a 3d force-directed graph.

The more decoupled and modular a code base is, the more spread and clustered the graph will look like.

Ensure your code base decoupling by creating your own rules and enforcing them with dep-tree check

Checkout the entropy graph of well-known projects

Ts/Js Python Rust Go
typescript langchain deno Docker buildx
react pytorch polars Docker compose
svelte tensorflow alacritty Kubernetes kubelet
vuejs fastapi bevy (ecs) Ollama
angular numpy rocket Gin
storybook scikit-learn axum Go's crypto std
three.js audiocraft MusicGPT Dep Tree
expressjs Cockroach DB SQL parser
material-ui Ethereum
eslint
prettier

Supported languages

Contributing additional languages

If you want to contribute additional languages, there's a guide here that teaches how to implement them with a hands-on example based on a fictional language.

Contributions are always welcome!

Install

On Mac and Linux, it can be installed using brew:

bash
brew install dep-tree

Alternatively, on any platform including Windows it can be installed with pip...

bash
pip install python-dep-tree

...or npm:

bash
npm install @dep-tree/cli

About Dep Tree

dep-tree is a cli tool for visualizing the complexity of a code base, and creating rules for ensuring its loosely coupling.

It works with files, meaning that each file is a node in the dependency tree:

  • It starts from one or more entrypoints, which are usually the main executable files in a program or the files that expose the contents of a library (like package/main.py, src/index.ts, src/lib.rs...).
  • It makes a parent node out of the root file, and one child node for each imported file.

[!NOTE] it only takes into account local files, not files imported from external libraries.

  • That process is repeated recursively with all the imported files, until the file dependency graph is formed.
  • If rendering the code base entropy, the nodes will be rendered using a 3d force-directed graph in the browser.
  • If rendering the dependency tree in the terminal, the nodes will be placed in a human-readable way, and users can navigate through the graph using the keyboard.
  • If validating the dependency rules in a CI system, it will check that the dependencies between files match some boundaries declared in a .dep-tree.yml file.

Usage

Entropy

Choose the file that will act as the root of the dependency graph (for example src/index.ts), and run:

bash
dep-tree entropy src/index.ts

You can also pass multiple files if you don't have a single entrypoint:

bash
dep-tree entropy src/*

It will open a browser window and will render your file dependency graph using a 3d force-directed graph.

The spheres (files) will be placed mimicking some attraction/repulsion forces. Some parts of your code base will tend to gravitate together if they are tightly coupled, and will tend to be separated if they are loosely coupled.

The 3d graph for a clean code base will have groups of nodes clustered together and clearly separated from other clusters:

The 3d graph for a tightly coupled code base will have all the nodes grouped together with no clustering and no clear separation between them:

Explain

Given two pieces of code, displays what are the dependencies between them. These pieces of code are specified using a glob patterns, for example:

bash
dep-tree explain 'src/products/**/*.go' 'src/orders/**/*.go'

[!WARNING]
Make sure you wrap the two glob patterns with single quotes ('') or double quotes (""), otherwise your shell might expand the globstars, and dep-tree explain will receive an incorrect number of arguments.

This command will display what Golang files under the src/products directory depend on other Golang files under the src/orders directory.

It will output something like this:

bash
src/products/books/book.go -> src/orders/renting.go
src/products/price.go  -> src/orders/order_manager.go
src/products/storage.go -> src/orders/order_manager.go

Additionally, the --overlap-left (-l) or --overlap-right (-r) arguments can be passed:

  • --overlap-left: when the left and right glob patterns have some files in common, keep only the common files at the left, and discard them from the right. This flag is useful for retrieving any external dependencies of a specific folder:
bash
# Retrieves dependencies from files in src/products to any other file that is not inside src/products
dep-tree explain 'src/products/**/*.go' '**/*.go' --overlap-left
  • --overlap-right: when the left and right glob patterns have some files in common, keep only the common files at the right, and discard them from the left. This flag is useful for retrieving any file outside a specific folder that depends on that folder.
bash
# Retrieves dependencies from any folder but src/products that point to files inside src/products
dep-tree explain '**/*.go' 'src/products/**/*.go' --overlap-right

Tree

Choose the file that will act as the root of the dependency graph (for example my-file.py), and run:

bash
dep-tree tree my-file.py

You can see the controls for navigating through the graph pressing h at any time:

j      -> move one step down
k      -> move one step up
Ctrl d -> move half page down
Ctrl u -> move half page up
Enter  -> select the current node as the root node
q      -> navigate backwards on selected nodes or quit
h      -> show this help section

Check

The dependency linting can be executed with:

bash
dep-tree check

This is specially useful for CI systems, for ensuring that parts of an application that should not be coupled remain decoupled as the project evolves.

These are the parameters that can be configured in the .dep-tree.yml file:

entrypoints:

List of entrypoints that will act as root nodes for evaluating multiple dependency trees. Some ap

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Goclidependenciesdependencydependency-graph

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
CategoryDevOps
PricingOpen source

> Related tools

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理