Sunday, 22 May 2016

Creating your own self-hosted PARSE server

As you might be aware, PARSE service is shutting down beginning of 2017. This was a really great solution to quickly spin up the infrastructure needed to build an app. I still have some of my apps relying on that infrastructure and I think it's time to make the move to my own self-hosted PARSE server (for local Development). Here you will find a quick guide through the initial configuration required to have your PARSE server up and running in no time.

PARSE is actually really easy to set up. You just need a NoSQL DB (MongoDB in this case) and then get the latest source code from GitHub to create your own PARSE self-hosted instance. My sandbox is a Windows 2012 R2 and I will guide you through the required steps in there.

The prerequisites are as follows:

  • Node 4.3
  • MongoDB version 2.6.x or 3.0.x
  • Python 2.x (For Windows users, 2.7.1 is the required version)

Installing MongoDB.
First you'll need MongoDB. Download the latest version of MongoDB from here. In my case I installed version 3.2.6 for Windows Server 2008 R2 and later with SSL support.

Install the complete version and once finished, go to MongoDB folder and run mongod.exe command:
Notice that I had to run the command twice as the folder that MondoDB needs was not there: C:\data\db. I created the folder manually and then ran again the executable. Now MongoDB is up and running awaiting for connections on port 27017.

Installing Node.js.
Next step is to download and install Node.js. You can get the latest version here. I will install version 4.4.4 LTS which is the recommended for most users. Download the installer and continue clicking next until it is completely installed on your machine.

Installing Python.
The required version for Windows is 2.7.1. In my case I will install 2.7.11 as it's the recommended version from Python. You can get the latest installer from here. Once the setup is completed you will have to reboot your machine to make sure the configuration is updated.

Downloading PARSE server example.
Head to PARSE server source code on GitHub and download the PARSE server example from here. Unzip the zip file under C:\Parse for example. Once everything is in place, open node.js command prompt with admin rights and run the command npm install under C:\Parse folder:

During the installation I hit a small bump with the following error message:
MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "14.0", "4.0".

To overcome this issue, just install the MSBuild Tools from VS2013. This can be found here. Now we are ready to start our PARSE server.

Starting PARSE server.
Remember to start mongoDB first here as the server was restarted from installing Pyhton. MongoDB should show that its waiting for connection. Here are some logs when the system is up and running:

Configure PARSE:
Open the file index.js under C:\Parse and edit the sections appId and masterKey

In my case, I mentioned the appId as 'thunderParse' and the masterKey as a nice key (base64 string).

Run PARSE server via npm:
Once configured, run in the same command line the command npm start.

Now parse is up and running and is ready for requests.

Configuring and Starting PARSE Dashboard.
Now that our PARSE server is running, we can configure and start the PARSE dashboard which is a web base application to manage our PARSE apps.

To get PARSE dashboard, you only need to type the following from npm:

Now we can go to localhost:4040/apps and we will see our application described there:

Testing our self-hosted PARSE server.
Now is the time to test our self-hosted PARSE server. To test it out, we just need to use curl or any other mechanism that we like. I've used curl and Delphi as I already had some libraries prepared for it. Here is the command with curl:
And here with Delphi:

And here are the results of the App writing to Parse server:

Next step is to bring this online and host it somewhere else like Heroku, AWS, AZure or Scalingo.

I hope you find this useful.


  1. Great article! I Will use your delphi code in my next post.Thanks.

  2. Any chance this still works as i tried a couple of times and get errors on trying. :(

  3. Muito bom seu artigo, me ajudou muito pois sempre quis testar o parse e essa foi a primeira vez que realmente consegui. Obrigado!

  4. Estou tentado criar um chat simples que possar enviar mensagem de texto, e imagens usando delphi firemonkey e parse, vocĂȘ podria me ajudar? vocĂȘ tem algum artigo sobre isso? Ou pode ser usando o delphi firemonkey e firebase.