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:

Table of Contents


    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

    176 posts

    Founder of Scotch.io. Google Developer Expert in Web Technologies. Slapping the keyboard until something good happens.