Introduction to Parse Server hosted on back4app

713 Views

Overview

The open-source Parse SDKs are flexible and easy to use, a community of developers is keeping them up to date, check the official Hub here: parseplatform.org
Parse Server is a great choice for building applications and websites that need a flexible backend that can be managed with a few lines of code.

You can host Parse Server in your own server. Anyway, the process to do that is pretty complex, so here’s where back4app comes out to help you. It is a valid BaaS for hosting your Parse apps for free – for test purposes. It also offers affordable subscription plans to get more database storage, API calls, and higher speed performance. Check out the Pricing page to get an idea of the offered plans.

Setup and create a database

Creating a Parse App on back4app and its relative database is super easy. First of all, sign up for a new account, it’s free. After signing up, the browser will redirect you to the Main Dashboard, where you can build and manage your own Parse Apps.
In order to create a new Parse App, you can either click the Build new app blue big button or the green NEW APP one on the top-right corner of the page. Enter the name of your app, as well as an optional description. 

Main Dashboard page on back4app

Click Create to enter the main Dashboard, where you can manage apps settings, upgrade to a paid plan or enter their Parse Dashboards. 
Let’s get deeper into the Server Settings of an app. Click the Server Settings button and get to the App Dashboard

The App Dashboard

Core Settings

The Core Settings box

This section is where you manage your keys, delete, transfer, clone or restart your app. If you click LEARN then you’ll be redirected to the official documentation of back4app. If you select SETTINGS, you’ll get into the server options: 

Core Settings details and options

Here you can grab all those keys you need to use in your mobile or web applications in order to run Parse SDKs. 
Scroll down to the bottom of this page to find a few buttons to edit the details of your app, restart it, transfer it to another back4app owner clone or delete your app.

Manage Parse Server

Manage Parse Server box

In this section, you can change the Parse Server version. Click the SETTINGS button to enter a list of Parse Server versions and choose the one you want. 

Parse Versions list

Logs

Logs box

Click on SETTINGS to enter a page that shows all your server’s Log data.

Log Data page

Cloud Code

Cloud Code box

The Cloud Code section is where you host useful javascript files that will allow your applications to interact with certain functions of Parse Server. 
For instance, in case your app needs to send Push Notifications, you need to create a main.js file with functions to handle Push Notifications and upload it to this container.

Cloud Code Functions page

Command Line Tool

The Command Line Tool box

Click LEARN to read the documentation that explains how to interact with you Cloud Code from the Terminal.

Background Jobs

The Background Jobs box

Background Job – in the Parse Cloud Code – allows you to schedule a function and run it at a certain time. This function must be written in Javascript and the .js file must be uploaded to your Cloud Code container. It’s also known as CronJob in a classic hosting’s cPanel. 
You can read the documentation by clicking LEARN.
Click SETTINGS to schedule and run your own Background job.

Browse or Schedule a Background Job

Web Hosting and Live Query

Hosting and LiveQuery box

In this section, you can create a webpage hosted on back4app.io and activate Live Query
Read the documentation to learn how to enable Web Hosting by clicking the LEARN button. Click SETTINGS to configure a subdomain and activate Live Query.

Web Host + Live Query settings panel

Verification emails

The Verification emails box

Here you can enable verification emails for users who sign up in your app. The server will send an automatic email with a link to click in order to send the emailVerified field as True in your own Parse Dashboard, this is useful in case you want to allow users to use your application only if they verify their email address. 
You can set the Reply-to address, the subject and body of your verification email and edit the details about the Password reset email as well. 

Email Settings form

Facebook login

The Facebook login box

This is the section where you have to paste your own Facebook App ID in order to allow users to sign up/log in with their Facebook accounts in your applications. You can create an App on your Facebook Developer page and grab the App ID from there.
Click SETTINGS to enter the editor page and add your Facebook App ID. Click LEARN to read how to implement Facebook login in your app. 

Configure your Facebook App ID

Twitter login

The Twitter login box

Configure the Twitter Consumer and Secret Consumer keys that you can obtain from your Twitter Developer account in this section. 
Click SETTINGS to add your keys and enable Twitter login for your application.

Configure Twitter Login

Android Push Notifications

The Android Push Notifications box

In case your application is an Android one, click SETTINGS and paste your own GCM Sender ID and API Key in their relative boxes, then click NEXTto save them. 

Configure Android Push Notifications

iOS Push Notifications

The iOS Push Notifications box

If you are building an iOS app, you need to first generate your .p12 Development and Production Certificates for Push Notifications in the Apple Developer Portal, then click SETTINGS to upload both certificates and enable back4app to handle Push Notifications in your app. 

