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

@zamatica/configuration

v0.1.1

Published

Framework-agnostic runtime configuration registry with builder-pattern parameter definitions, layered resolution (CLI > env > default), directory access checks, and Zod-validated YAML.

Downloads

479

Readme

@zamatica/configuration

Framework-agnostic runtime configuration for TypeScript apps. Static-method service, builder-pattern parameter definitions, layered resolution (CLI > env > default), directory access checks, and Zod-validated YAML.

Designed to be available before any framework (NestJS, Express, etc.) is bootstrapped — no DI container required.

Install

bun add @zamatica/configuration

Quick example

import {
  Configuration,
  ConfigurationParameter,
  ConfigurationService,
} from '@zamatica/configuration';
import { z } from 'zod';

@Configuration(
  'MyApp',
  ConfigurationParameter.named('PORT')
    .number()
    .default(8080)
    .description('HTTP listen port')
    .required()
    .build(),
  ConfigurationParameter.named('CONFIG_DIR')
    .directory()
    .default('/etc/myapp')
    .createIfMissing()
    .build(),
  ConfigurationParameter.named('SERVICES')
    .yaml()
    .schema(z.object({ services: z.array(z.string()) }))
    .default('services.yaml')
    .build(),
)
class MyApp {
  static async start() {
    ConfigurationService.setAppEnvVarPrefix('MYAPP');
    ConfigurationService.initialize(); // throws if any required is missing

    const port = ConfigurationService.get<number>('PORT');
    const dir = ConfigurationService.resolveDirectory('CONFIG_DIR');
    const services = ConfigurationService.resolveYaml<{ services: string[] }>('SERVICES');
    /* ... */
  }
}

Resolution priority

For each registered parameter, ConfigurationService.get() consults:

  1. CLI argument — set externally via ConfigurationService.setCliArgs({...}). The argument key is the configuration key in camelCase (PORTport, LOG_LEVELlogLevel).
  2. Environment variable<APP_PREFIX>_<KEY> (e.g. MYAPP_PORT). Set the prefix via setAppEnvVarPrefix(); defaults to empty (bare key) if not set.
  3. Default — declared via .default(value) on the builder.

If a parameter is .required() and none of the above provide a value, get() throws.

Parameter types

  • .string() / .number() / .boolean() — simple primitives. Coerced from the source value (env vars and CLI strings → typed values).
  • .directory() — string-valued; resolveDirectory() performs path resolution (relative paths joined under CONFIGURATION_BASE_DIRECTORY), existence/access checks, and optional createIfMissing()/requireWritable().
  • .yaml() — string-valued (the file path); resolveYaml() reads the file, parses YAML, and validates against the optional Zod schema. With a schema, the return type is narrowed via z.infer<typeof schema>.

Logger

A small ConfigurationLogger interface (debug/info/warn/error). Default implementation is BufferingLogger that holds entries in memory; pass any ConfigurationLogger (e.g. new ConsoleLogger() or a NestJS-bridged logger) to setLogger() and the buffer flushes to it. This makes pre-bootstrap logs available once the real logger comes up.

See also

  • @zamatica/bootstrap — adds commander integration, app metadata, and --generate-dot-env on top of this library.