Skip to content

NestJS

Wrap your start scripts with hushenv run:

{
"scripts": {
"start:dev": "hushenv run -- nest start --watch",
"start:prod": "hushenv run -- node dist/main.js"
}
}

hushenv populates process.env before Nest boots, so ConfigModule reads the values from there. If you use @nestjs/config, you can tell it not to load an env file itself, since hushenv has already done the injection:

ConfigModule.forRoot({ isGlobal: true, ignoreEnvFile: true });

Keep ConfigModule for validation and typed access if you like — only the file loading is now hushenv’s job.