Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get dependency tree/graph in NestJS?

Nestjs provides out of the box DI container very conveniently but as project gets more complex it is easy to lose the full picture of all dependencies and their order.

Question: Is there a way to get a list of all dependencies (modules, providers, controllers...) possibly in a way that can be put into a tree/graph? I'm sure Nestjs tracks this information internally and I'm wondering what would be the best way to access it.

(I found [nestjs-dependency-graph] but it scans the modules manually for metadata, doesn't find all dependencies and tends to go into infinite loop)

like image 943
Andrej K Avatar asked Oct 15 '22 05:10

Andrej K


1 Answers

It's not a complete solution yet, but there is the package I've been working on nestjs-spelunker. You can read through the readme and see if it does what you're looking for

like image 55
Jay McDoniel Avatar answered Oct 21 '22 00:10

Jay McDoniel