Convict is a featureful configuration management library for Node.js applications, providing schema-based validation, environment variable support, and command-line argument parsing. Version 6.2.5 is the latest stable release, with a slow release cadence (last release in 2021). Key differentiators include nested schema definitions, strict validation with error reporting, support for JSON5 comments, and the ability to extend with custom formats. Unlike dotenv or node-config, Convict enforces structure and types at load time, reducing runtime configuration errors.
npm install convictNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to define a schema, load an environment-specific config file, and validate the configuration.
Use convinct({ formatters: { ... } }) instead of convict.addFormat().Set validate({ allowed: 'strict' }) only if you want to fail on unknown keys. For tolerant validation use 'warn'.Use -- flag for all command-line arguments (e.g., --port 3000).
Remove convict-format-with-validator and rely on convict's built-in format validators.
For JSON env vars, write a custom format that JSON.parse the value.
Install the package: npm install convict-format-with-validator
Ensure you call convict(schema) and assign it to a variable: const config = convict({...});Ensure the value is a number between 0 and 65535. For environment variables, check the value is set correctly.
Use built-in format 'ipaddress' or add custom format via convict.addFormat() or formats option.
No dependency data recorded yet.