npm / @nestjs/config
@nestjs/config
What changed in @nestjs/config 3 to 12, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
22 breaking1 security3 deprecations2 new APIs and options6 behavior and defaults1 tooling4 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@nestjs/config 1235 changes
Breaking changes 20
Property paths resolve only defined own properties and members of your classes; inherited built-in members return undefined, and paths through __proto__, constructor or prototype are ignored.
set() never writes through inherited built-in members, and paths through __proto__, constructor or prototype are ignored.
get('_PROCESS_ENV_VALIDATED') no longer returns the internal snapshot of validated variables.
A re-expanded value longer than 128 KiB throws.
A value containing a NUL character now fails startup instead of being truncated in process.env.
Expanded values are assigned to process.env after validation; multiple env files are expanded once; and with override: true, self-references expand to the previous value.
__proto__ keys returned by a custom parser are ignored.
Validated values take precedence: undefined or schema-removed variables are not restored from process.env, and skipProcessEnv excludes undeclared variables when a validationSchema is used.
When false, a predefined variable takes precedence over a different env-file value, and get() returns it as-is.
Validation errors no longer include rejected values: Joi pattern() messages omit them, and quoted values are replaced with [redacted].
The explicit type parameter is constrained to the value at the given path, so types inconsistent with the config shape fail to compile.
Existing Joi schemas require Joi v18 or later to implement the Standard Schema specification.
The lodash runtime dependency is removed and replaced by es-toolkit; this matters if you relied on lodash being installed transitively.
The peer dependency range is now ^11.0.0 || ^12.0.0; Nest 10 is no longer supported.
The package is published as pure ESM with an exports map; CommonJS apps can continue using require on Node 20.19+ or 22.12+.
Deep imports into build internals are no longer resolvable; import from the package root instead.
Version 12 requires TypeScript 6 as a peer dependency, so include TypeScript 6 when updating the CLI and schematics.
Validation issues are formatted as path: message, with issues separated by newlines, rather than using the schema library's format.
Library-specific validation settings now belong under libraryOptions in the Standard Schema Options object.
Accepts schemas implementing Standard Schema, including Zod, Valibot, ArkType, and Joi 18+; schemas not implementing the spec are compile-time errors.
Deprecations 2
ConfigService.setEnvFilePaths() is deprecated, and ConfigModule.forRoot() no longer uses it.
ConfigService.setParser() is deprecated, and ConfigModule.forRoot() no longer uses it.
New APIs and options 2
When true, values from .env files take precedence over existing process.env variables; the default remains false.
Accepts a function that parses a Buffer into an object, allowing .env files in formats such as YAML, TOML, or JSON; it is used at bootstrap and during variable re-interpolation.
Behavior and default changes 6
The promise waits until every forRoot() in progress has loaded its environment variables.
A second validated forRoot() no longer replaces the converted values of another one.
ConfigService from a plain imports: [ConfigModule] or ConfigModule.forFeature() is provided after forRoot() has merged its load factories.
Changing a key re-expands dependent variables, including chains, from startup-loaded definitions without rereading env files; earlier set() values and environment-set variables are kept.
validate may be an async function; a rejected promise stops startup.
The option now accepts any Standard Schema-compatible schema, including schemas from Zod, Valibot, and ArkType, rather than being tied to Joi.
Tooling 1
Run this command if a peer dependency conflict is caused by older ts-jest or typescript-eslint releases that do not accept TypeScript 6.
Fixes and other changes 4
ConfigService.set() re-expansion honors the expandVariables.processEnv target.
override: true takes precedence when expanding variables.
Prevents prefix corruption and escapes propertyPath during environment interpolation updates.
Variables omitted by object schemas are merged back into the validated result, keeping unrelated variables reachable through process.env and ConfigService.
@nestjs/config 43 changes
Breaking changes 1
Configuration lookup now checks internal configuration first, then validated environment variables, then process.env; internal configuration takes precedence over environment variables.
Security 1
Prevents ConfigService#get from accessing process.env entirely, allowing applications to restrict direct environment-variable access.
Deprecations 1
The ignoreEnvVars option is deprecated; use validatePredefined set to false to disable validation of predefined environment variables.
@nestjs/config 31 changes
Breaking changes 1
The unused encoding option was removed from the interfaces.