@nestjs/config

The official NestJS configuration module for loading, validating, and injecting environment variables.

Library
npm
v12.0.1
592 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
85 /100 Excellent
Development Activity 96
Maintenance 96
Community 60
Maturity 60
Momentum 28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
77 /100 Good
Architecture 78
Code Quality 80
Innovation 65
Learning Curve 85

@nestjs/config is the official configuration module for the NestJS framework. It wraps the widely-used dotenv package to load environment variables from .env files and process.env, then exposes them through an injectable ConfigService that integrates with Nest’s dependency injection system.

The module supports namespaced and custom configuration factories, schema validation (via Joi or class-validator), variable expansion through dotenv-expand, and both global and feature-scoped configuration registration, making it the standard way NestJS applications manage environment-driven settings across different deployment environments.

What You Get

  • An injectable ConfigService for type-safe access to configuration values throughout the application
  • ConfigModule.forRoot()/forFeature() for global and namespaced configuration registration
  • Built-in dotenv and dotenv-expand support for loading and interpolating .env files
  • Schema validation hooks for Joi or class-validator to fail fast on misconfigured environments
  • Conditional module loading via ConditionalModule based on environment variable presence
  • Custom configuration factories for grouping related settings into namespaced objects

Common Use Cases

  • Loading environment-specific settings (database URLs, API keys, ports) into a NestJS app
  • Validating required environment variables at startup so misconfiguration fails immediately
  • Sharing typed configuration namespaces across multiple feature modules
  • Conditionally registering modules based on which environment variables are present

Under The Hood

Architecture - The module centers on ConfigModule (config.module.ts) which registers a ConfigHostModule providing the underlying key-value store, and ConfigService (config.service.ts) which exposes get()/getOrThrow() methods with type inference; ConditionalModule (conditional.module.ts) allows conditionally importing modules based on env var presence. Tech Stack - Built in TypeScript on top of dotenv and dotenv-expand for environment loading and variable interpolation, with es-toolkit for utility functions; peer dependencies on @nestjs/common and @nestjs/core tie it directly into Nest’s DI container, and optional peers on joi and class-validator support schema validation. Code Quality - The tests/ directory contains 25 TypeScript test files covering module registration, service resolution, and validation paths, run via Vitest; the project uses oxlint for linting and enforces commit conventions via commitlint and husky pre-commit hooks. API Design - The API follows Nest’s conventional forRoot()/forFeature() static module pattern familiar to any Nest developer, minimizing the learning curve; ConfigService.get<T>() provides generic type inference for typed config namespaces, and the official docs site provides a dedicated configuration tutorial.

Used by 17 apps in this directory

TypeScript
98%
Other

Novu

Developer Tools

40,195

Open-source communication infrastructure that connects your products and AI agents to every channel your users live on — Inbox, Email, SMS, Push, Chat, and more.

View details
93
Repo Health
80
Technical
64
Dependency
Built with
TypeScript 98%
Updated 6 days ago
TypeScript
96%
Apache 2.0

Pezzo

AI Development · Monitoring

3,278

Open-source LLMOps platform for prompt management, AI observability, intelligent caching, and real-time cost tracking across LLM providers.

View details
59
Repo Health
75
Technical
66
Dependency
Built with
TypeScript 96%
Updated 2 months ago
TypeScript
96%
Other

Refly

AI Development · Automation · No Code Platforms

7,537

Build deterministic, versioned agent skills from natural language—run them anywhere from Claude Code to Slack.

View details
68
Repo Health
76
Technical
63
Dependency
Built with
TypeScript 96%
Updated 1 weeks ago
TypeScript
97%
AGPL 3.0

Swetrix

Analytics

1,213

Privacy-first, cookieless web analytics with error tracking, session replays, and performance monitoring — self-host or use Cloud.

View details
87
Repo Health
71
Technical
66
Dependency
Built with
TypeScript 97%
Updated 1 weeks ago
TypeScript
99%
Other

Teable

Databases · No Code Platforms

21,920

A no-code PostgreSQL database with spreadsheet UX, real-time collaboration, and native AI agents — built for teams that outgrow Airtable.

View details
78
Repo Health
76
Technical
62
Dependency
Built with
TypeScript 99%
Updated 1 weeks ago
HTML
68%
AGPL 3.0

ToolJet

AI Agents · Low Code Platforms · No Code Platforms

41,123

Open-source AI-native platform to build and deploy internal tools, workflows, and AI agents with a visual drag-and-drop builder and 80+ data source integrations.

View details
94
Repo Health
81
Technical
63
Dependency
Built with
HTML 68%
JavaScript 20%
Updated 6 days ago
TypeScript
79%
MIT

Trench

Analytics · Data Engineering · Monitoring

1,665

Open-source event tracking infrastructure built on Kafka and ClickHouse that handles thousands of events per second on a single node, with full Segment API compatibility and no cookies.

View details
44
Repo Health
81
Technical
73
Dependency
Built with
TypeScript 79%
MDX 15%
Updated 6 months ago
TypeScript
84%
Other

twenty

CRM

59,615

The open-source CRM you build, ship, and version like the rest of your stack — with customizable objects, AI agents, and a TypeScript SDK.

View details
92
Repo Health
82
Technical
64
Dependency
Built with
TypeScript 84%
MDX 14%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers