node package manager

A lightweight IoC container to build the core of a scalable and modular API (inspired by Angular and Pimple). No dependencies, works on Node.js and in the browser (only 2kb minified gzipped).

Actual version published on NPM npm module downloads per month provides a lightweight and flexible core to create a scalable API of a lib, a module, an application or a framework. is inspired (among others) by Angular and Pimple.

It is useful for starting a project quickly with a modular API ready to use. (and any object built on top of integrates:

No dependencies, works on Node.js and in the browser (only 7kb minified - 2kb gzipped).

Quick start

See quickstart.


Get common instance of Noder:

var noder = require('');

Best practice, create an instance of Noder class for your project:

// ./api/index.js 
var Noder = require('').Noder;
var api   = new Noder();
// code body that constructs your API 
module.exports = api;

or shortcut:

// ./api/index.js 
module.exports = require('').createNoder();

Use your API in another file:

var api = require('./api');
// load a plugin 
// create an item in the container 
api.$di.set('someItem', 'value of the item');
// ... 

Collection provides a class to handle a collection of items.

// create a collection 
var items = noder.createCollection();
items.set('keyName', 'key value');
// keyName value 
// get all items 
var all = items.getAll();
// true 
console.log(items instanceof noder.Collection);

See collection.

Dependency Injection

See dependency injection.

Lazy loading

noder.$require method provides a lazy require():

// define the property without loading the mongoose module 
// false 
// lazy loading 
var mongoose = noder.mongoose;
// true 
// true 
console.log(noder.mongoose === require('mongoose'));


noder.$require('promise', 'bluebird');
// true 
console.log(noder.promise === require('bluebird'));

Custom loader:

// factory: promisify the "fs" module 
noder.$require('fs', function() {
  return noder.promise.promisifyAll(require('fs'));
  .then(function(contents) {
  .catch(function(err) {

See lazy loading.

Plugins provides a plugin system to make a package works as a plugin for and also as a standalone module or library.

Example of a Noder plugin:

 * Initialization for use as a standalone module.
 * @return {Noder} New `Noder` instance
module.exports = function blog() {
  var Noder = require('').Noder;
  var noder = new Noder();
  // or use the shortcut: 
  // var noder = require('').createNoder(); 
  return module.exports.__noder(noder);
 * Init `blog` plugin.
 * @param  {Noder} noder  `Noder` instance
 * @return {Noder}        Current `Noder` instance
module.exports.__noder = function blogPlugin(noder) {
  // create config object only if not exists 
  noder.$di.addOnce('config', {}, true);
  // sub-modules of blogPlugin 
  // that add features to the instance of Noder 
  // Always return the instance of Noder to allow chaining 
  return noder;

See plugins.

Unit Tests is fully tested with Unit.js and Mocha.


MIT (c) 2013, Nicolas Tallefourtane.


Nicolas Tallefourtane -
Nicolas Talle
Make a donation via Paypal