API Reference

convict

Featureful configuration management with a schema, validation, and environment variable overrides.

Official Documentation ↗
CompatibilityThis documentation covers version v6. Check the official docs for the latest API surface.

Installation

npmnpm install convict

Methods

convict declares a typed schema, validates loaded values, and documents each option in one place.

Key Features

  • Schema with types, defaults, and enums
  • Validation with clear failure messages
  • env and arg override mapping

Usage Notes

Pin a version and check the official docs for the API surface you depend on before upgrading.

FAQ

Why declare a schema?
The schema documents every option, supplies defaults, and turns type mismatches into startup errors instead of runtime surprises.
How do environment variables map in?
Set env on each attribute to the variable name; convict reads it during load and validates the resulting value.
What does allowed strict do?
Strict validation rejects unknown keys and values outside enums, catching typos early at boot rather than later in production.