dotenv. better.

a better dotenv–from the creator of GitHub dotenv ★ 18.2k

brew install dotenvx/brew/dotenvx
curl -fsS https://dotenvx.sh/ | sh
Docs

Run Anywhere

dotenvx works the same across every language, framework, and platform – inject your env at runtime with dotenvx run -- your-cmd.

"I like how usage is consistent across multiple languages and frameworks. No more wrestling with different tools."
Max Syntax – Polyglot Programmer
$dotenvx run

Multiple Environments

Create a .env.production file and use dotenvx run -f .env.production to load it. It's straightforward, yet flexible.

"I've always liked the .env.environment pattern. Now it finally has first-class support."
Zara Function – Full-Stack/DevOps Engineer
--env-file

Encryption

Add encryption to your .env files with a single command. Pass the --encrypt flag.

# .env

# Database configuration
DB_HOST="encrypted:BDtEtndvzc2sacliQIbLVSxo2ubscj7dDDAklgxFhugoV+jK9XZbajgvc167U/xtB0CwUBBtd0Gt5sVX3RlQYFozZimWnbZ64eTWQoMeNee8TdEgjmRUV3fkPvw+5jTPkMjssMNL02eN9g==""
DB_PORT=5432
DB_USER="encrypted:BDtEtndvzc2sacliQIbLVSxo2ubscj7dDDAklgxFhugoV+jK9XZbajgvc167U/xtB0CwUBBtd0Gt5sVX3RlQYFozZimWnbZ64eTWQoMeNee8TdEgjmRUV3fkPvw+5jTPkMjssMNL02eN9g==""
DB_PASSWORD="encrypted:BDtEtndvzc2sacliQIbLVSxo2ubscj7dDDAklgxFhugoV+jK9XZbajgvc167U/xtB0CwUBBtd0Gt5sVX3RlQYFozZimWnbZ64eTWQoMeNee8TdEgjmRUV3fkPvw+5jTPkMjssMNL02eN9g==""
DB_NAME="encrypted:BDtEtndvzc2sacliQIbLVSxo2ubscj7dDDAklgxFhugoV+jK9XZbajgvc167U/xtB0CwUBBtd0Gt5sVX3RlQYFozZimWnbZ64eTWQoMeNee8TdEgjmRUV3fkPvw+5jTPkMjssMNL02eN9g==""

# API Keys
API_KEY="encrypted:BDtEtndvzc2sacliQIbLVSxo2ubscj7dDDAklgxFhugoV+jK9XZbajgvc167U/xtB0CwUBBtd0Gt5sVX3RlQYFozZimWnbZ64eTWQoMeNee8TdEgjmRUV3fkPvw+5jTPkMjssMNL02eN9g==""
STRIPE_API_KEY="encrypted:BDtEtndvzc2sacliQIbLVSxo2ubscj7dDDAklgxFhugoV+jK9XZbajgvc167U/xtB0CwUBBtd0Gt5sVX3RlQYFozZimWnbZ64eTWQoMeNee8TdEgjmRUV3fkPvw+5jTPkMjssMNL02eN9g==""

# Email Configuration
EMAIL_HOST="encrypted:BDtEtndvzc2sacliQIbLVSxo2ubscj7dDDAklgxFhugoV+jK9XZbajgvc167U/xtB0CwUBBtd0Gt5sVX3RlQYFozZimWnbZ64eTWQoMeNee8TdEgjmRUV3fkPvw+5jTPkMjssMNL02eN9g==""
EMAIL_USER="encrypted:BDtEtndvzc2sacliQIbLVSxo2ubscj7dDDAklgxFhugoV+jK9XZbajgvc167U/xtB0CwUBBtd0Gt5sVX3RlQYFozZimWnbZ64eTWQoMeNee8TdEgjmRUV3fkPvw+5jTPkMjssMNL02eN9g==""
EMAIL_PASSWORD="encrypted:BDtEtndvzc2sacliQIbLVSxo2ubscj7dDDAklgxFhugoV+jK9XZbajgvc167U/xtB0CwUBBtd0Gt5sVX3RlQYFozZimWnbZ64eTWQoMeNee8TdEgjmRUV3fkPvw+5jTPkMjssMNL02eN9g==""

# Logging
LOG_LEVEL=debug

"Our company was exposed to the CircleCI breach. Encryption would have protected us. We're using it now."
Remy Logic – CTO

10x. better.

Increased tooling and features to make dotenv 10x better.

Run anywhere

Cross-platform–works everywhere

Multi-environment

Switch environments easily

Encrypted envs

Encrypt your envs for deploy

Variable expansion

Add the value of another variable in your .env

Multiple .env files

Compose multiple .env files flexibly

Multi-line values

Add multi-line secrets like public keys

Debug

Debug server and local envs with built-in debugging

Contextual help

Built-in next steps when something goes wrong

Append .gitignore

Append to .gitignore in one command

Generate .env.example

Generate .env.example in one command

Prebuild

Prevent building .env files into docker images

Precommit

Prevent committing .env files to code

Personal envs

Set personal environment variables

Command substitution

Add the output of a command in your .env

Scan

Scan and protect for secrets

Get/Set

Conveniently get/set single variables

Monorepo

First-class monorepo support

Sharing
beta

Securely share envs across your team

From the creator of dotenv. Trusted by millions of developers worldwide.

brew install dotenvx/brew/dotenvx
curl -fsS https://dotenvx.sh/ | sh

Frequently asked questions

A DOTENV_PUBLIC_KEY (encryption key) and a DOTENV_PRIVATE_KEY (decryption key) are generated using the same public-key cryptography as Bitcoin. The DOTENV_PRIVATE_KEY is set on your server or cloud hosting provider and your encrypted .env file is committed safely to code.

Yes. Secp256k1 asymmetric encryption is used in many cryptographically secure technologies like Bitcoin. It would take on the order of billions of years to crack using current technology - similar to AES-256.

In the CircleCI breach the attacker accessed environment variables only. They could not access codebases. To steal your encrypted .env secrets, an attacker needs need both – the private decryption key AND the encrypted .env files.

Can't find the answer you're looking for? Send us an email at [email protected] team. We'd love to hear from you.

brew install dotenvx/brew/dotenvx
curl -fsS https://dotenvx.sh/ | sh