Exapedia / Tools / JavaScript configuration libraries JavaScript configuration libraries Updated Nov 2026
JavaScript configuration libraries load an application's settings from environment variables, .env files, and config files. A loader searches known file locations and merges the values it finds into one settings object. These libraries keep API keys, ports, feature flags, and user preferences out of application code.
Popularity Capabilities dotenv Cosmiconfig ConfigArray Lilconfig rc c12 Conf Configstore FAQ Popularity dotenv has the most monthly downloads in this comparison, at 1.0B .
Library Monthly downloads Stars Last release License dotenv 1.0B
20.6K Nov 2026 BSD-2-Clause Cosmiconfig 667.8M
Not on GitHub Aug 2026 MIT ConfigArray 601.0M
Not on GitHub Nov 2026 Apache-2.0 Lilconfig 403.3M
Not on GitHub Nov 2026 MIT rc 225.5M
Not on GitHub May 2018 (BSD-2-Clause OR MIT OR Apache-2.0) c12 152.4M
Not on GitHub Oct 2026 MIT Conf 99.1M
Not on GitHub Oct 2026 MIT Configstore 98.0M
Not on GitHub Jan 2026 BSD-2-Clause Downloads: npm , last thirty days. Stars and releases: GitHub. Amber: no release in over a year.
Features compared Library YAML config files Schema validation Per-file overrides Writes config files Built-in .env loader dotenv Unsupported Unsupported Unsupported Unsupported Built-in Cosmiconfig Built-in Unsupported Unsupported Unsupported Unsupported ConfigArray Unsupported Built-in Built-in Unsupported Unsupported Lilconfig Via plugin Unsupported Unsupported Unsupported Unsupported rc Unsupported Unsupported Unsupported Unsupported Unsupported c12 Built-in Built-in Unsupported Via plugin Built-in Conf Via plugin Built-in Unsupported Built-in Unsupported Configstore Unsupported Unsupported Unsupported Built-in Unsupported Built-in Via plugin Not supported
Libraries and code examples Loads environment-file values into process.env or a supplied target object.
Downloads / mo 1.0B
Stars 20.6K
Last release 18.0.10
License BSD-2-Clause Strengths Loads environment files directly . Load file values early in application startup. Supports a separate target object . Pass processEnv to populate a supplied object instead of process.env. Limitations Existing values win by default . Set override to replace variables already present in the target. Variable expansion needs another tool . Use a separate expansion package for references between variables. $ npm install dotenv@18.0.10 Copy
// Explicit fixture: create .env containing HELLO="Dotenv" first.
import dotenv from 'dotenv';
dotenv.config();
console.log(process.env.HELLO);
dotenv examples From open-source projects on GitHub export function loadRootEnvFiles(root = workspaceRoot) {
const myEnv = loadDotEnvFile({
path: ['.local.env', '.env.local', '.env'].map((file) => join(root, file)),
});
expand(myEnv);
}
Searches for and loads a program's configuration.
Downloads / mo 667.8M
Last release 10.0.1
License MIT Strengths Reads JSON, YAML, and JS rc files . An rc file can be JSON, YAML, JavaScript, or TypeScript. Reads package.json properties . A property in package.json can hold the configuration instead of a file. $ npm install cosmiconfig@10.0.1 Copy
import { cosmiconfig } from 'cosmiconfig';
const explorer = cosmiconfig('myapp');
const result = await explorer.search();
Cosmiconfig examples From open-source projects on GitHub export async function readConfigFromDiskAsync(
rootFolder: string,
): Promise<UserConfig> {
const explorer = cosmiconfig('react-native', {
stopDir: rootFolder,
searchPlaces,
});
const searchResult = await explorer.search(rootFolder);
return parseUserConfig(searchResult);
}
Show full example Matches configuration objects to files by glob patterns on their filenames.
Downloads / mo 601.0M
Last release 0.23.6
License Apache-2.0 Strengths Works outside ESLint . The package carries no ESLint-specific functionality. Later objects override earlier ones . A config object later in the array overrides the objects before it. $ npm install @eslint/config-array@0.23.6 Copy
import path from 'node:path';
import { ConfigArray } from '@eslint/config-array';
const configs = new ConfigArray([{ files: ['**/*.js'], enabled: true }], {
basePath: process.cwd(),
schema: { enabled: {
merge: (a, b) => b ?? a,
validate(value) {
if (typeof value !== 'boolean') throw new TypeError('Boolean expected.');
},
} },
});
configs.normalizeSync();
const config = configs.getConfig(path.resolve('example.js'));
ConfigArray examples From open-source projects on GitHub normalize(context) {
return super.normalize(context).catch(error => {
if (error.name === "ConfigError") {
throw wrapConfigErrorWithDetails(
error,
this[originalLength],
this[baseLength],
);
}
throw error;
});
}
Show full example Provides a zero-dependency alternative to Cosmiconfig with the same API.
Downloads / mo 403.3M
Last release 3.1.5
License MIT Limitations No YAML by default . Add a loader to read YAML files. ESM needs the async API . ESM config files load only through the asynchronous API. $ npm install lilconfig@3.1.5 Copy
import { lilconfig } from 'lilconfig';
const result = await lilconfig('myapp').search();
Lilconfig examples From open-source projects on GitHub async function postCssFindConfig(path: string, options: Options = {}) {
const result = await config.lilconfig('postcss', withLoaders(options)).search(path);
return result ? result.filepath : null;
}
Returns an app's configuration merged with the defaults it specifies.
Downloads / mo 225.5M
Last release 1.2.8
License (BSD-2-Clause OR MIT OR Apache-2.0) Strengths Records the files it read . The returned object lists the path of every config file found. Limitations Mutates a passed defaults object . Pass a fresh object when the defaults must stay unchanged. $ npm install rc@1.2.8 Copy
import rc from 'rc';
const config = rc('myapp', { port: 3000 });
rc examples From open-source projects on GitHub function getConfig() {
process.env = filterEnv(deprecated(process.env), envDefaults);
const rc = require('rc')('strider', defaults);
if (!rc.smtp) rc.smtp = smtp(rc);
if (!rc.smtp) rc.stubSmtp = true;
rc.ldap = getConfigByName('ldap');
addPlugins(rc, process.env);
// BACK COMPAT until we get strider config into plugins...
if (hasGithub) {
rc.plugins.github = rc.plugins.github || {};
rc.plugins.github.hostname = rc.server_name;
}
debug(rc);
return rc;
}
Show full example Merges configuration from multiple sources into one object.
Downloads / mo 152.4M
Last release 4.0.0-rc.4
License MIT Strengths Reloads on change . A config watcher reloads settings when a config file changes. Loads .env files . .env files load with variable interpolation. Limitations Major upgrade needs migration . Follow the migration guide when upgrading between major versions. $ npm install c12@4.0.0-rc.4 Copy
import { loadConfig } from 'c12';
const { config } = await loadConfig({});
Persists small app settings to a JSON file without the app choosing where or how.
Downloads / mo 99.1M
Last release 16.0.0
License MIT Limitations One writer at a time . Avoid writing to the same store from two processes at once. Rewrites the whole file . Keep the store small, such as user settings that change occasionally. $ npm install conf@16.0.0 Copy
import Conf from 'conf';
const config = new Conf({ projectName: 'my-app' });
config.set('enabled', true);
Loads and saves app settings in a JSON file under the user's config directory.
Downloads / mo 98.0M
Last release 8.0.0
License BSD-2-Clause Limitations Superseded by Conf . The authors point new projects to Conf as the newer version. $ npm install configstore@8.0.0 Copy
import Configstore from 'configstore';
const config = new Configstore('my-app');
config.set('enabled', true);
Configstore examples From open-source projects on GitHub function askPermission() {
return Promise.resolve().then(_ => {
const configstore = new Configstore('lighthouse');
const isErrorReportingEnabled = configstore.get('isErrorReportingEnabled');
if (typeof isErrorReportingEnabled === 'boolean') {
return Promise.resolve(isErrorReportingEnabled);
}
return prompt()
.then(response => {
configstore.set('isErrorReportingEnabled', response);
return response;
});
// Error accessing configstore; default to false.
}).catch(_ => false);
}
Show full example For coding agents
Found your configuration library? Help your agent use it. Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.
Claude Code Cursor Codex VS Code Devin Devin Desktop Gemini CLI OpenCode
Run in your terminal
claude plugin install exa@claude-plugins-official Copy Add to ~/.cursor/mcp.json
{
"mcpServers": {
"exa": {
"url": "https://mcp.exa.ai/mcp"
}
}
} Copy Open in your browser, then install the Exa plugin
https://chatgpt.com/plugins/exa Copy Add to .vscode/mcp.json
{
"servers": {
"exa": {
"type": "http",
"url": "https://mcp.exa.ai/mcp"
}
}
} Copy In Devin, open Customize, then MCPs, and add a custom HTTP server with this URL
https://mcp.exa.ai/mcp Copy Add to ~/.config/devin/mcp_config.json
{
"mcpServers": {
"exa": {
"serverUrl": "https://mcp.exa.ai/mcp"
}
}
} Copy Add to ~/.gemini/settings.json
{
"mcpServers": {
"exa": {
"httpUrl": "https://mcp.exa.ai/mcp"
}
}
} Copy Add to opencode.json
{
"mcp": {
"exa": {
"type": "remote",
"url": "https://mcp.exa.ai/mcp"
}
}
} Copy