Skip to content

dotenv-run

One way to load .env environment variables — across Angular, the CLI, Node.js and every major bundler. Built for monorepos.

dotenv-run is a small family of packages that load environment variables from .env files the same way everywhere — in the terminal, in Node.js and inside your bundler. Configuration stays out of your codebase, exactly as the twelve-factor app recommends.

Start here

Angular · @ngx-env/builder The most popular way to use .env in Angular. ng add and you're done.
CLI · @dotenv-run/cli Run any command with your .env variables loaded: dotenv-run -- npm start.
Core · @dotenv-run/core The programmatic API that powers every integration. Build your own.
Monorepo Setup ✨ Cascading .env files across Nx / Turborepo workspaces.

Why dotenv-run

Angular-first

@ngx-env/builder injects NG_APP_* variables into Angular apps with zero config — Webpack and esbuild builders, templates and index.html included.

Monorepo ✨

.env files cascade from the workspace root down to each app, so shared config lives in one place. Works with Nx and Turborepo.

One API everywhere

CLI, Node.js, Vite, Webpack, Rollup and esbuild all share the same options and the same .env loading rules.

Expand & prioritize

Reference variables inside variables (API_URL=$API_BASE/users) and layer .env.production over .env with predictable loading priorities.

TypeScript & ESM

Typed process.env and import.meta.env, with full ESM support.

Secure by default

Filter which variables are exposed to the client with a prefix or regular expression.