Encrypt
dotenvx encryptInstall and use it in code just like dotenv.
require('@dotenvx/dotenvx').config()
// or import '@dotenvx/dotenvx/config' // for esm
console.log(`Hello ${process.env.HELLO}`)
npm install @dotenvx/dotenvx --save
Commit encrypted secrets to git while keeping decryption keys separate.
Dotenvx encrypts each secret individually using ECIES public-key encryption. Encrypted .env files can be safely committed to Git while decryption keys remain separate.
Keep the simplicity of .env files while adding encryption, auditing, and rotation.
dotenvx encryptdotenvx run -- your-command$ dotenvx run -- npm start ⟐ injecting env (14) from .env
dotenvx run -f .env.productiongit diff .env*dotenvx rotateA message from the creator of dotenv and dotenvx.
Developers use environment files because they are simple.
They work everywhere: local development, CI, containers, servers, and cloud platforms. They became part of modern software because they reduced friction instead of adding to it.
But simplicity came with a cost. Plaintext secrets spread quietly across laptops, repositories, CI systems, chat messages, screenshots, and production machines.
We believe the answer is not abandoning environment files. The answer is securing them properly.
Dotenvx extends the environment file workflow with encryption, auditing, rotation, and runtime injection while preserving the simplicity that made .env successful in the first place.
As software becomes increasingly autonomous, secrets become increasingly valuable. API keys, credentials, tokens, and signing keys are now operational infrastructure. They deserve stronger protection.
That is what we are building with Dotenvx.
- Scott Motte
Creator of dotenv and dotenvx
Developers are installing dotenvx 6.5 million times a week on npm to secure local development, CI, cloud infrastructure, and software agents.
Ben Holmes
@BHolmesDev
dotenvx is really smart concept.
Instead of plaintext .env’s, secrets are encrypted files. Agents can't read them, and they're shippable to cloud runners with a single key.
コムテ
@commte
Show translation
.env 共有は dotenvxが最強 .env を暗号化したまま Git にコミットできるツール 便利さそのまま+漏洩リスクほぼゼロ ・平文 .env を配らなくていい ・GitHub に上げても解読されない ・チーム開発で共有がラク
Kristian Freeman
@kristianfreeman
Dotenvx looks like an interesting upgrade to .env Automatic encrypting of each value, almost identical usage in CLI and API Rails does something similar - though the whole file is encrypted!
mizchi
@mizchi
Show translation
.env とAIの問題、dotenvx がもっと普及したらいいと思う
Zaid
@zaidmukaddam
you can deploy env files to prod now? creators of dotenv have been working on dotenvx which encrypts your env variables so llms can’t read them, basically it keeps secrets from leaking into prompts or model context
Kenn Ejima
@kenn
Show translation
今まで1passwordで.envを共有してたけど、dotenvxを使えば.env自体を暗号化してgit管理できるようになることを知ってこれに乗り換えることにした。 管理対象が秘密鍵1個だけになるのでメンバーの入れ替わりなどでAPI Keyを個別にローテーションする手間もなくなる。 時代は進化している!