How To Deploy Node.js Web Application On Heroku Server


You must install Node.js, Git (to commit our code in the git repository), and Heroku command-line tools and web storm (optional). Here, I used web storm for a terminal. You can use any shell terminal for the same.

Download links

The first point is, create your Heroku account and process all the required verification for code deployment.

Link -


Select Node.js as a primary development language whenever you create a new account on Heroku.

Before moving forward, check twice that all the required setups are installed. For checking the installation, follow the below command.

Please check the below command in your local terminal. I am using Windows OS, so I have a command prompt as my local terminal.

 local terminal

Now, move ahead for the deployment.

S1 > Open your project in web storm and go to the terminal.

S2 > Login to your Heroku account in the terminal. Follow the below command.

Enter this command at the Heroku login and hit enter. After that, you need to enter your email address and login password.

 S3 > Now, you have successfully logged in with your Heroku account. Before moving ahead, check whether your application is working well in local or not.

Enter this command in the Heroku local web and hit enter. Generally, when you enter this command, Heroku runs your application in a local server with a port 5000. So, you can check your application in the local server with URL - http://localhost:5000/

application in local server 

Here is my application snap with a local server. URL - http://localhost:5000/

my application snap 

S4 > Currently your application is running. So, now we need to stop this application so that we can move ahead with the deployment.

To terminate the application with local server press CLTR + C in a terminal and then type Y and hit enter.

terminate application

S5 >
Now, we need to upload our node.js code to cloud server so that we can deploy that code. We will upload all the code on Git.

First, initialize git in your project directory. For the same type git in it and hit enter.

project directory 

S6 > Next, we will add all our changes to the staging area with git add (type this in your terminal) and then commit them with git commit -m "Initing" (type this in your terminal)

Type git add . and hit enter

Type git add 

Type git commit -m "Initing" and hit enter

Type git commit -m  

S7 > Now, we are ready to push to the Heroku cloud, which will host our code.

First, we'll make this a Heroku application with the command Heroku create,
command heroku  

So, our app is created with the name “boiling-reaches-45016” and deploy URL and git URL.

S8 > Now, a final step is to deploy all code from git to our Heroku cloud.

Write this command to push all code in our Heroku cloud.

git push master

git push 
Hooray!!! All done. Now, we can access our application with our deployed URL -


You can change your domain name with updated DNS from your Heroku accounts.