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

@supernal/hydra-config

v1.0.1

Published

Hydra-style hierarchical YAML configuration with composition, patterns, and deep merge

Readme

Hydra Config

Hydra-style hierarchical YAML configuration with composition, patterns, and deep merge for JavaScript.

npm version npm downloads CI License: MIT

Why Hydra Config?

Inspired by Facebook's Hydra for Python, this library brings powerful configuration composition to JavaScript projects.

Features

  • 🔄 Composable: Build configs from reusable patterns
  • 📊 Hierarchical: Define defaults, override as needed
  • 🔍 Type-Safe: Optional schema validation
  • 🎯 Framework-Agnostic: Works with any JS project
  • 🪶 Lightweight: Only requires yaml and fs-extra
  • 💪 Battle-Tested: Used in production by Supernal Coding

Installation

npm install @supernal/hydra-config

Quick Start

const { ConfigLoader } = require('@supernal/hydra-config');

const loader = new ConfigLoader({
  searchPaths: [
    './config/patterns', // Your patterns
    './node_modules/@supernal/hydra-config/patterns', // Default patterns
  ],
});

const config = await loader.load('./config/project.yaml');
console.log(config);

Usage

Basic Configuration

# config/project.yaml
project:
  name: 'my-app'
  version: '1.0.0'

database:
  host: 'localhost'
  port: 5432

Composition with Defaults

# config/project.yaml
defaults:
  - base: production
  - database: postgres
  - cache: redis
  - _self_ # Apply user overrides last

project:
  name: 'my-app' # Override from patterns

database:
  host: 'custom-host' # Override specific values

Pattern Files

# config/patterns/database/postgres.yaml
database:
  type: 'postgres'
  host: 'localhost'
  port: 5432
  ssl: true
  pool:
    min: 2
    max: 10

API Reference

ConfigLoader

Main class for loading and resolving configurations.

const loader = new ConfigLoader(options);

Options:

  • searchPaths (Array): Directories to search for patterns
  • cache (Map): Optional cache instance

Methods:

load(configPath)

Load and resolve a configuration file.

const config = await loader.load('./config/project.yaml');

get(configPath)

Get configuration (uses cache if available).

const config = await loader.get('./config/project.yaml');

clearCache()

Clear the configuration cache.

loader.clearCache();

Error Classes

  • YAMLSyntaxError: Invalid YAML syntax
  • PatternNotFoundError: Referenced pattern not found
  • CircularDependencyError: Circular dependency in defaults

Advanced Features

Deep Merge Strategies

# Append arrays (default)
features: [auth, admin]

# Replace arrays
features:
  __replace__: true
  values: [public-only]

Pattern Search Paths

Patterns are searched in order:

  1. User patterns (first in searchPaths)
  2. Shipped patterns (later in searchPaths)

This allows users to override default patterns.

Circular Dependency Detection

The system automatically detects and reports circular dependencies:

CircularDependencyError: Circular dependency detected
  base → db-config → advanced → base

Examples

See the examples/ directory for complete working examples:

Comparison to Other Solutions

| Feature | Hydra Config | config | convict | rc | | -------------- | ------------ | ------ | ------- | ----- | | YAML Patterns | ✅ | ❌ | ❌ | ❌ | | Composition | ✅ | ❌ | ❌ | ❌ | | Deep Merge | ✅ | ⚠️ | ❌ | ⚠️ | | Search Paths | ✅ | ❌ | ❌ | ⚠️ | | Error Messages | ✅ Rich | Basic | Basic | Basic |

Contributing

Contributions welcome! Please read CONTRIBUTING.md first.

License

MIT - See LICENSE for details.

Credits

Inspired by Hydra by Facebook Research.

Built and maintained by Supernal Intelligence.