Lighweight configuration loader for node.js
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Config.r is light configuration loader for node.js. This module is the main dependency of my current project. And my upcoming project: webadmin configuration management, also webadmin nginx conf management.

Quick Start

In your project directory, install using npm:

npm install config.r

Create config.json in your project directory, for example:

       "superAdmin": {
          "username": "admin",
          "password": "93kanaeiapkPDFN" 

and then, you can load your config in this way:

    var config = require('config.r');

Advance usage

Get single config value from nested data, for example I have this config:

       "message": {
          "error" : {
              "login": "you must login",
              "register": "you are login"


You can get the value of message error login in safe way:

	var config = require('config.r');

	var error = config.get('error'); // it will display all error config
	var error_login = config.get('error.login'); // it will display single config

Load multiple config

Say you have multiple configuration


You can load by this way:

var config = require('config.r').load('database, production');

/* prints your database configuration */

/* prints your production configuration */

note: your default prefix config name is

Load from different path:

You can load from different directory, say you have directory named config:


Use path:

	var config = require('config.r').path('config').load('database');
	/* log database */

Set different prefix

	var config = require('config.r').prefix('c').load('database');


your config files must have prefix c:



  • add grunt.js for automaton
  • add unit testing
  • add several method, extends underscore.js to find parent node of current config