npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

configrrr

v2.0.1

Published

Angry configuration for your JS (grrr...)

Readme

Configrrr v2.0.1

:angry: Angry configuration for your JS (grrr...)

Automatically overrides your config values with environment variables, command line switches, and local storage.

  • :timer_clock: Simple setup, minimal configuration
  • :hatched_chick: No dependencies, 881 bytes (minified + gzip)

Installation

npm install configrrr

Usage

import { Config } from 'configrrr';

const config = new Config({
	APP_NAME: 'Example',
	ANGRY: false,
	PORT_NUMBER: 3000,
});
// Override with an environment variable
CONFIG_ANGRY=true npm start

// Override with a command switch
npm start --CONFIG_ANGRY true

// Override 'on the fly' within the browser
localStorage.ANGRY = true;

// Override by hard coding
config.ANGRY = true;
console.log(config.ANGRY);
// true

console.log(config.toJSON());
// { APP_NAME: 'Example', ANGRY: true, PORT_NUMBER: 3000 }

console.log(config.hasOwnProperty('DOES_NOT_EXIST'));
// false

console.log(config.keys);
// [ 'APP_NAME', 'ANGRY', 'PORT_NUMBER' ]

Config override priority

// #1. Hard coded
config.ANGRY = '1st priority';

// #2. Local storage
localStorage.ANGRY = '2nd priority';

// #3. Command switch
npm start --CONFIG_ANGRY '3rd priority'

// #4. Environment variable
// Linux, macOS (Bash):
CONFIG_ANGRY='4th priority' npm start
// Windows (cmd.exe):
set CONFIG_ANGRY='4th priority' && npm start
// Fish shell:
env CONFIG_ANGRY='4th priority' npm start

// #5. Initial config
new Config({ ANGRY: '5th priority' })

CONFIG_ prefix

Notice the environment variables and command switches are prefixed with CONFIG_. This is to avoid accidentally exposing sensitive information to the client.

Usage without ES6 module support

// CommonJS / Node.js
const configrrr = require('configrrr');
const config = new configrrr.Config({ TEST: true });

// AMD / RequireJS 
define(['configrrr'], function(configrrr) {
	const config = new configrrr.Config({ TEST: true });
});

// Global / window
const config = new configrrr.Config({ TEST: true });

Use Case: Layered environment config files

Provide the following directory structure:

  • /app/config/index.js
  • /app/config/config.default.js
  • /app/config/config.env-dev.js
  • /app/config/config.env-prod.js
  • /app-config.local.js (Ignored from source control)
// /app/config/config.default.js
module.exports = { API_URL: undefined };

// /app/config/config.env-dev.js
module.exports = { API_URL: 'http://dev.example.com/' };

// /app/config/config.env-prod.js
module.exports = { API_URL: 'http://api.example.com/' };

// /app-config.local.js
module.exports = { API_URL: 'http://localhost:1234/' };
// /app/config/index.js

import { Config } from 'configrrr';

const env = process.env.hasOwnProperty('NODE_ENV') ? process.env['NODE_ENV'] : 'dev';

const initConfig = Object.assign(
	{},
	require('./config.default.js'),
	require(`./config.env-${env}.js`),
	require('../../app-config.local.js'),
);

export const config = new Config(initConfig);
// app.js

import { config } from '/app/config/';

console.log(config.API_URL);

Notes

  • Config supports key value pairs only
    • Improves performance (no deep merging required)
    • Promotes keeping config files simple

More documentation

Roadmap

  • Unit tests
  • Improve boolean switches (--example instead of --example true)
  • TypeScript definition file
  • Support for dotenv

Author

Matt Turnbull <[email protected]>

License

Open sourced under the MIT license.