How I host my hobby app for FREE with CDN, SSL, SQL, CI and Tracking

I’m pretty sure many of you have hobby projects that you’re sure will bring you absolutely no money at all.

Knowing this I think nobody in their right mind would ever pay for developing or hosting their hobby app. Still thankfully this doesn’t mean that you cannot create and run a hobby app that follows modern standards.

The app: https://www.packageboard.com

My hobby app is a pretty simple dashboard for visualising state of my publicly available npm packages. A useful tool for package authors like myself.

Development and CI

For developing the app I chose VS Code it’s free it’s simple and easy to use. My app’s backend is written in TypeScript using koajs and running on nodejs.

For storing my code I use BitBucket which offers unlimited private repositories.

As a CI build system I chose to use CodeShip which is free to use until 100 builds per month which should be plenty of builds for me. It integrates well with BitBucket and Heroku (spoiler alert :D).

CodeShip builds

Hosting

Now that my app is able to build it needs to be hosted too. For hosting the backend I chose the free version of Heroku. One downside of this that it goes to sleep after 30 mins of inactivity (But of course we can easily handle it with UptimeRobot that pings your site in every 5 mins :)). Heroku offers Postgres SQL which has a Free version that supports 10k rows — for an app like this probably it will be enough.

Heroku dashboard

If for whatever reason people start using my app it will take 1 minute for me to scale the server and the database instances up. And some money :(

Okay this is great I have my backend up and running. Now let’s cheat a bit.

Let’s buy a custom domain for my app. It cost me $1 on GoDaddy. Use it’s DNS service to point the domain to my Heroku server.

Now let’s make the connection secure with TLS. SSL certificates can be expensive and sadly Heroku offers use of HTTPS for custom domains for a price BUT lucky us all Heroku instances can be reached through HTTPS using a subdomain of herokuapp.com (https://your-app-name.herokuapp.com)

So in light of this I decided to add CORS support in my app, so that my frontend hosted on packageboard.com can communicate with package-board.herokuapp.com as well as it can add XSRF protection to my app.

So it’s time to deploy my frontend to a CDN that supports custom domains and SSL. So first let’s get an free SSL cert. Luckily I found Let’s Encrypt CA that offers free certs and even offers automated cert creation which can integrate with hosting providers.

After a little search I found Netlify a CDN hosting provider which automatically creates/renews HTTPS certs with Let’s Encrypt. This is what I needed.

Netlify

Tracking

Now that my app is live it’s time to track the traffic so I set Google Analytics up. Just what I’ve expected :D

Google Analytics

Conclusion

If you’re passionate about programming and ready to burn some time on developing an app that will probably earn no money ever at all — At least as described before you can host it in a modern and secure way for FREE.