Configure Apple Push Notifications

The Parse Dashboard

Let’s explore the awesome Parse Dashboard now. This is the database where your data will be stored and you can edit them as you wish. It’s kinda working on an Excel file since Parse Server is based on Node.js – no MySQL involved – so it’s pretty easy to get stuff done with the Parse Dashboard.

From the top navbar, click on Dashboard. The browser will load the page with a list of your Parse Apps. If you’re reading this article for the first time and have created an App – as mentioned in the beginning – you’ll obviously see one app only. Anyway, this is how the Parse Dashboard’s home page looks like:

The Parse Dashboard’s Apps List page

Click on the app’s row to enter its Dashboard. By default, the Role and User classes will be automatically created, check them out from the left-side menu.

Empty Parse Dashboard

Let’s add a new user in the User class, we’ll do that manually just to get familiar with the Dashboard’s commands and UI. When you add a user, the mandatory data are username and password. So you can add a row in your database in 3 ways:

  1. Click the Add row blue button in the middle of the page
  2. Click the Add row custom button on the top-right corner
  3. Click the Edit button on the top-right corner of the screen and then Add a row
Add a row options

After you’ve created a new row, just double-click into the cell of the username column and type johndoe. Then double-click on the cell of the password column and type a password. Lastly, you may also add an email address in the cell of the email column, and I guess you know how to do that now 🙂

New User’s row added

Let’s now create a Column, you have 2 ways to do that:

  1. Click the Add column button on the top-right corner of the screen
  2. Click the Edit button -> Add a column link
Add a column to the database

A popup will appear, you have to choose the type of data you want to create and type a name for it.

Add a new column’s popup

You can create the following data types:

  • String – a field that stores strings
  • Boolean – either True or False
  • Number – a float or integer number
  • Date – any date
  • Array – usually an array of Strings. Its syntax looks like ["lorem","ipsum","dolor","sit"]
  • GeoPoint – Latitude and Longitude values, something like 12.123456789 | -74.123456789
  • Polygon – another way to store Latitude and Longitude values, in a JSON format that looks like [ [ "12.123456789", "-74.123456789" ] ]
  • File – any file (images, videos, PDF files, etc.)
  • Pointer – a link to a row from another Class of the database
  • Relation – a relation to another Class

For more info about Parse Server, check the SDK guides at https://parseplatform.org/

What about creating a Class? You have 2 ways to do that as well:

  1. Click the Create a class button on the left menu
  2. Click Edit -> Add a class
Add a Class to the database

Another popup will show up. By default, it shows the Custom type class – keep that, we don’t need to deal with the other existing classes – and an empty field where to type its name.

Choose Class type and give it a name

Type Products and click the Create class button. The page will refresh and show your brand new Class, its name on the left menu and the default, undeletable columns.

The ‘Products’ Class you’ve just created

When you add a row, either via a mobile or web code or manually in the Parse Dashboard, the following columns get automatically generated:

  • objectId – a unique row’s identifier
  • createdAt – the date you’ve created a row
  • updatedAt – the date you’ve updated a row
  • ACL – the Access Contro List for a user

Let’s now add a Column to our Products class, a String type, and call it name. Then click the Add column button.

Add a new column to the ‘Products’ class

At this point, you can add a new row, double-click in the cell of the name column and type whatever you want, something like Shoes, for instance. When you hit Enter, you’ll get something like this:

The newly added product

I want to explain to you what the other Parse Dashboard’s commands are about, check the following Toolbar:

The Parse Dashboard’s toolbar
  1. Add a row button
  2. Add a column button
  3. Refresh a Class data
  4. Open a Class Index Manager
  5. Search filter for the database
  6. Edit Class Level Permissions
  7. Edit button

If you want to get into more info about those functions and the back4app’s environment, check out the official Documentation here: https://www.back4app.com/docs/platform/get-started/backend-as-a-service

One more thing before ending this article, you are allowed to add a collaborator to your database, like a developer who will have access to your database and can edit data while working on it (for instance, when he’s building an app for you using the Parse Server SDKs).

From the left menu, click the App Settings link:

You’ll be redirected to a page where there’s a Collaborators section and an empty filed. Type or paste your collaborator’s email address, click the ADD button and the Save Changes button on the bottom of the screen.

PLEASE NOTE that if your Collaborator must have a free account on back4app

Add a collaborator’s email

Conclusion

That’s all for this tutorial, you have learned a lot about the main features and options of Parse Server hosted on back4app.

Hope you enjoyed this article, feel free to post comments about it. 

Buy me a coffee - XScoder - thanks for your support
Your support will be highly appreciated 😉