Heroku(Node.js deploy)

Gabriel Castro
3 min readJun 6, 2021

It’s been a long time coming, but I am finally ready to start my portfolio website. So I thought to myself what better way to figure out how to deploy an app then to blog about it.

Getting Started

In order to get started, head on over to Heroku, their dev center has a lot of helpful information on how to deploy an application depending upon what language your going to use. In my case I will be using Node.js for my portfolio. Heroku also assumes that you already have a free Heroku account set up, as-well as Node.js and npm installed.

Once these three are installed, we can go ahead and use installer depending on what platform you are using to set up the Heroku CLI. You can use the CLI to help manage your app, add-ons, logs and run your app locally on your machine.

Heroku Login

Now that we have the Heroku CLI installed, we can go ahead and get logged in!

simply run …

$ heroku login

in your terminal and it should open up the Heroku login page. This will authenticate your Heroku and git commands.

Sample App & Deploy

Now that you are logged in, you can clone down a local version of a sample application before you go own to create your own full blown deployment!!

run the following …

$ git clone https://github.com/heroku/node-js-getting-started.git
$ cd node-js-getting-started

This will give you access to starter application and nodes dependency manager.

Next you can create your app, which allows Heroku to receive the source code.

$ heroku create

This will create the app, with a git remote called Heroku that is associated with your local git repository. Heroku will also generate a random name for your app.

$ git push heroku main

The above line will deploy your application.

Heroku also needs to ensure at least of instance of the app is running…

$ heroku ps:scale web=1

Finally you can run…

$ heroku open

To open your application.

Technical Issues

A couple issues I ran into while doing this, making sure I had the most up-to-date version of Command Line Tools for Mac. I needed the most update version of this before I was allowed to use the Homebrew Install for Heroku.

Another issue I had was ensure that I could get access to my deployment from my Github. In order to do this you need to access your Dashboard in Heroku, go down to the Github tab and search for the repository you would like to connect.

Happy Coding!

--

--

Gabriel Castro

Full Stack, Software Engineer. Focus in Rails, JavaScript and React.