NPM — Local private modules

In any large node project there are usually some components that are reused but for number of reasons would not make sense to spin off as a separate private or public npm modules.

As local components are required into different parts of an application, the relative paths needs to be provided which can lead to statements like require(‘../../../config.js’)

An interesting middle ground is to reference those common components in the package.json using a file reference:

{
...
'config' : 'file:./lib/config',
...
}

The lib/config directory needs its own package.json file and the version probably needs to be incremented each time changes are made. npm install will then copy the component into node_modules .This approach allows the usage of `require(config)` throughout the application without having to publish this component as a separate npm module.