How to stop Your Heroku app from sleeping😴 (FREE)

Subscribe to my newsletter and never miss my upcoming articles

Listen to this article

The Story Behind 📚

Few months back I built a tool called richurl.tech which is like a url shortner 🔗 but with super power ⚡ . When someone clicks on the richurl, it sends them directly to the YouTube app instead of opening videos on FB/Instagram/Linkedin Broswer.

The backend API was deployed on heroku. It's a cloud platform as a service where you can deploy apps built using python, node, Go, and many more.

If you are on a free tier on Heroku your app sleeps if it is not active for more than 30 minutes. But My back-end should never sleep since it causes delay to wake up the server and defeats the whole purpose of simplifying the user flow through the service.

Here is how I fixed it

Solution ✨

Adding a credit card on heroku gives you total 1000 hours/month , allows you to deploy more than 5 apps and allows custom domain mapping all for FREE.

First method

There are many ways on the internet by which you can stop your heroku from sleeping but by far this is the simplest way on the internet.

Follow this only if you have more than 750hours of dyno time since you won't run out of monthly quota.

Visit Kaffeine Shots and enter your heroku app. It basically pings your app every 30 minutes once and doesn't make it sleep except for the minimum 6 hours which is mandatory.

kafeeine shot.JPG

If you don't want this to continue or running out of quota then you can even stop this.

Second method

Hobby Dynos

Hobby Dynos are same as free dynos but they never sleep by default.

They cost $7/month but if you are a student like me you can sign up for GitHub Students beneifts and can get free hobby dynos for 2 years .

Currently I am using Hobby Dynos since I am a student.


That's it folks. If you have a friend who is a youtuber . Ask him to try out Rich URL while sharing his links on social media platform. I am very close to 100 followers on hashnode. Click on Follow :)

I am also available for free lance gigs or Full time offer. You can contact me on Twitter or on Linkedin hrithwik.jpg

Interested in reading more such articles from Hrithwik Bharadwaj?

Support the author by donating an amount of your choice.

Recent sponsors
Rahul Kamath's photo

Needed this. thank you

Hrithwik Bharadwaj's photo

Glad that it was helpful

Pankaj Tanwar's photo

Nice writeup. I would recommend, rather then relying on a third party service, there are a few possible methods you can try -

  1. Write a Cron job on server to keep the application awake
  2. Self pinging your own server in each 20 min (put code in the main server file)
  3. Run a timeout based Google apps script to ping your server

Your thoughts?

Hrithwik Bharadwaj's photo

Yes this is a good solution which most of them use Pankaj. Most of my articles are targeted for beginners who are just starting out and using Kaffeine Shots is extremely simple