Feature: Nuwe Parse-Server


If you’re in any way involved in technology, you probably heard that the popular PaaS / BaaS platform Parse, owned by Facebook, decided to shut its doors. Developers have until January 28th 2017 to move their stuff.

This was quite a surprise to me personally and professionally.

Personally, I love Parse. It’s a superb tool for rapidly building web and mobile applications whereby you can focus on the client application and not carry the overhead of the full backend development when starting something new. It’s easy to use, feature rich and performs really well.

Professionally, Parse was both a service we aspired to be like in many ways and also referenced as the “competition” with our efforts at Nuwe. We foresaw that Parse could indeed have an interest in the same vertical (health) that we were interested in.

I was introduced to Parse CEO and co-founder Ilya Sukhar by friends from Prediction.io. We exchanged a few emails last year about his learnings creating Parse and to understand Parse’s potential interest in our segment.

We are looking at IoT as a category of developers we want to support better. We aren’t taking a verticalized approach to it so I don’t expect us to do anything health or fitness specific. We do want to enable Parse to run on the multitude of devices that are cropping up, though.

OK, so for what it’s worth, Health wasn’t specifically on their radar.

Moreover, when asked about the Health Apps that have been built using Parse…

I don’t know all the health related apps offhand. Why do you ask? We’ve seen moderate growth but there’s not a lot of big success stories out there driving more folks to jump in like there are in gaming, social, dating, etc.

So, for me this was a positive feeling that we could work with Parse and not against them. What Parse does so well at a generic level, with their mainly key-value data store based Core service, the easy setup of native Push Notifications, the ability to write & run custom scripts in CloudCode, their numerous mobile and web SDKs (which they would subsequently open-source) is an incredibly powerful resource.

I would rather avoid redoing all that great work and instead concentrate on adding functionality that would be valuable to our customers, but whilst Parse was an unknown entity in terms of Facebook’s long term strategy and intentions for the business, the risk was evident.

And so, whilst personally shocked at Facebook’s decision, I’m professionally over-the-moon. A fully open-source Parse is something I can get behind. I can contribute to and our customers can benefit from when coupled with the extended Nuwe platform.

So, a few weeks ago, we set about bringing Parse Server into Nuwe as a service. Integration is going well and we’re already starting to use it internally for apps we’re developing.

Here’s how it’s going to work…

Parse Server

Once you have a Nuwe account and an App created in your account, you will have access to the Parse Service.

A single flick of the switch is all it takes to give you your own hosted Parse-Server.

When you do this, Nuwe will do the following:

  1. Create a Parse Server model for your App. This will issue your Parse-Server tokens.
  • A Parse-Server instance will be setup for you from our Docker Manager.
  • A unique port will be created to our Parse MongoDB instance.

From here, you now have access to a completely isolated Parse-Server instance and access to the database cluster.

This is all completely isolated from our core Nuwe server and the Nuwe core database which powers all of our main API endpoints.

You will now be able to follow the appropriate Parse quickstart guide for your chosen platform, using the latest Parse SDK’s which give the ability to change the server url to your Nuwe Parse-Server.

When Should I Use This?

As I mentioned earlier, the use-case for Parse and the use-case for Nuwe are ultimately different:


  • A single federated User identity
  • Defined data structure for Health and Wellness data with ontologies
  • Server level automated integration with 3rd Party Health Apps, Wearables and Sensors
  • Higher level security and encryption for sensitive personal data
  • Granular permissions and scoping of data access for users data


  • User convenience model (PFUser)
  • Key-value data store for arbitrary / custom classes e.g. general app / business data
  • Fast read-write speeds
  • Robust SDKs for rapid app development
  • Create your own rest API structure

When used together, as we intend them to be, we have a powerful toolkit for building new health apps in a way that clearly differentiates between general application data and potentially sensitive User health data.

What’s Next

Well, we’re still developing the feature, but most pressing are:

1. Fully automated Parse-Server deployments
As of today, we still have to do the last deployment manually
2. Data Browser
We have already been busy building our own Parse-like data browser. so we are in a great position to very quickly have a similar service available to users who appreciated the content-editable data browser in the Parse platform that is sadly not included with the open source Parse server.
3. NUUser to PFUser compatibility
For apps using the NUUser, to have access to all the PFUser methods and just as easy to use NUUser methods without having to manage multiple User object types.
4. Notifications
See http://community.healthhackers.co/t/feature-nuwe-notifications/74/1

I’ll keep you updated on our progress with developments of this exciting new feature on the Nuwe platform and if you have any thoughts or suggestions on what you like to see, join the conversation.

Nuwe Parse Server - Javascript SDK Getting Started

We’ve now released the first version of the Parse Data Tables.

In your app > Data > Parse tab you will find listed all of your Parse classes.

Next up is CRUD actions for the data in the Tables UI, just like old Parse.


We’ve now got table editing for all the basic data types: strings, integers, dates etc.

We’re now working on the more advanced data types, like Pointers, Relations, Files which require some richer UI and handling in the data tables.

You can also now only add rows to your class table. We’re adding the ability to also add and edit your Schema, though with some limitations of the current Parse-Server library. Watch this space.


File Uploads are now working on Nuwe Parse Server.



passing the following in your Header params

Content-Type -> image/png
X-Parse-Application-id -> YOUR_PARSE_APP_ID
X-Parse-Master-Key -> YOUR_PARSE_MASTER_KEY (if required)

with a file attachment as form-data will successfully upload your file to the server. You can then add this File to another object, by passing an object that references the uploaded file and specifying the type.

