Private Modules in Node
easy private npm modules for node!

Yeah I know you can install private git repositories as npm modules, but then you run into problems with development. Today I'm working on an app we use in house at Wheatcrofts called clunky, and yeah it does things with dropbox, so the dropbox logic is a separate module. There will never be any point publishing this dropbox module as a standalone, so it's private.

So the options are:

  • npm install <fs path> - use module from fs path.. this is ok for quick & dirty local stuff, but it just won't work on heroku or wherever
  • npm install leviwheatcroft/clunky-dropbox - use module from github.. any changes need to be committed and then downloaded in your repo, a painfully slow dev cycle
  • npm install @clunky/dropbox - solves all these problems

It's pretty easy to get started..

  • scope your module, which pretty much means naming it @clunky-dropbox instead of clunky-dropbox, there's not really any additional magic.
  • sign up at gemfury - no it's not just for ruby gems.
  • fury.io will walk you through commands to add fury.io as a repo remote, and set your npm config to use the fury registry.
  • use the fury addon at heroku or wherever else your deploying production instances

... and you're done!

Once this is done, you can go to the submodule directory / repo and npm link then back in the primary project dir you can npm link @clunky/dropbox && npm install --save @clunky/dropbox.

This link is the magic that means during development locally, your app is just pulling code directly from your fs, but when deployed it will pull code from the fury.io repo.