Skip to content
Easy deployment configuration.
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Easy deployment configuration

With configist you get the possibility to configure your application in various ways (in precedence order):

  • config in package.json
  • config:{environment} in package.json
  • environment variables
  • command line arguments
  • custom objects

Let's say the configuration is like this:

// package.json
  "config": {
    "listen": ""
  "config:development": {
    "db": "mongodb://localhost"
  "config:production": {
    "listen": "",
    "db": "mongodb://"

Basic usage:

var config = require('configist')().use(require('./package.json'));


Output when NODE_ENV=development (or not given):

{ listen: '',
  db: 'mongodb://localhost',
  env: 'development' }

Output when NODE_ENV=production:

{ listen: '',
  db: 'mongodb://',
  env: 'production' }

You can change the configuration dynamically. The commands are all equivalent and sets the listen parameter:

node . --listen=:3000
npm start --listen=:3000
LISTEN=:3000 node .
LISTEN=:3000 npm start

You can load multiple configurations:

var configist = require('configist')();

configist.use(null, {
  base_url: ''
configist.use('development', {
  shared_secret: 'sg4lWb15Lt7OZYR/yyly3S1HrVou1xMN'


Happy hacking!

By the way, you can install it:

npm install configist
Something went wrong with that request. Please try again.