Getting Started with Heroku
Note: This article is currently teaching deployment using Heroku. Heroku has announced that they are deprecating their free offering on November 28th, 2022. We are aware of this issue and are working hard on creating content that uses a free alternative. Thank you for your patience.
What is Heroku
Building an app can be an exciting experience for anyone who enjoys writing code, and sharing something they created with the world. For many of us, though, the thought of setting up a server, configuring ports, and pointing a new domain, amounts to time that could be better spent fine tuning the next viral app! Heroku touts their service as “the fastest way to go from idea to URL, bypassing all those infrastructure headaches”.
“With Heroku, we don’t need a dedicated DevOps team. We can keep the wheels of innovation turning and allow our engineers to focus on building the best user experience for our customers.”
Jonathan Lister Parsons CTO, PensionBee
The quote above is a great explanation of Heroku’s value to a business, and the same idea (scaled down) also makes it valuable to a single developer, or small team of developers - more time spent building the app, less time spent configuring the deployment!
Getting an app out quickly can be advantageous for a number of reasons:
- Testing out Proof of Concept.
- Introducing a Minimum Viable Product to potential users, or investors.
- Or even just meeting a personal deadline, like for a website/app for a friend’s wedding or birthday party.
You can get started using Heroku with any of the officially supported languages:
The example provided in this module will use Node.js.
Setting up an Account
Now that you know some of the benefits Heroku provides, it’s time to set up an account! Navigate to the Heroku sign-up page in your web browser of choice, and fill out the form to create a free account.
Fill in the form with your information. If you’re unsure about role, select student. While this module will use Node.js, you can select a different language, if that’s the language you’re more comfortable with. Finally, click the box that checks if you’re a robot, and then click the CREATE FREE ACCOUNT button.
After you’ve created your account, make sure to verify your email. Then set a password and login to see your personal Heroku dashboard.
That’s it! Your account is now set-up. From here, you’re ready to begin developing a new app with Heroku. But first, let’s explore some of the different plan options Heroku has to offer.
Plans and Services
Heroku pricing can be a bit intimidating for new users. In short, pricing is determined by dyno types, and secondarily by data services. Fortunately, your new app defaults to the free dyno type, with free data services. A new app includes everything you need to deploy and view it on the web. From this point, you can scale up as needed.
All Heroku applications run in a collection of lightweight Linux containers called dynos. Since the purpose of this module is learning how to get started with Heroku, you’ll be introduced to the Free dyno type.
When you sign up with Heroku, you automatically get a pool of free dyno hours (550 - 1000, depending on account verification) to use for your apps. This is great for new developers, as well as anyone interested in using Heroku’s service to present a minimum viable product. When your app is running, it consumes dyno hours. When it idles (automatically, after 30 minutes of inactivity), your app will stop consuming dyno hours and go to sleep. This means when a web request is made to your app (for instance, a user visiting the URL, or making a database request) it will take a few extra seconds for the app to wake, before serving the request. If you find that you need more than what the free tier has to offer, you can certainly pay for it. Although, this module will predominantly focus on the free tier.
For data-driven apps, Heroku provides three services to all customers:
This article will discuss Heroku Postgres.
Heroku Postgres has many plans that are divided into five high-level tiers. The primary difference between each tier is the amount of tolerated monthly downtime for databases in the tier. New apps will use the free Hobby tier. The Hobby tier can be broken down again into 2 plans: Hobby Dev and Hobby Basic. This module will explore the Hobby Dev plan to keep the focus mostly on getting started.
The hobby dev plan aims to fill the needs of student, personal, and hobbyist use. It allows for 10,000 rows of data, and like all Heroku Postgres plans, features:
- automatic health checks
- off-premises storage
- daily backups
- SSL-protected access
- Postgres extensions
- and a web Ul.
The best part of the hobby dev plan, for new untested apps, is that it’s free! If you feel like you need more than the 10,000 rows provided in the Hobby Dev plan, you can always upgrade to the Hobby Basic plan, which offers 10,000,000 rows.
Aside from dynos, and data, Heroku offers numerous add-ons to support your app, in categories related to:
- user management
- and security, just to name a few.
These add-ons are fully maintained by either a third-party provider or by Heroku, keeping with the theme of letting you focus strictly on the development side of things.
This article just scratches the surface when it comes to Heroku, but you should now have a good understanding of how to get started. You’re now familiar with:
- Heroku as a service
- Why you would use it
- Setting up an account
- What dynos are
- Data services options
- and add-ons
Take a look around your new Heroku account and get familiar with the dashboard, where your future apps will be stored. Then head on over to the Heroku Dev Center for more information on building, deploying, and managing apps. Once you’re comfortable, click the Next button and learn step-by-step how to deploy your first back-end app!