@nestjs/config

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

Library
npm
v4.0.4
587stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
86/100Excellent
Development Activity100
Maintenance96
Community60
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
77/100Good
Architecture78
Code Quality80
Innovation65
Learning Curve85

@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
72%
AGPL 3.0

APITable

Low Code Platforms · Databases

15,526

API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.

View details
53
Repo Health
77
Technical
60
Dependency
Built with
TypeScript72%
Java22%
Updated 9 months ago
TypeScript
96%
Other

Amplication

Developer Tools · AI Code Assistants · Automation

16,010

Create production-ready backend services with your organization's standards baked in — generating NestJS, Prisma, and GraphQL code that you own and control.

View details
61
Repo Health
84
Technical
60
Dependency
Built with
TypeScript96%
Updated 1 months ago
TypeScript
97%
AGPL 3.0

Bigcapital

Invoicing Finance

3,846

Self-hostable double-entry accounting platform with invoicing, inventory, multi-currency, and real-time financial reporting for small and medium businesses.

View details
91
Repo Health
77
Technical
64
Dependency
Built with
TypeScript97%
Updated yesterday
TypeScript
96%
Other

Cal.diy

Scheduling

47,796

The 100% MIT-licensed, community-driven scheduling platform — self-host your own booking infrastructure with no enterprise strings attached.

View details
93
Repo Health
86
Technical
66
Dependency
Built with
TypeScript96%
Updated 1 weeks ago
TypeScript
95%
AGPL 3.0

Docmost

Productivity · Note Taking · Collaboration

21,411

Self-hosted collaborative wiki and knowledge base with real-time editing, diagrams, AI assistance, and enterprise access controls — a modern alternative to Confluence and Notion.

View details
89
Repo Health
70
Technical
71
Dependency
Built with
TypeScript95%
Updated yesterday
TypeScript
74%
AGPL 3.0

Ghostfolio

Invoicing Finance

9,153

Track your stocks, ETFs, and crypto with a privacy-first, self-hostable wealth management platform built for data-driven investors.

View details
93
Repo Health
79
Technical
71
Dependency
Built with
TypeScript74%
HTML23%
Updated yesterday
TypeScript
67%
MIT

Hoppscotch

Developer Tools

80,055

A lightweight, offline-capable API development ecosystem for testing HTTP, GraphQL, WebSocket, MQTT, and SSE endpoints across web, desktop, and CLI.

View details
91
Repo Health
83
Technical
66
Dependency
Built with
TypeScript67%
Vue23%
Updated 3 days ago
TypeScript
94%
AGPL 3.0

Laudspeaker

Marketing · Automation

2,618

Open-source customer engagement platform for building visual, event-triggered messaging journeys across email, SMS, push, in-app, and webhooks.

View details
53
Repo Health
66
Technical
64
Dependency
Built with
TypeScript94%
Updated 1 months ago
TypeScript
64%
Other

NocoDB

No Code Platforms · Databases · Low Code Platforms

64,586

Turn any SQL database into a collaborative no-code spreadsheet with automatic REST APIs and real-time views.

View details
91
Repo Health
77
Technical
64
Dependency
Built with
TypeScript64%
Vue31%
Updated today

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

Search