PUT `https://parse.nuwe.co:YOUR_PORT/parse/classes/MyClass/2gf3g3h33

"image": {
       "name": "43v3j3v4j34v5jv563jh4v6j354vmnv_placeholder.png",
        "__type": "File"

There are more convenient ways to work with Files in the client SDKs



We’re still working very hard on our core Parse-Server integration.

I’m very happy to announce that we’ve enabled Cloud Code for your Nuwe apps.

What is Cloud Code?

Cloud Code is a feature that enables you to run some business logic, functions, tasks etc. on the Server, instead of on your client app.

What does it do?

An example could be, performing some queries and calculations on your Parse data, before receiving response in your client application.

You could perform certain functions on your data before it is saved on the database, such as validating it’s format, and responding to your client app accordingly.

You could perform some actions after saving to your database, like sending a notification to your team of a new user registration.

Parse JS SDK

In Cloud Code, you have full access to the Parse JS SDK, so that means Objects, Queries and all the other SDK goodness.

How Does it Work?

Your Cloud Code is a file that sits on your Parse-Server instance, the default file is called main.js, which must be present.

You write your functions in this file and they will be executed when called or for event based actions, like beforeSave and afterSave, when those events take place.

You can write your Cloud Code in your preferred text editor and then upload that file to our server, or alternatively, you can write your CloudCode in our editor in the Nuwe Platform and deploy with a click of a button

I’d like in future to add some features for this editor, to make it easier to write and debug your Cloud Code, such as console messages, autosuggest for JS SDK functions, js linting, that sort of thing.

Named functions can be executed via the client SDKs or the REST API.

For example, we have this Cloud Code function, taken from our BedWatch demo:

We want to create a function on the server that will return the average temperature for all the sensor measurements that are taken in the day time. The Cloud Code function will look like this:

Parse.Cloud.define("averageDayTemp", function(request, response) {
  var query = new Parse.Query("Environment");
  query.equalTo("day", request.params.day);
    success: function(results) {
      var sum = 0;
      for (var i = 0; i < results.length; ++i) {
        sum += results[i].get("temp");
      response.success(sum / results.length);
    error: function() {
      response.error("temp lookup failed for averageDayTemp");

By calling the define() method on our Parse.Cloud class, we are naming and defining the function.

After that, we use the Parse JS SDK to create a Query on our Environment class. That query will return only result that match the given day parameter (true == day time, false == night time). We could hard code this to day, but by using the request params, we can actually pass this information from the client and actually perform the same function on the night data.

From there, we loop over the results and add them up. Finally, we return the average temperature by dividing the sum by the number of measurements in the array.

The function will return this single value.

To call this Cloud Code function, we can use the following:


curl -X POST \
  -H "X-Parse-Application-Id: ${APPLICATION_ID}" \
  -H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{ "day": true }' \

In iOS:

// Swift
PFCloud.callFunctionInBackground("averageDayTemp", withParameters: ["day":true]) {
  (response: AnyObject?, error: NSError?) -> Void in
  let temp = response as? Float
  print("Temp: \(temp)")
// Obj C
[PFCloud callFunctionInBackground:@"averageDayTemp"
                   withParameters:@{@"day": YES }
                            block:^(NSNumber *temp, NSError *error) {
  if (!error) {
     NSLog("Temp: %@", temp)

In Android:

HashMap<String, Object> params = new HashMap<String, Object>();
params.put("day", true);
ParseCloud.callFunctionInBackground("averageDayTemp", params, new FunctionCallback<Float>() {
   void done(Float temp, ParseException e) {
       if (e == null) {
          // temp is returned

If you have a PHP client app:

$temp = ParseCloud::run("averageDayTemp", ["day" => true]);

or a Javascript app:

Parse.Cloud.run('averageDayTemp', { day: true }).then(function(temp) {
  console.log("Temp: " + temp)

Hopefully that gives you a good introduction to Cloud Code on Nuwe.


Jobs on Parse-Server, the ability to have long running background tasks that can perform some functions automatically, for example, when running on a timer or when some conditions are met, is a really useful part of the Parse.com feature set.

In Parse-Server, it’s a little more problematic, as Parse-Server doesn’t enable Jobs automatically, you need to set this up yourself.

The recommended way to do this, is to install Kue via npm

npm install kue

Kue is a priority job queue, backed by Redis. When you install Kue, Redis will be installed automatically as a dependency.

After installing Kue, it is available to you directly in your Cloud Code.


You can create a queue, by calling

var kue = require('kue')
  , queue = kue.createQueue();

When you create a queue, passing the type of queue and some arbitrary json hash of job info, the create function will return a Job object that can be save()d into redis. The save() function accepts a callback, that will return an error if something goes wrong.

You can use the title key to save the name of the queue, which will also be used in the UI, shown in your Nuwe Platform views.

When you save a job, the default priority level is set to normal. You can change this, by calling the priority() method before save

queue.create('email', {
    title: 'welcome email'
  , to: currentUser.email
  , template: 'welcome-email'

Jobs can also be delayed for a set period of time, using the delay(ms) method. You pass the number of ms relative to now as the parameter. Alternatively, you can pass a Javascript Date object with a specific date/time in the future. This will automatically flag the job as delayed. Kue will check the delayed jobs with a timer, promoting them if the scheduled delay has been exceeded, defaulting to a check of top 1000 jobs every second.

var email = queue.create('email', {
    title: 'Account renewal required'
  , to: currentUser.email
  , template: 'renewal-email'

Jobs has lots more features besides these that I’ve mentioned:

  • Failure Attempts
  • Failure Backoff
  • Job TTL
  • Job Logs
  • Job Progress
  • Job Events
  • Queue Events
  • Job processing concurrency
  • Pause processing
  • Updating progress
  • Graceful shutdown
  • Error handling
  • Lots of stuff for Job Maintenance

I’ll be sure to write more about them with specific examples in the near future as we really figure out how to make the most of them in the Nuwe Platform / Parse-Server service.