MCPcopy Index your code
hub / github.com/node-config/node-config

github.com/node-config/node-config @v5.0.1-0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v5.0.1-0 ↗ · + Follow
100 symbols 338 edges 57 files 62 documented · 62% updated 8d agov5.0.0-alpha.2 · 2026-06-27★ 6,4279 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Configure your Node.js Applications

npm package Downloads Issues

Release Notes

Introduction

Node-config organizes hierarchical configurations for your app deployments.

It lets you define a set of default parameters, and extend them for different deployment environments (development, qa, staging, production, etc.).

Configurations are stored in configuration files within your application, and can be overridden and extended by environment variables, command line parameters, or external sources.

This gives your application a consistent configuration interface shared among a growing list of npm modules also using node-config.

Project Guidelines

  • Simple - Get started fast
  • Powerful - For multi-node enterprise deployment
  • Flexible - Supporting multiple config file formats
  • Lightweight - Small file and memory footprint
  • Predictable - Well tested foundation for module and app developers

Quick Start

The following examples are in JSON format, but configurations can be in other file formats.

Install in your app directory, and edit the default config file.

$ npm install config
$ mkdir config
$ vi config/default.json
{
  // Customer module configs
  "Customer": {
    "dbConfig": {
      "host": "localhost",
      "port": 5984,
      "dbName": "customers"
    },
    "credit": {
      "initialLimit": 100,
      // Set low for development
      "initialDays": 1
    }
  }
}

Edit config overrides for production deployment:

 $ vi config/production.json
{
  "Customer": {
    "dbConfig": {
      "host": "prod-db-server"
    },
    "credit": {
      "initialDays": 30
    }
  }
}

Use configs in your code:

const config = require('config');
//...
const dbConfig = config.get('Customer.dbConfig');
db.connect(dbConfig, ...);

if (config.has('optionalFeature.detail')) {
  const detail = config.get('optionalFeature.detail');
  //...
}

config.get() will throw an exception for undefined keys to help catch typos and missing values. Use config.has() to test if a configuration value is defined.

Start your app server:

$ export NODE_ENV=production
$ node my-app.js

Running in this configuration, the port and dbName elements of dbConfig will come from the default.json file, and the host element will come from the production.json override file.

TypeScript

Type declarations are published under types/ and resolved via typesVersions. Subpath typings are included for config/parser, 'config/util/defer', and config/lib/util in addition to the main config entrypoint.

Articles

Further Information

If you still don't see what you are looking for, here are some more resources to check:

Contributors

lorenwest jdmarshall markstos i­Moses elliotttf mdkitzman
jfelege leachi­M2k josx enyo leosuncin arthanzel
leonardovillela jeremy-daley-kr simon-scherzinger Badger­Badger­Badger­Badger nsabovic cunneen
Osterjour th507 tiny-rac00n eheikes fgheorghe roncli
superoven airdrummingfool wmertens Xadilla­X inside dsbert

License

May be freely distributed under the MIT license.

Copyright (c) 2010-2026 Loren West and other contributors

Extension points exported contracts — how you extend this code

Config (Interface)
(no doc)
test/x-config-ts/types.ts
Config (Interface)
(no doc)
test/x-config-ts-module-exports/types.ts

Core symbols most depended-on inside this repo

get
called by 70
lib/util.js
requireUncached
called by 33
test/_utils/requireUncached.mjs
loadFileConfigs
called by 30
lib/util.js
extendDeep
called by 20
lib/util.js
setModuleDefaults
called by 19
lib/util.js
makeImmutable
called by 17
lib/util.js
equalsDeep
called by 17
lib/util.js
initParam
called by 17
lib/util.js

Shape

Method 63
Function 21
Class 14
Interface 2

Languages

TypeScript100%

Modules by API surface

lib/util.js55 symbols
lib/config.mjs23 symbols
test/config/default.js3 symbols
benchmarks/config/default.js3 symbols
test/x-config-ts/default.ts2 symbols
test/30-types-test.js2 symbols
test/0-util.js2 symbols
lib/defer.js2 symbols
tools/contributors.js1 symbols
test/x-config-ts/types.ts1 symbols
test/x-config-ts/local.ts1 symbols
test/x-config-ts-module-exports/types.ts1 symbols

Dependencies from manifests, versioned

@types/node20.11.30 · 1×
c810.1.3 · 1×
coffeescript2.2.4 · 1×
cson3.0.1 · 1×
faceoff1.3.0 · 1×
hjson1.2.0 · 1×
json52.2.3 · 1×
properties1.2.1 · 1×
request2.88.2 · 1×
semver5.3.0 · 1×
toml2.0.6 · 1×
ts-node10.9.2 · 1×

For agents

$ claude mcp add node-config \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact