Blog

Deploying a React App to Google’s App Engine

1 ei6pmie4luodpieo znnvq

Sometimes engineers scour tutorials and articles trying to figure out how to get their app or some component of their stack to work or deploy.

One such case recently was a customer struggling to get their React / NodeJS app to deploy to Google’s App Engine. Our team assisted and had them working within less than an hour of their request.

As I’ve created examples in the past on how to Dockerize React-based apps that adhere to 12-factor methodology (using ENV vars), I thought I would try this myself. I created a basic React application using create-react-app and deployed it to App Engine using Google’s gcloud SDK. I’m pleased to share that within minutes I had it up and running in the cloud so I thought I’d share what worked.

Objective

If everything works as planned, you should see something like this in your browser within a few minutes of following these instructions (with different URL of course).

1 ipfxde05qkjunf fxotbaa
Working example of React app on App Engine within minutes

Prerequisites

  • NodeJS installed (on Mac brew install node )
  • GCloud SDK installed ( install ) and authenticated
  • Active Google Cloud Platform (GCP) project

Working script

Cutting to the chase, these are the steps that worked for me. You can run these individually or simply copy this file, make it executable, change the project ID, and run it locally.

Within a few minutes your app should be running and accessible from a browser. You can also visit the example repository below for a quickstart.

Cleanup

To avoid unexpected charges with your cloud account, either delete your project or remove the app you deployed using the command below

# remove app engine service
gcloud app services delete <YOUR APP NAME>
# if warnings, potentially delete versions
gcloud app versions list
gcloud app versions delete <VERSION ID> # repeat

Subscribe to updates, news and more.

Related blogs

Schedule a call with our team

You will receive a calendar invite to the email address provided below for a 15-minute call with one of our team members to discuss your needs.

You will be presented with date and time options on the next step