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

@meltstudio/config-loader

v4.0.3

Published

Type-safe configuration loader with full TypeScript inference. Load from YAML, JSON, TOML, .env, environment variables, and CLI args.

Readme

@meltstudio/config-loader

A type-safe configuration loader for Node.js. Define your schema once, load from YAML, JSON, or TOML files, .env files, environment variables, and CLI arguments — and get a fully typed result with zero manual type annotations.

Upgrading from v1? v1.x is deprecated and no longer maintained. Install the latest version with npm install @meltstudio/config-loader@latest.

Full documentation

Why config-loader?

Most config libraries give you Record<string, unknown> and leave you to cast or validate manually. config-loader infers TypeScript types directly from your schema definition:

import c from "@meltstudio/config-loader";

const config = c
  .schema({
    port: c.number({ required: true, env: "PORT" }),
    host: c.string({ env: "HOST", defaultValue: "localhost" }),
    env: c.string({
      env: "NODE_ENV",
      defaultValue: "development",
      oneOf: ["development", "staging", "production"],
    }),
    apiKey: c.string({ env: "API_KEY", sensitive: true }),
    database: c.object({
      item: {
        host: c.string({ required: true }),
        password: c.string({ env: "DB_PASSWORD", sensitive: true }),
      },
    }),
  })
  .load({
    env: true,
    args: true,
    files: "./config.yaml",
    envFile: "./.env",
  });

// config is fully typed — no `as` casts, no separate interfaces

Features

  • Full type inference — schema definition produces typed output automatically
  • Multiple sources — YAML, JSON, TOML files, .env files, environment variables, CLI arguments
  • Priority resolution — CLI > process.env > .env files > Config files > Defaults
  • .env file support — load environment variables from .env files with automatic line tracking
  • Nested objects and arrays — deeply nested configs with full type safety
  • Structured errors — typed ConfigLoadError with per-field error details and warnings
  • Enum constraints — restrict values to a fixed set with oneOf, with full type narrowing
  • Sensitive fields — mark fields with sensitive: true to auto-mask in printConfig() and maskSecrets()
  • Schema validation — optional per-field validation via Standard Schema (Zod, Valibot, ArkType, or custom)
  • Strict mode — promote warnings to errors for production safety
  • Default values — static or computed (via functions)
  • Multiple files / directory loading — load from a list of files or an entire directory
  • File watchingwatch() reloads config on file changes with debouncing, change detection, and error recovery

Installation

npm install @meltstudio/config-loader
pnpm add @meltstudio/config-loader
yarn add @meltstudio/config-loader

Requires Node.js >= 20.

Watch Mode

Automatically reload config when files change. Watchers use .unref() so they don't prevent the process from exiting.

const watcher = c
  .schema({
    port: c.number({ env: "PORT", defaultValue: 3000 }),
    host: c.string({ defaultValue: "localhost" }),
  })
  .watch(
    { env: true, args: false, files: "./config.yaml" },
    {
      onChange: (newConfig, oldConfig, changes) => {
        for (const change of changes) {
          console.log(
            `${change.path}: ${String(change.oldValue)} → ${String(change.newValue)}`,
          );
        }
      },
      onError: (err) => console.error("Reload failed:", err.message),
    },
  );

// Access current config anytime
console.log(watcher.config.port);

// Stop watching
watcher.close();

Documentation

See the full documentation for:

  • Schema API — primitives, objects, arrays, oneOf, sensitive, validation
  • Loading & Sourcesload(), loadExtended(), watch(), file/env/CLI/.env sources, printConfig(), maskSecrets(), error handling, strict mode
  • TypeScript UtilitiesSchemaValue, exported types, type narrowing

Examples

The example/ directory contains runnable examples:

  • Basic — Schema definition, YAML file loading, nested objects and arrays, CLI arguments
  • Advanced — TOML config, .env files, oneOf constraints, sensitive fields, validation, printConfig(), maskSecrets(), error handling
pnpm example:basic
pnpm example:advanced

Documentation for AI Agents

This project provides machine-readable documentation for AI coding agents at the docs site:

  • llms.txt — structured index of documentation pages
  • llms-full.txt — full documentation in a single Markdown file

These files follow the llms.txt standard and are generated automatically at build time. They are designed to be consumed by AI tools like Claude Code, Cursor, GitHub Copilot, and other LLM-based development assistants.

License

Built by Melt Studio. Licensed under the MIT License.