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

boldr-config

v0.1.4

Published

A config loader for Boldr

Readme

boldr-config

Boldr Config is a tool for configuring your JavaScript applications. Sharing similarities, yet expanding upon the shortfalls of other configuration tools.

Configuration values can be loaded from argv flags, environment variables, JSON config files, and YAML files.

Files and Loading Priority

Boldr Config crawls multiple paths searching for configuration files. Once found, the values are merged based on a hierarchy (explained below), placed into a single object, and loaded into your application.

  1. argv flags passed through the command line. --db--host value translates to config.db.host === 'value'
  2. Environment variables defined as MY_APP__DB__HOST_NAME=value translates to config.db.hostName === 'value' Anything below can be json5 or yaml (requires installing js-yaml)
  3. ~/.appNamerc
  4. ~/.appName/config
  5. ~/.config/appName
  6. ~/.config/appName/config
  7. /etc/appNamerc
  8. /etc/appName/config
  9. /usr/local/etc/appNamerc
  10. /usr/local/etc/appName/config
  11. ./.appNamerc
  12. ../.appNamerc
  13. ../../.appNamerc
  14. ...

Usage

Create a new instance of BoldrConfig, pass it your application name 'boldr' followed by an object containing keys and values for your application. This is the default config.

### config.js
import BoldrConfig from 'boldr-config';
//                   new instance   'name', keys/values
const boldrConfig = new BoldrConfig('boldr', {
  server: {
    port: 2121,
    host: '127.0.0.1',
    apiPrefix: '/api/v1',
    siteUrl: 'http://localhost:3000',
  },
  logging: {
    level: 'debug',
    file: {
      enable: true,
      dir: 'logs',
      level: 'info',
      filename: 'boldr.api',
    },
  },
  db: {
    url: 'postgres://postgres:[email protected]:5432/boldr',
    name: 'boldr',
    debug: false,
  },
  redis: {
    url: 'redis://127.0.0.1:6379/0',
  },
  token: {
    secret: 'v3ryS3cretT0k3n',
  },
  mail: {
    host: 'smtp.example.com',
    port: 465,
    ssl: true,
    user: '[email protected]',
    password: 'password',
    from: '[email protected]',
  },
  cors: {
    whitelist: ['http://localhost:2121', 'http://localhost:3000'],
  },
});

// create a constant config and tell your instance of boldrConfig to transform it to an object. Export config or whatever you called it and you can then import it anywhere in your app and retrieve values as normal.
// ex: const db = config.db.name
const config = boldrConfig.toObject();

export default config;

// What is this? See below on how you can use it.
export { boldrConfig };

Display Config

It's possible to print out your configuration to stdout. When the configuration is printed, the source where the value was loaded from is also displayed.

To take advantage of this feature, call the displayConfig() method on your BoldrConfig instance.

...^
import BoldrConfig from 'boldr-config';
const boldrConfig = new BoldrConfig('boldr', { ... });
const config = boldrConfig.toObject();
export { boldrConfig };

## server.js
import config, { boldrConfig } from './config';

console.log(boldrConfig.displayConfig());

Executing the displayConfig method will print what you see below to stdout.

  Displaying config for boldr
┌───────────────────────┬─────────────────────────────────────────────┬
│ Path                  │ Value                                             │ Source      │
│ server.port           │ 2121                                              │ .boldrrc    │
│ server.host           │ "127.0.0.1"                                       │ .boldrrc    │
│ server.apiPrefix      │ "/api/v1"                                         │ defaults    │
│ server.siteUrl        │ "http://localhost:3000"                           │ defaults    │
│ logging.level         │ "debug"                                           │ .boldrrc    │
│ logging.file.enable   │ true                                              │ defaults    │
│ db.debug              │ false                                             │ defaults    │
│ redis.url             │ "redis://redis:6379/0"                            │ environment │
└──────────────────┴───────────────────────────────────────────────────┴