Deploy MEAN Stack Application

Hello, all!

I am planning to deploy my first web application using MEAN stack, I am not sure the process. I am not sure whether I should use Heroku or AWS… and will I have to pay money to deploy too?

Thank you.

start with Heroku its free .

I do not know about AWS but Heroku is free. The first thing you need to know, you have to let Node JS start the build for your angular app. in other way, Node JS is going to be hosted on Heroku server first and then Node JS will start the building process for your angular app to run on heroku as well. If there are no problems, Heroku will have 2 servers running one for Front-End (Angular) and second for Back-End (Node JS). Check out my github code @

I did not use MongoDB but I used GitHub API to interact with GitHub server.

Check the package json file in the main folder to see what I did to send an order to heroku to start the build process :slight_smile:.

I hope this will help you :slight_smile:. Good Luck!

1 Like

So along the way, I encountered another obstacle. I have organized my project into two repositories on GitHub: one for the client-side and one for the back-end.

I have created two separate apps for each. How would I deploy both of them under one domain name to Heroku?

Well, there are 2 or more different ways to do it but at least I know 2 of them. The first one, you have to include both front-end and back-end files together under one GitHub repository and let Heroku find those files by giving permission to access them on GitHub. The second one, you can put all front-end and back-end files in one folder and then serve those files on Heroku web hosting by using Heroku CLI. In both ways that I mentioned, they will be served under one domain.

Keep in mind, you have to start by running npm to install the angular app first and then, you will have to do some changes to the package json file and create a javascript file as well to run Node JS. It took me so long to figure it out, you just need time and you will get it eventually :).

If you want, you still can deploy both repositories separately on Heroku but they will be running under 2 completely different apps(2 different domains). In other way, you can deploy just the front-end files or back-end files to test things out, but they will run under 2 domains.

1 Like