Skip to main content



When we structure our modern apps we typically have 2 microservices, one is the api which is responsible of communicating with the database and provide you with custom logic, the other is the client which is typically a web application that communicates with the api. These are independently deployable.

There are many ways to deploy nowadays, but our focus here is to offer the simplest possible way of deploying in a solid, highly scalable fashion. The solutions we are providing are 100% free and require you no money to deploy and play with your apps, but at the same time you have the infrastructure to scale a lot.



  1. Go to and create an account.
  2. Install the cli tool: npm i -g heroku. And then run heroku login
  3. You might need some other dependencies so all works flawlessly: npm i -g @heroku/buildpack-registry true-myth valid-url


You need a solid database for MongoDB. Databases are usually a pain to maintain and scale, try to avoid managing your own unless you have to.

  1. Go to and create an account.
  2. Create a free-tier cluster, create an admin username and ensure your security is set to "Allow all IP Addresses"
  3. Please select a very secure password. At least 12 chars.

Setting Up

We use need heroku-buildpack-monorepo which allows an environment variable APP_BASE to control this.


Note: the order of the buildpacks matter, heroku-buildpack-monorepo needs to be first.

# Just create some unique ids, and select the region "eu" or "us"heroku create api-test --region euheroku buildpacks:add -a api-test -i 1heroku buildpacks:add -a api-test heroku/nodejs
# Do not rely on .env or commit it. Use heroku's own environment config variablesheroku config:set -a api-test APP_BASE="microservices/api"heroku config:set -a api-test APP_URL=""heroku config:set -a api-test ROOT_URL=""
# Get this from MongoDB Atlas. Create a "Free Tier Cluster" and go to "Connect" and specify in security: Allow all IPs. The URL looks like:heroku config:set -a api-test MONGO_URL="mongodb+srv://"
git remote add heroku-api push heroku-api master # or main, whichever branch you use


Netlify is also a good option, but for the sake of having everything done in a consistent manner, this is how it would work with Heroku.

heroku create web-test --region euheroku buildpacks:add -a web-test -i 1heroku buildpacks:add -a web-test heroku/nodejs
heroku config:set -a web-test APP_BASE="microservices/ui"heroku config:set -a web-test API_URL=""
git remote add heroku-web push heroku-web master


To view the logs if something fails or the server's output:

heroku logs --app api-testheroku logs --app api-test --tail # Follows the logs as they appear, useful when debugging server-side logging


Nowadays it's free and easy to deploy your app in safe, scalable manner. We love simplicity. The full working sample can be found here: