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 🙏

© 2025 – Pkg Stats / Ryan Hefner

config-dug

v2.0.0-alpha.1

Published

Config management library for Node.js with support for multiple environments, config files, environment variables and plugins

Downloads

17,265

Maintainers

neo-matias-wengielneo-matias-wengielneo-daniel-brennanneo-daniel-brennanamievishwaamievishwaneoauderesantosneoauderesantosneo-matt-feliceneo-matt-feliceomolaraomolaradennisbartheldennisbarthelneo-rivan-motaneo-rivan-motalucachameckilucachameckiedward.nazarovedward.nazarovstephanie-wang-neostephanie-wang-neoluan.leluan.lear-iesar-iescjnewmancjnewmanneo-michal-kowalneo-michal-kowalneo-youre_penaneo-youre_penamichelepipernimichelepipernikyle-elyk-neokyle-elyk-neoamjad-mahfoud-neoamjad-mahfoud-neovidalrmrzvidalrmrzteena_teena_rnetto46rnetto46kaelanneofinancialkaelanneofinancialbriancruzbriancruzmaiko.trindademaiko.trindadedarrenpicard25darrenpicard25brayden_sc_neobrayden_sc_neomaxgoomaxgoostschmaltzstschmaltzusernamesebusernameseberic.zaporzan.neoeric.zaporzan.neolucasparreiralucasparreiralewishorwoodlewishorwoodcraigsiemenscraigsiemensdiegobmydiegobmyjoelsimpsonjoelsimpsonjooh-leejooh-leekasrababaeikasrababaeironellgarciaronellgarciapunit.patelpunit.patelneo-elgiz-abbasovneo-elgiz-abbasovhrishikeshkalehrishikeshkaleanna_benemanskaiaanna_benemanskaiahanna.tkachenkohanna.tkachenkou2v22u2v22neo-bclausineo-bclausinikita-syrotenkonikita-syrotenkojcavalcantijcavalcantijohnclendvoyjohnclendvoyneo-peter-spanglerneo-peter-spanglerdemaestrodemaestrodustinn1235dustinn1235daylan.lawdaylan.lawneo-stephenneo-stephenneogibsonneogibsonberakiberakivrochamaaiavrochamaaiad_fenniakd_fenniakadamtranquillaadamtranquillaroman.mnatsakanianroman.mnatsakaniannehasingh1801nehasingh1801lucaslongarinilucaslongarinierozonachierozonachifaddoulfaddouldivanshudivanshucaio.andradecaio.andraderishbarrishbardeankimdeankimtimothy.couch.neofinancialtimothy.couch.neofinancialbrentcambrentcammike.himbeault-neomike.himbeault-neostefan.amyottestefan.amyotteneo-travis-friesenneo-travis-friesenherculesjrherculesjrnahom-neonahom-neomatthew.belfordmatthew.belfordjoeljwoodjoeljwoodneo-rodrigoravalneo-rodrigoravalmalcolm-neomalcolm-neoneo-hasanpreetsinghneo-hasanpreetsinghscottkayeneoscottkayeneodhruvangdhruvangmohpormohporneo-baonguyenneo-baonguyenmohamedalhammoudmohamedalhammoudneo-seol-kimneo-seol-kimraul.ribeiroraul.ribeirolavanya.mohanlavanya.mohanmhowitt-neomhowitt-neobenx-neobenx-neoneo-dakota-chattneo-dakota-chattnico-connornico-connorvinicius-barcelosvinicius-barcelosrjberryrjberrynitin.madannitin.madandesmond-maloneydesmond-maloneymaiahneomaiahneolucasjohannsonlucasjohannsonmatheusicaromatheusicaromarcelo.matosmarcelo.matosstburkestburkeneodiegobeltranneodiegobeltranniconeimanniconeimanneo-barry-lineo-barry-lineo-ricardo-gomezneo-ricardo-gomezanhtranneoanhtranneoneo-dione-silvaneo-dione-silvatunde-neotunde-neoneo-miguel-castroneo-miguel-castroneobot1neobot1neo-bryce-brandfordneo-bryce-brandfordgaulfordgaulfordmarvindeleonmarvindeleondanielafekhume-neodanielafekhume-neokennethcolinakennethcolinaneo-paula-grangeironeo-paula-grangeirodas-bossdas-bossrhullyamrhullyamneo-ahmed-seifelnasrneo-ahmed-seifelnasrishmeet.rayatishmeet.rayatmsalamamsalamajadondubyjadondubybiancaballenabiancaballenaneo.eduardoyuidyneo.eduardoyuidyneo-shubham-patelneo-shubham-patelneo-will-parkerneo-will-parkerneo-chris-nobleneo-chris-nobleneo-diego-nunesneo-diego-nunesfelipe.minettofelipe.minettoneo-oleksandr-yanchenkoneo-oleksandr-yanchenkoneo-lior-ben-shaharneo-lior-ben-shaharneo-shruti-goyalneo-shruti-goyalantonio.canabravaantonio.canabravatim-neo2tim-neo2mganzneomganzneoneo-eason-changneo-eason-changneo-zhaoquan-zhangneo-zhaoquan-zhangneo-edimar-cardosoneo-edimar-cardosorajanatneorajanatneoneo-rameez-virjineo-rameez-virjineo-colin-hanlon-dearmanneo-colin-hanlon-dearmanalejandrogarbialejandrogarbimatt-armstrongmatt-armstrongleah-is-offlineleah-is-offlineannakumovaannakumovajimi487jimi487neo-tamika-taylorneo-tamika-taylorsamin_farajiansamin_farajianmahtab.khanmahtab.khanniloofarshsniloofarshsneo-julio-falboneo-julio-falboiansuiansu

