NestJS 11 · Controllers, providers and modules

Load configuration

Make environment variables available everywhere, then inject ConfigService.

ConfigModule.forRoot({ isGlobal: true })

// in a service
constructor(private config: ConfigService) {}
const port = this.config.get<number>('PORT', 3000);

Official NestJS 11 documentation

More controllers, providers and modules commands

All controllers, providers and modules commands · NestJS 11 cheatsheet

Was this page helpful?