Quickstart

Sync .env files

Sync your .env files using this quickstart guide.

In just a couple minutes, you'll be able to sync your .env files across machines, teams, and environments.

I built dotenv-vault to scratch my own itch. I wanted it to be developer-first and cli-first (like a lot of my favorite dev tools). There's a bit of a learning curve with the cli (also like a lot of my favorite dev tools), but once you use it a couple times it becomes familiar, and I think you will like it. I hope you do. Let's get started together.

Mot

Create .env file

Create a .env file.

.env

# development
HELLO="World"

Next, set up it's .env.vault.

Set up .env.vault

Run dotenv-vault's new command.

npx dotenv-vault new
npx dotenv-vault new

Running this command sets up your project on Dotenv and creates your project's .env.vault file. It will look like this.

.env.vault

#/-------------------.env.vault---------------------/
#/         cloud-agnostic vaulting standard         /
#/--------------------------------------------------/
DOTENV_VAULT="vlt_1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a"

The .env.vault file uniquely identifies your project on Dotenv. You can think of it like a unique git url at GitHub. It identifies your project so that you and your teammates pull the correct .env file from Dotenv. Read more about .env.vault files.

Next, log in to your .env.vault.

Log in .env.vault

Run the login command.

npx dotenv-vault login
npx dotenv-vault login

Running this command authenticates you against your project on Dotenv and securely generates your .env.me credential. Your .env.me file will look like this.

.env.me

#/!!!!!!!!!!!!!!!!!!!!.env.me!!!!!!!!!!!!!!!!!!!!!!!/
#/ credential file. DO NOT commit to source control /
#/--------------------------------------------------/
DOTENV_ME="me_1z1z1z1z1z1z1z1z1z1z1z1z1z1z1z1z1z1z1z1z1z1z1z1z1z1z1z1z1z1z1z1z"

The .env.me file uniquely authorizes you to access your project's env vault. You can think of it like your unique SSH key at GitHub. It identifies your machine so that you can safely and securely sync your .env file from Dotenv. Read more about .env.me files.

Next, push your .env file.

Push .env

Run the push command.

npx dotenv-vault push
npx dotenv-vault push

This securely pushes your .env file to your Dotenv Account. It works a lot like git.

Pull .env

You can pull the latest changes too. Run the pull command.

npx dotenv-vault pull
npx dotenv-vault pull

Conclusion

Congrats! You synced your .env file and completed this quickstart guide. What's next? I recommend learning how to manage multiple environments like .env.production next.

Thanks for using Dotenv!