Make your free Heroku app awake forever

So Steve
3 min readJun 8, 2020

Background

After trying a few hosting platforms for my node.js App, I decided that Heroku is the way to go. It’s incredibly simple to use, nice interface, enough support. They also have a free tier that is just enough for my needs, but it’s not that free ☹️

Since my current product does have any revenue, I don’t want to rush into paying Heroku $7/month.

After doing my research, I was happy with their free tier with only one exception. If your server doesn’t have any activity in 30 minutes, it goes to sleep. So, I needed a simple way how to fix it and today I will show you how.

Outline

To make your Heroku app run forever we need to send a request every 30 minutes to keep it from falling asleep. There are a lot of ways to achieve it, but I decided to implement it with IFTTT. IFTTT is a free web-based service that creates chains of simple conditional statements, called applets.

With IFTTT we will create 2 applets. Both will make a GET request to your app. One applet will make a call every hour at 15 minutes and another at 45.

Method

  1. Create a simple get request inside of your app. Let’s call it /awake
app.get("/awake", (req, res) => {   console.log("I'm awake")   res.json({ awake: "I'm not sleeping" });});

2. Now we just need to keep your app awake by calling the /awake request with a 30 minute interval. I used IFTTT.com for this.

Create a new applet

Create a trigger by clicking on +This.

Choose Date & Time.

The option we want is Every hour at

Then choose the option 15 minutes past the hour and create this trigger

After click +That

Choose Webhooks

Pick Make a web request

Paste your app url (e.g. https://app.herokuapp.com/awake)

3. ⚠️ Repeat by creating a second applet. Everything is the same, but with the different time option. It should run every hour at 45 minutes ⚠️

Profit!

Your Heroku app won’t fall asleep.

In case you wonder what my App does 🤔

I’m working a Slack app that helps to build a better team culture with icebreakers. It’s called Bill

--

--