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

mono-config

v1.0.2

Published

The `mono-config` package provides a simple way to share and manage configuration across your monorepo. We wrap the commonly used [config](https://www.npmjs.com/package/config) package to provide additional functionality, specifically for monorepos.

Readme

mono-config

The mono-config package provides a simple way to share and manage configuration across your monorepo. We wrap the commonly used config package to provide additional functionality, specifically for monorepos.

Installation

npm install mono-config

Usage

Config

First, import the config object from mono-config:

import { config } from "mono-config";

There are two main ways to use this config object to access your configuration values:

Without validation

You can get the configuration value by providing the path for your configurations:

const value = config.get("settings.db.host");

With validation

The config object allows you to ensure configuration values are meet certain criteria using Zod schemas.

First, define your schema:

import { z } from "zod";

const firstAppSchema = z.object({
  name: z.string(),
  db: z.object({
    host: z.string(),
    port: z.number(),
    user: z.string(),
    password: z.string(),
  }),
});

Now, you can get and validate your configuration values:

const firstAppConfig = config.get("first_app", firstAppSchema);

If the value of the first_app configuration does not meet the schema, an error with a detailed explanation will be thrown.

ConfigManager

This class will help ou manage your configurations accross microservices in your monorepo. Import the ConfigManager class from mono-config:

import { ConfigManager } from "mono-config";

Let's assume your monorepo configuration looks like this:

{
  "first_app": {
    "name": "First App",
    "port": 3000,
    "db": {
      "host": "localhost",
      "port": 5432,
      "user": "user",
      "password": "password"
    }
  },
  "second_app": {
    "name": "Second App",
    "port": 3001
  }
}

Create the corresponding Zod schema for each configuration (property / microservice) you want to validate and manage:

const firstAppSchema = z.object({
  name: z.string(),
  port: z.number(),
  db: z.object({
    host: z.string(),
    port: z.number(),
    user: z.string(),
    password: z.string(),
  }),
});

const secondAppSchema = z.object({
  name: z.string(),
  port: z.number(),
});

Then, create a ConfigManagerMap to associate each schema with it's configuration path:

const cmm = {
  firstApp: {
    path: "first_app", // The key in the config JSON
    schema: firstAppSchema, // The schema to validate the configuration (optional)
  },
  secondApp: {
    path: "second_app",
    schema: secondAppSchema,
  },
} as const; // This is important to ensure the type safety

Next, create a new instance of ConfigManager:

const configManager = new ConfigManager(cmm);

Tada :tada:, you can now access your configurations using the configManager object!

const firstAppName = configManager.get("firstApp").name; // Strongly typed!

ConfigManager Optional Options

This is the list of optional options you can pass to the ConfigManager constructor:

| Option | Description | Default | | ----------------------- | ----------------------------------------------------------------------------------- | ------- | | exitOnValidationError | If set to true, the process will exit if a configuration does not meet the schema | false |

Raw Configuration

You can still access the raw configuration object by importing the raw object from mono-config:

import { raw } from "mono-config";