Doppler: Sync and Organize Your App's Environment Variables

January 21, 2023

As our app grows so do our environment variables as well. We start with a couple of things like DB credentials and it slowly grows exponentially.

And we know how complex it is to manage it across multiple servers/services. And also across different environments like dev/staging/production.

That’s where Doppler comes in.

With the help of Doppler, we can manage everything in a single place and it’ll keep everything in sync everywhere.

doppler different envs

How Do I Use It Locally?

Install the Doppler CLI.

In macOS, you can install it by running the following commands

# Prerequisite. gnupg is required for binary signature verification
brew install gnupg

# Next, install using brew (use `doppler update` for subsequent updates)
brew install dopplerhq/cli/doppler

Once the CLI is installed log in to your account.

doppler login

Now, go to your project’s directory and then configure it with your doppler project by running the following command.

# Select project and environment
doppler setup

Now use doppler run command to start your app/server. That will take care of configuring latest env variables from the Doppler account and you can use it as if you’ve set it locally in your bash or .env file.

Example:

doppler run -- npm run dev

How Do I Use It with Cloud Providers like Vercel?

Chances are your cloud provider will have official support with Doppler.

In that case, you can just integrate it and link it with your project’s environment and it’ll take care of the rest like syncing your env variables to your cloud providers automatically.

doppler env variables

Related

Happy secure secrets!


👋 I'm Ashik Nesin • Principal Software Engineer 👨‍💻• I write about web development and share insights into the behind-the-scenes of the projects that I'm building.

© 2023 Nesin Technologies LLP