Most larger projects that I've worked on have 10-20 dependencies. Having all of them an the root level doesn't make much sense, it becomes harder to write software that can check for outdated modules, rebuild modules, upgrade them, etc. node_modules
exists as a standardized way to always have somewhere to store a 3rd party module, without clashing any of your folders. require
will also look at your node_modules
directory by default, eliminating the need for you to specify a direct path to the module.
Also, as Colonel Thirty Two mentioned, you don't want to be checking this into your git repository.
As for your side question, here is the documentation on npm folders. It doesn't look like you can install it in the root of your project, but you can specify the path to the node_modules
directory with the --prefix
flag seen in this answer.
Hope this helps.