How to setup and use your own Parse Server

Asim Hussain
codecraft
Published in
4 min readJun 10, 2016

So earlier on this year those of you with accounts on parse.com will have heard the sad news that Facebook decided to retire the platform by January 2017. Parse is a Backed As A Service (BaaS) platform that we used as a convenient backend in our Ionic: From Web to Mobile course at codecraft.tv so initially I was really sad to hear the news.

But after I thought about it for a while I became really excited!

That’s because as part of this shutdown Facebook has released the parse platform as open source software, see: https://github.com/ParsePlatform/parse-server

Facebook bought Parse.com in 2013 for $85 million. Since then it’s had an incredible amount of development and you can now get all of that juicy code worth millions for free and open source!

What is it?

The parse server project is the backend for parse made available for you to host yourself, on your own servers.

To use parse we will need two things

1. A server to run the code.
2. A mongodb database to persist the data.

To follow through with this guide you will need:

1. An account on github.com
2. An account on heroku.com

Setting up the Parse Server

The parse-server code is written in node and already available via npm

To use parse we need to first create a node express application, create an endpoint called e.g. “/parse” and make express use the parse-server code to handle any requests that go to “/parse”.

Luckily for us the parse people have already created an example express application that does just that which we can just fork and use.

Where are we going to host it?

If you go to the readme for the example project you’ll see instructions for how to host it on various platforms, for this article we are going to use Heroku.

On Heroku we can get a completely free server to run parse as well as a free sandboxed mLab hosted mongodb database and best of all we just need to click a button to make it work!

From the readme page of your forked example project click the deploy to heroku button to start the process

It’s going to ask you a few questions.

1. Choose a name for your parse application, it’s going to be hosted on <your-name>.herokuapp.com

2. Choose an application ID, this will be used to identify this instance of parse server, it’s also going to be the main authentication key you’ll use to connect from your client apps so something hard to crack.

3. Choose a master key, this overrides all permissions, like admin access, something you will never share to others.

4. This is the fully qualified parse server url, so the <your-name>.herokuapp.com/parse, remember to replace <your-name> with the value you chose in section 1.

5. Press “Deploy For Free”.

That’s IT!

You now have your very own instance of parse running on server you control.

Getting the parse client library

Now we’ve setup the parse server we need to include the parse client library in your application so it knows how to communicate with your parse server.

There are a few places to get it from:

  1. The parse.com website: https://parse.com/docs/downloads
  2. The official CDN: http://www.parsecdn.com/js/parse-latest.js
  3. Via npm: https://www.npmjs.com/package/parse

Seeing that i’m not sure what will happen to the parse.com domain in the future the 4th method i’m going to suggest is to build it directly from the github source code, keep it all under your own control!

  • Clone the git repo
  • cd into the folder you just cloned
  • Type `npm install`
  • Type `build_releases.sh`
  • There should now be a folder called dist which contains the parse-latest.min.js
  • Just copy & paste this file to your project

Connecting to the parse server

Now that you’ve included the client library into your project we just need to initialise it before we can start using it.

You’ll need to initialise this somewhere in your application, in Angular 1.x it would be in the angular.run(function() { … }) block, in jQuery you would initialise this in the document.ready(function() {}) block.

// Initialise Parse
Parse.initialize('myAppId');
Parse.serverURL = 'http://<your-app-id>.herokuapp.com/parse';

We first initialise Parse with the application key we defined when we created the app on Heroku.

And then we need to tell Parse where to find the server, so just point it to the right URL.

Congrats! Now you are ready and setup to use Parse in your application.

Next up

Want to find out more about how to use Parse javascript library read first the quickstart and then the more detailed guide.

--

--

Asim Hussain
codecraft

Green Cloud Advocacy Lead at Microsoft, conference speaker, published author, passionate teacher — asim.dev