Deploying Parse server to Google App Engine

Recently Parse announced they’re shutting down their mobile backend as a service. If you’ve built an app on top of Parse, this is probably bad news. The good news is that they’re giving developers 12 months to find a new solution, and they’re providing a path to running your own Parse-compatible service. There’s a great migration guide that covers exporting Parse data to MongoDB, and running a Parse server built on Node.js and express.

This guide is going to cover running the Parse server on Google App Engine and MongoLab. You can learn about setting up parse and tons of other node.js apps on App Engine over at our node.js developer hub.

Set up a MongoLab database

First, sign up for a MongoLab account (if you don’t have one already).

When you get to the dashboard, create a new database:

Make sure to select Google Cloud Platform as the cloud provider. I’m using the free tier to get started:

After the database is available, click on the title in the dashboard. You need to create a user:

Next, copy the connection string for the database. We’re going to use this in our node.js application.

Now we have a database — let’s move onto the node.js app.

Setting up Parse server

The easiest way to get Parse server running on Google Cloud is to start with the sample out on GitHub.

git clone https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git
cd appengine/parse-server
npm install

Now you need to setup a few config variables. Open up config.json, and set up the local config. You can learn more about the Parse config in the migration guide:

{
“DATABASE_URI”: “mongodb://localhost:27017/dev”,
“CLOUD_PATH”: “./cloud/main.js”,
“APP_ID”: “<your-app-id>”,
“MASTER_KEY”: “<your-master-key>”,
“FILE_KEY”: “<your-file-key>”,
“PARSE_MOUNT_PATH”: “/parse”,
“SERVER_URL”: “<your-server-url>”
}

That will help us run parse server locally. Now try it out:

npm start

Now lets deploy the app to App Engine!

Deploy to Google App Engine

Next we’re going to deploy the app to Google App Engine. If you get stuck, you can also follow the node.js getting started guide.

Start by creating a project in the Google Cloud Platform Console:

Next, enable billing. You can run applications on App Engine Managed VMs with the free trial.

Install the Google Cloud SDK. Run `gcloud init` and sign in with your Google account. Finally — deploy your app:

gcloud preview app deploy

When the deployment is done, navigate t0 http://<your-app-id>.appspot.com and check it out:

And you’re set. To learn more about running node.js applications on Google cloud, check out our docs, or take a look at our other samples on GitHub. Let us know what you think!