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

monorepo-config

v0.2.3

Published

Managed and validated configs across packages (no deps, but bring your own zod)

Readme

monorepo-config

Javascript package to help with managing configs, primarily for monorepos. Uses zod to validate.

Basic usage

Always split your config in two parts: one which defines the format/types, and another that actually gets the config data.

First create a config-def.ts file:

import { defineConfig } from "monorepo-config";
import { otherConfigDef } from "some-dependency"; // optional

export const configDef = makeConfig({
  package: 'your-package',
  schema: z.object({
    foobar: z.string(),
  }),
  depedencies: [ otherConfigDef ]
});

In another file config.ts you can do:

import { getConfig } from "monorepo-config";
import { configDef } from "./config-def.ts";

export const config = await getConfig(configDef);

Actually setting the config happens in yet another place. Using setConfig(configDef, { ... }) directly can be tricky because of await-deadlocks. You probably want to use "profiles", as discussed next.

Profile-based usage

Still being worked on! Typescript imports may lead to dependency cycles, which breaks some tools.

This allows you to replace the mess of untyped, unchecked env vars across packages with something more manageable (inspired by Django). You can load the chosen configuration based on a single environment variable like so:

import { loadConfigProfile } from "monorepo-config";
import { configDef } from "./config-def.ts";

export const loader = loadProfileByEnvVar('FOOBAR_CONFIG', (profile) => import(`./${profile}.js`).then(x => x.default))

export const FOOBAR_CONFIG = await loadConfigProfile(configDef, loader);

Profiles are just typescript files like this:

import type { MergeConfigTypes } from "monorepo-config";
import type { configDef } from "./config-def.ts";
import type { otherConfigDef } from "other-package/config-def.ts";

type Config = MergeConfigTypes<[
  typeof configDef, typeof otherConfig, ...
]>;

export default {
  'your-package': {
    foobar: 'quuz'
  },
  'other-config': { ... }
} satisfies Config;

You can split up the above as you wish. You can choose, like the example, to use the same name for the configuration object as the environment variable. The idea is to use the same environment variable for all packages in your monorepo (this mirrors DJANGO_SETTINGS_MODULE).

Which to use?

You can mix both in your monorepo! Packages representing reusable libraries probably want to stick with the basic usage and let other packages define their config. Packages that represent apps probably want to define their own config using profiles.

Common errors

Package name '...' is used for two different config definitions

Your package manager may have included two different copies of the same code. Run pnpm dedupe, or manually inspect your lockfile to verify this. If not, add console.trace() calls to the defineConfig function to figure out exactly where the configs are defined.

TODO

  • [ ] Vite plugin