How to stop Your Heroku app from sleeping😴 (FREE)
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
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.
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.
If you don't want this to continue or running out of quota then you can even stop this.
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 :)