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

wtfconfig

v2.0.1

Published

A hierarchical configuration management library for Node.js applications that supports YAML files, environment variables, and Zod schema validation.

Readme

WtfConfig

A hierarchical configuration management library for Node.js applications that supports YAML files, environment variables, and Zod schema validation.

Features

  • Hierarchical configuration loading with environment-specific overrides
  • Zod schema validation for configuration files with full type inference
  • Variable replacement with configurable placeholders
  • Multiple configuration sources: files, environment variables, and runtime configuration
  • TypeScript support with automatic type inference from Zod schemas

Installation

npm install wtfconfig zod

Usage

import { WtfConfigContainer } from 'wtfconfig'
import { z } from 'zod'

// Define your configuration schema with Zod
const ConfigSchema = z.object({
  database: z.object({
    host: z.string(),
    port: z.number(),
    name: z.string(),
  }),
  server: z.object({
    port: z.number().default(3000),
    host: z.string().default('localhost'),
  }),
})

// Initialize with root directory and Zod schema
const configContainer = new WtfConfigContainer(
  process.cwd(),
  ConfigSchema,
  './config', // optional config directory
)

// Get configuration - type is automatically inferred from schema
const config = configContainer.getConfig()

// TypeScript knows the exact shape:
console.log(config.database.host) // string
console.log(config.server.port) // number

Configuration Loading Order

The library loads configuration files in the following priority order (later files override earlier ones):

  1. default.yaml
  2. default-{NODE_APP_INSTANCE}.yaml (if NODE_APP_INSTANCE is set)
  3. {environment}.yaml (e.g., develop.yaml, production.yaml)
  4. {environment}-{NODE_APP_INSTANCE}.yaml (if NODE_APP_INSTANCE is set)
  5. local.yaml
  6. local-{environment}.yaml
  7. local-{NODE_APP_INSTANCE}.yaml (if NODE_APP_INSTANCE is set)
  8. Environment variable NODE_CONFIG (JSON format)

Environment Variables

  • NODE_ENV: Determines which environment-specific config files to load (default: 'development')
  • NODE_APP_INSTANCE: Used for instance-specific configuration files
  • BASE_DIR: Override the base directory for the application
  • CONFIG_DIR: Override the configuration directory path
  • CONFIG_RC: Path to the configuration settings file (default: .configrc)
  • NODE_CONFIG: JSON configuration to merge at runtime

Configuration Settings File

Create a .configrc file in your project root to customize paths:

{
  "baseDirFromSettings": "/path/to/base",
  "configDirFromSettings": "/path/to/config"
}

Variable Replacement

Use [$basedir] in your YAML files to reference the base directory:

database:
  path: '[$basedir]/data/app.db'

Development

Setup

make install

Build

make build

Test

make test

Lint

make lint

Requirements

  • Node.js >= 22

License

MIT