-1
Daily
5,878
stars
162
forks
11
watchers
594
prs
461
issues
411
releases
README
A secure dotenv–from the creator of dotenv.
Encrypt
Commit
Ship
Install · Quickstart
Quickstart
Install and use it in code just like dotenv.
sh
npm install @dotenvx/dotenvx --save
js
// index.js
require('@dotenvx/dotenvx').config()
// or import '@dotenvx/dotenvx/config' // for esm
console.log(Hello ${process.env.HELLO})
or install globally - unlocks dotenv for any language, framework, or platform!
with npm 🌍
sh
npm i -g @dotenvx/dotenvx
dotenvx encrypt
with curl 🌐
sh
curl -sfS https://dotenvx.sh | sh
dotenvx encrypt
with brew 🍺
sh
brew tap dotenvx/brew
brew trust dotenvx/brew
brew install dotenvx
dotenvx encrypt
with docker 🐳
sh
docker run -it --rm -v $(pwd):/app dotenv/dotenvx encrypt
with github releases 🐙
sh
curl -L -o dotenvx.tar.gz "https://github.com/dotenvx/dotenvx/releases/latest/download/dotenvx-$(uname -s)-$(uname -m).tar.gz"
tar -xzf dotenvx.tar.gz
./dotenvx encrypt
or windows 🪟
sh
winget install dotenvx
dotenvx encrypt
Usage
Install dotenvx.
sh
$ curl -sfS https://dotenvx.sh | sh
◈ installed (2.38.2:/usr/local/bin/dotenvx)
Encrypt your secrets in .env files. The values become ciphertext and only your private key can unlock them.
sh
$ dotenvx encrypt
◈ encrypted .env (039 BCA) via .env.keys ⛉
Commit your encrypted .env files with your code. It's safe. Now you can securely share secrets through git.
sh
$ git add .env
$ git commit -m "encrypt .env"
Ship your code and secrets together. Dotenvx uses your private key to decrypt and inject your secrets just-in-time to your code.
sh
$ dotenvx run -- node index.js
⟐ injected env (2) from .env (039 BCA) via .env.keys ⛉
Design
Three widely used and proven primitives make up Dotenvx's design. Git, .env, and secp256k1.
We chose git because it is the best way to deliver digital goods. It is the container ship of the digital world. All code travels on its ships. Why not secrets? Why invent an inferior secrets delivery mechanism when the world class one is right there at your fingertips.
We chose .env because it is the open standard for loading secrets into code. It represents environment variables, the core primitive that all secrets end up injected into at runtime of code.
Lastly, we needed to choose an encryption algorithm. Encryption of the values inside the .env file would allow us to place those values with code, leveraging git's distribution advantages while still following the twelve-factor config – by separating the decryption key from the code (environment).
It was important that we choose a proven, simple, asymmetric standard with small keys. We chose secp256k1, battle-tested by Bitcoin for more than seventeen years. We made cryptography an opinionated choice so developers wouldn't have to. Encryption just worked.
The result is a system built entirely from primitives, developers already understand, and infrastructure they already use. SecretsTop issues
#700Quoting rules don't match bash5 comments · 2025-11-10#1005Using `decrypt`, existing shell env vars overwrite the encrypted ones3 comments · 2026-10-04#995Community: pi extension that guards .env.keys from AI coding agents2 comments · 2026-09-28#951Environment-name to DOTENV_PRIVATE_KEY_* convention is not reversible (dotted vs underscored filenames collide)2 comments · 2026-08-18#596Backslash is not escaped in double-quotes2 comments · 2025-05-15#1016dotenvx decrypt drops the backslash of \$, so a value with a literal $ changes1 comments · 2026-10-09#1050`dotenvx ext genexample` merges new keys into the last line of `.env.example` when the file has no trailing newline0 comments · 2026-11-03#1017Two dotenvx encrypt runs at once with a shared .env.keys leave one env file undecryptable0 comments · 2026-10-09
Latest release
v2.38.2 v2.38.2 2026-10-20see CHANGELOG