Cz is a minimalistic configuration utility designed for Node.js applications, enabling developers to load, manage, and access configuration settings from files or programmatically. It provides methods for loading configuration files (e.g., JSON), setting default values, and getting/setting specific configuration properties using dot-notation paths. The package's current stable version is 1.8.2, released in early 2017. Due to a lack of updates since then, it is considered abandoned. Key differentiators include its extreme simplicity and reliance on CommonJS patterns, making it suitable for older Node.js projects but not for modern ESM-first environments. It provides basic configuration merging capabilities by applying changes on top of defined defaults, with options to reset the configuration or just its defaults.
npm install czVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to instantiate `Cz`, set initial configuration, define default values, retrieve specific configuration properties using dot notation, and construct a practical connection string using both manual concatenation and `cz`'s `joinGets` helper.
Consider migrating to a actively maintained configuration library like `dotenv`, `config`, or `nconf` for ongoing support and compatibility.
Use `require('cz')` for module imports. If you need ESM compatibility, you will need to use a different library or a CJS-to-ESM wrapper/bundler.Always instantiate `Cz` using `const config = new Cz();` before attempting to use its methods like `config.defaults()` or `config.set()`.
Ensure `const Cz = require('cz');` is at the top of your file to import the class.Correct the import and instantiation: `const Cz = require('cz'); const config = new Cz(); config.defaults({});`Verify the `config.json` file path is correct and the file exists. Use an absolute path or ensure the relative path is correct based on where your script is run.