dotenvx encrypts secrets in .env files, lets you commit ciphertext safely, and injects decrypted values at runtime via CLI, similar to dotenv with secp256k1 encryption.
Overview
dotenvx is a CLI and tooling layer for managing environment secrets in .env files. It extends familiar dotenv usage by encrypting values into ciphertext that can live in git while decryption keys stay on runtime infrastructure.
The design combines git for distribution, .env for how apps load configuration, and secp256k1 asymmetric encryption so private keys on servers unlock secrets just in time. Workflows cover local development, encrypted commits, and production deploys with DOTENV_PRIVATE_KEY set in the environment.
Install options include npm, curl, Homebrew, Docker, GitHub releases, and Windows packages. Guides cover TypeScript, Next.js, Astro, Expo, Python, PHP, Ruby, Go, Rust, Docker, GitHub Actions, and integrations that redact secrets when running Claude, Codex, or Cursor.
Additional features include multi-environment files with -f, variable expansion from the host environment, command substitution in values, and resolution hooks for 1Password and Bitwarden.
Key features
- Encrypt and decrypt .env values
- Commit ciphertext with application code
- Runtime injection via dotenvx run
- Multi-environment env file flags
- Framework and CI quickstarts
- 1Password and Bitwarden resolution
- Agent redaction guides
Use cases
- Sharing secrets through git safely
- Consistent env loading in CI and prod
- Encrypted local dev with team keys