We'll be using a handy package called dotenv to bring all environment variables in a .env file into our project.

Once we configure the package using:


We are able to call any variables from the environment using:



It's common practice to keep environment variable names fully uppercase.

Note: Be sure to add .env to your .gitignore so that it doesn't get committed to your repo. Keep secret info out of public repos!

Chris Sevilleja

168 posts

Co-founder of Scotch.io. Slapping the keyboard until something good happens.