Step by Step guide to Hiding API key in Rails and React

If you used create-react-app to create your application, dotenv is already part of the script, so double check your gemfile to see if it is already exists.
Above are examples of what your env. variables might look like. (not real keys, I made them up!)
Your application might have a .gitignore file already established, if so, simply just add .env to it like above.
In the first image, I was making calls to AlphaVantage API. In the second image, I was using a stock_quote gem
stock_controller.rb and Dashboard.js

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store