Documentation

How to build a NodeJS based application on Heroku using Redis

Ajeet Raina
Author
Ajeet Raina, Former Developer Growth Manager at Redis

Step 1. Create Redis Cloud#

Create your free Redis Cloud account. Follow this link to create Redis Cloud subscription and database as shown below:

Save the database endpoint URL and password for future reference.

Step 2. Create a Heroku account#

If you are using Heroku for the first time, create your new Heroku account through this link

Step 3. Install Heroku CLI on your system#

Step 4. Login to Heroku#

Step 5. Connect your application to Redis Cloud#

For this demonstration, we will be using a Sample Rate Limiting application

Clone the repository#

Run the below CLI to have a functioning Git repository that contains a simple application as well as a package.json file.

Step 6. Setting up environment variables#

Go to Heroku dashboard, click "Settings" and set REDIS_ENDPOINT_URI and REDIS_PASSWORD under the Config Vars. Refer to Step 1 for the reference.

You now have a functioning Git repository that contains a simple application as well as a package.json file, which is used by Node’s dependency manager.

Step 7. Deploy your code#

Wait for few seconds and you will see the below messages being displayed:

Step 8. Accessing the application#

Open https://rocky-lowlands-06306.herokuapp.com/ to see your application