# @dotenv-run/core

> core library to load environment variables with monorepo support

Latest version **1.3.8** (published 2025-07-15) · ISC license · 0 weekly downloads

## Install

```sh
npm install @dotenv-run/core
pnpm add @dotenv-run/core
yarn add @dotenv-run/core
bun add @dotenv-run/core
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.8 |
| Published | 2025-07-15 |
| First published | 2023-06-03 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 45.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Chihab Otmani |
| Maintainers | chihab |
| Keywords | dotenv, run, cli |

## Links

- npm: https://www.npmjs.com/package/@dotenv-run/core
- Homepage: https://github.com/chihab/dotenv-run
- npm.io page: https://npm.io/package/@dotenv-run/core

## Dependencies (4)

- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [dotenv](https://npm.io/package/dotenv.md) ^16.4.5
- [find-up](https://npm.io/package/find-up.md) ^5.0.0
- [dotenv-expand](https://npm.io/package/dotenv-expand.md) ^10.0.0

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.3.8 (latest) — 2025-07-15
- 1.3.7 — 2025-06-28
- 1.3.6 — 2024-10-13
- 1.3.5 — 2024-03-31
- 1.3.4 — 2024-01-13
- 1.3.3 — 2024-01-11
- 1.3.2 — 2024-01-10
- 1.3.1 — 2024-01-10
- 1.3.0 — 2024-01-07
- 1.2.3 — 2023-11-22
- 1.2.2 — 2023-11-16
- 1.2.1 — 2023-11-13
- 1.2.0 — 2023-10-25
- 1.1.0 — 2023-08-27
- 1.0.0 — 2023-07-29
- … 7 more at https://npm.io/package/@dotenv-run/core/versions

## README

# @dotenv-run/core

- ✅ Load environment variables from the command line `API_BASE=/v1/ core`
- ✅ Load environment variables from `.env` files
- ✅ Expand environment variables `API_URL=$API_BASE/users`
- ✅ Define environment variables for a specific environment (e.g. `.env.production`)
- ✅ Load priorities of `.env.*` files (e.g. `.env.production` > `.env`)
- ✅ Hierarchical cascading configuration in monorepo projects ([Nx](https://nx.dev), [Turbo](https://turborepo.com/), etc.)
  `apps/next-app/.env` > `apps/.env` > `.env`

# Install

```console
npm add @dotenv-run/core
```

# Usage

```js
// index.js
import { env } from "@dotenv-run/core";
env({
  root: "../..",
  verbose: true,
  prefix: "^API_",
  files: [".env"],
});
console.log(process.env.API_USERS);
```

given the following files:

```shell
.env
    API_USERS=$API_BASE/v1/users
    API_AUTH=$API_BASE/v1/auth
.env.dev
    API_BASE=https://localhost:3000
.env.prod
    API_BASE=https://dotenv-run.app
```

then:

```shell
NODE_ENV=dev node index.js
https://localhost:3000/v1/users

NODE_ENV=prod node index.js
https://dotenv-run.app/v1/users
```

# License

MIT © [Chihab Otmani](mailto:chihab@gmail.com)

---
_Source: https://npm.io/package/@dotenv-run/core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