Keywords

Readme

Config Dug

Config Management library for Node.js

Config Dug logo

Major features

  • Strongly typed config object
  • Specify config schema with Zod
    • Support for many data types including: string, number, boolean, array, object, enum, date and more
  • Plugin support with included plugins for AWS Secrets Manager and AWS AppConfig
    • Live reloading of config values from plugins
  • Compatible with dependency injection frameworks like tsyringe and InversifyJS
  • Support for CJS and ESM projects

Usage

Installing

npm install config-dug

Basic Usage

import { ConfigDug, z } from 'config-dug';

const schema = {
  logLevel: z.string().default('info'),
};

const config = await ConfigDug.getConfig(schema);

Advanced Usage

import { ConfigDug, z } from 'config-dug';
import { AWSSecretsManagerPlugin } from '@config-dug/plugin-aws-secrets-manager';

const schema = {
  logLevel: z.string().default('info'),
  apiToken: {
    schema: z.string(),
    sensitive: true,
  },
};

const awsSecretsManagerPlugin = new AWSSecretsManagerPlugin({
  secrets: [
    {
      name: 'config-dug-test/config',
      region: 'ca-central-1',
      reloadInterval: '1m',
    },
  ],
});

const configDug = new ConfigDug(schema, { plugins: [awsSecretsManagerPlugin] });

configDug.on('config-loaded', (config) => {
  console.log('config-loaded event received', config);
});

configDug.on('config-reloaded', (config) => {
  console.log('config-reloaded event received', config);
});

await configDug.load();

const getConfig = () => {
  return configDug.getConfig();
};

export { getConfig };

Options

| Name | Type | Default | Description | | ---- | ---- | ------- | ------------| | basePath | string | process.cwd() | The directory to load config files from | | envKey | string | APP_ENV | The environment variable specifying the application environment | | loadConfigFiles | boolean | true | Load config values from config.*.{js|cjs|mjs} files | | loadEnvironment | boolean | true | Load config values from the environment | | plugins | | [] | An array of plugins to load. Plugins are evaluated in order so config values that come from a plugin that is specified later will override config values from plugins specified earlier | | printConfig | boolean | false | Print the resolved config when loaded | | strict | boolean | false | When false config values are preprocessed first to coerce them to the specified type | | warnOnLocalConfigFile | boolean | true | Print a warning when a local config file config.*.local.{js|cjs|mjs} is loaded |

Plugins

  • TODO: Add instructions on using plugins
  • TODO: Add a guide on writing plugins

Plugin Interface

interface ConfigDugPlugin {
  public load(): Promise<UntypedConfig>;
  public reload(): Promise<UntypedConfig>;
}

Plugin Return Value

{
  values: UntypedConfig, // Record<string, unknown>
  valueOrigins: ValueOrigins, // Record<string, string[]>
  nextReloadIn: number | undefined
}

Plugin Lifecycle

flowchart TB
    A[Initialize] --> B
    B[onBeforeLoadConfigFiles] --> C
    C[loadConfigFiles] --> D
    D[onAfterLoadConfigFiles] --> E
    E[onBeforeLoadPlugins] --> F
    F[loadPlugins] --> G
    G[onAfterLoadPlugins] --> H
    H[onBeforeLoadLocalConfigFiles] --> I
    I[loadLocalConfigFiles] --> J
    J[onAfterLoadLocalConfigFiles] --> K
    K[onBeforeLoadEnvironment] --> L
    L[loadEnvironment] --> M
    M[onAfterLoadEnvironment]

Contributing

TODO: Add CONTRIBUTING.md

Credits

v2 was inspired by Zod and znv

v1 was inspired by config3 and config4

License

MIT