Deploy Node.js (Loopback) app on Google Cloud Platform

A year ago, I did some research about some free and paid cloud platforms, such as Amazon web services, Google cloud platform, Digital Ocean and Heroku, etc. At last, our team ended up with Heroku free tier as we follows the LEAN path. We did not want any incurred cost during our early start-up stages. But now, Google extended their 3 months free trial period to 1 year. Moreover, this time, I am working alone so the decision is all mine to stick with Google Cloud.

Create a Google Cloud Platform project

Go to Google cloud platform dashboard. If you dont have an account yet, you can simply filling free trial sign up form with billing information. Then, create a new project with the name of your choice.

Planning ahead

Before we start working on our newly create project, it is a good practice to write down all the variables, names or IDs that we gonna use for deployment.

  • Project
    • Project name: Xxxxx 300989 (Can change anytime)
    • Project ID: xxxxx-300989 (Can't change once set)
    • Project No: 1234567547 (fixed)
  • Team
    • Owner: xxxx
    • Editor: xxxx
    • Viewer: xxxx
  • Configuration
    • Google account:
  • Services
    • Compute: App Engine (Node.js)
      • Region: asia-northeast1
    • Storage: Cloud Storage

The Cloud SDK & the gCloud Tool

The Google Cloud SDK contains tools and library that enable the developers to easily create and manage resources on Cloud Platform. Go to Cloud SDK and follow the instructions there to install on your local machine.

The most convenient way to manage Cloud Platform resources is through the gcloud command-line tool, which is already included in the Cloud SDK.


The gcloud tool needs to be authenticated by the Google Cloud Platform to get access our account. We can do that by simply with the following command.

# gcloud auth login

gCloud opens a new browser and you just need to click Accept to authenticate the gCloud tool. If you have multiple accounts on Chrome browser, make sure you open first the browser that linked with the google account you want to use to authenticate.


If you have only one project in the account, the gcloud will automatically select it as the current project. If not, run the following command to set another project.

$ gcloud config set project xxxxx-300989

Prepare the Release Branch of the App

As I am using the git workflow that I mentioned in my previous post, I separate a new develop or release branch to deploy on Google Cloud Platform. I already have my Node.js app (Loopback) ready for deployment. But it needs to be added some Google Cloud environmental related files to work with App Engine.


It contains our Node.js App Engine's runtime configurations such as cpu, memory, network and disk resource, automatic or manual scaling configurations and other general settings. It's kind of like .htaccess in php. You can read more about app.yaml at its official documentation.

Create a app.yaml in the root directory of the app and enter the following code.

# [START app_yaml]
runtime: nodejs  
env: flex  
# [END app_yaml]

That is. We are ready to deploy our app.

Deploy on Google Cloud

  • In terminal, open the app root directory and type gcloud app deploy.
  • It will prompt back to choose the region where you want to locate the App Engine application. I chose asia-northeast1 (number 4) because my app targets asian customers.
  • Finally, it will confirm that you are about to deploy your app at the URL []. Type Y to confirm deployment.
  • Then, please wait for a while it is creating a new App Engine for your app (may take a little longer if this is your first deployment).

Nay Win Myint

Founder and CEO of Pancasikha Music Streaming Provider, JavaScript full-stack and Android developer and Graphic designer.

Rangoon, Myanmar