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

@cookiemonsterdev/kafka-config

v1.4.2

Published

Generic config-file loader — discovery, sync/async loading, TypeScript transform rescue, layer merging, and diagnostics. Zero runtime dependencies.

Readme

@cookiemonsterdev/kafka-config

Finds and loads a project's <name>.config.* file — think the same idea as eslint.config.js or vite.config.ts, but generic enough for you to point at your own app's name. It's a zero-runtime- dependency loader that handles discovery, sync/async loading, a TypeScript transform rescue, layer merging, and diagnostics. It has no knowledge of Kafka, or of any other specific consumer — that knowledge is injected via four extension points (below).

This package is what @cookiemonsterdev/kafka-core uses to load kafka.config.ts (through Kafka.fromConfig() and new Kafka()), and what @cookiemonsterdev/kafka-cli and the studio build on. It's published on its own so anything else can build the same kind of config-file layer without depending on the rest of this workspace. See the docs for the full API reference.

Install

npm install @cookiemonsterdev/kafka-config

Runs on Node.js 24 or newer and on Bun 1.4 or newer. See Bun for what differs on Bun.

Quick example

import { createDefineConfig, discoverConfigFile, loadConfigFileAsync } from '@cookiemonsterdev/kafka-config';

interface AppConfig {
  server?: { port?: number };
}

const { defineConfig, assertValid } = createDefineConfig<AppConfig>({ objectSections: ['server'] });

// app.config.ts
export default defineConfig({ server: { port: 4000 } } satisfies AppConfig);

// elsewhere
const path = discoverConfigFile({ cwd: process.cwd(), name: 'app' });
const config = path == null ? {} : await loadConfigFileAsync<AppConfig>(path, { assertValid });

What's exported

  • discoverConfigFile, CANDIDATE_EXTENSIONS — find a <name>.config.* / .config/<name>.* file.
  • loadConfigFileAsync — load and validate one, once resolved, via dynamic import().
  • loadConfigFileSync — deprecated; the synchronous, require()-based loader. It still works, but use loadConfigFileAsync.
  • createDefineConfig — build a defineConfig + assertValid pair for your own config shape.
  • mergeConfigLayers — merge two config layers with undefined-is-absent semantics.
  • KafkaConfigError, KafkaConfigRequiresAsyncError — typed, .name-matchable errors. Match by .name, not instanceof — if your project ends up with two installed copies of this package, the classes are distinct objects even though the errors behave identically.
  • defaultOnConfigDiagnostic, ConfigDiagnostic, OnConfigDiagnostic — the diagnostics channel every discovery/load function accepts.
  • installConfigTransformHooks, areConfigTransformHooksInstalled — deprecated; the sync loader's TypeScript transform rescue (extensionless imports, export default under a CommonJS-resolved file; never enums). loadConfigFileAsync has no rescue: those constructs fail with an error naming the fix.

On Bun, require() and import() load TypeScript natively, so the transform rescue is never needed (installConfigTransformHooks() is a no-op returning false). A config that uses top-level await also loads through the sync loader there.

Despite the package name, none of this is Kafka-specific — the name reflects where it was extracted from, not a Kafka dependency.

Development

From the repo root:

pnpm --filter @cookiemonsterdev/kafka-config build
pnpm --filter @cookiemonsterdev/kafka-config test
pnpm --filter @cookiemonsterdev/kafka-config typecheck

See the root CONTRIBUTING.md for the full workspace workflow.

License

MIT © Mykhailo Toporkov