dotenv is a ruby gem that allows you to use the .env file to store environment variables. Think of it as a global variable for your entire app.
Aside from the obvious reason of having a global variable, most people use the .env file to store private information like API keys. And usually, the .env file is included in the .gitignore file so that you don't accidentally upload it to your repository.
In your gemfile:
gem 'dotenv'
and in your /config/environment.rb file:
require 'dotenv'
Dotenv.load