What’s new in Back4App?

What’s new in Back4App?

Our mission at Back4App is to help developers create better code and apps faster, which is why we have been evolving our BaaS platform, introducing intuitive features, and improving our existing capabilities.

Now, we are pleased to announce that Back4App has rolled out a raft of robust and advanced features for the app developers. The new changes and improvements include the latest version of Parse: the Parse Server 3.1.1, a new code assistant to perform CRUD operations in the Back4App cloud database, improved push notification mechanism, query caching option, and the new Analytics toolset.

We’ve been hard at work and wanted to share our latest product updates below.

1-API Reference code assistant

In a recent update, we revamped the way to give the first steps at Back4App by launching the  API Reference code assistant. You can now easily produce code to connect to your backend just by picking your language of choice, and you’ll be querying objects in no time. You just have to choose the class you want to see the CRUD code(create, read, update and delete) and click over the API reference link.

api-reference

Automatically Back4App will read your class and generate the front-end code necessary to make the main database operations: create, read, delete and update. You have just to select the code you want to see, copy it and use on your project.

api-reference-code-assistant

The barrier to entry has never been lower! Get started and create your account today to take you from proof of concept to the top of the app store charts.

2-Parse Server 3.1.1 is available here

We are proud to announce that the new Parse Server version 3.1.1 is now available at Back4App.

We truly believe that open source is the future.  When developers have the freedom to use a platform based on open source technology it gives them real control over their solution. It offers developers the ability to change whatever they need at any time independently of the stage or size their apps have reached.

The new version “Parse server 3.1.1” is designed to improve the development experience and code maintainability of your app. Instead of traditional Cloud Code syntax, this edition is far more amenable to leverage the new es6 async, promising functionality, and await constructs.

In a nutshell, it precisely focuses on making an app experience even more robust, seamless, enjoyable, and secure for the end user. Here is an overview of the recent features and improvements offered by the most renowned and advanced open-source Backend as a Service (BaaS) framework:

2.1-Cloud Code Syntax Clean UP

A highly significant clean up of cloud code syntax now makes it much easier to leverage the es6 async and await constructs. This update involved the removal of response.success / response.error from the code. A refactoring attaches async to all cloud functions so that any function that uses await now needs to be declared with the async modifier.

The new interface uses promise constructs so your code can wait for the results of a promise instead of relying on difficult to read the then/catch blocks. Key coding advantages include:

  • Less need for boilerplate code
  • Improved readability of asynchronous programming
  • More explicit pipelines.
// Before: Parse Server 2.8.4 and previous versions
Parse.Cloud.define((request, response) => {
  query.find().then(result => {
    response.success(result)
  }).catch(response.error)
})

// Now on Parse Server 3.1.1
Parse.Cloud.define(async request => {
  let result = await query.find()
  return result
})

2.2-Aggregate update

Starting with Parse 2.7.1, it has been possible to use the aggregate method on a query.

The most recent improvement upgrades the syntax for the aggregate method on Parse Query. This coding change enables you to execute a query using two stages: the match and the group stage (the pipeline key).

2.3-Cloud Code runs with Parse-SDK 2.x.

In previous versions, Cloud Code ran with Parse-SDK 1.x. With Parse Server 3.1, it runs Parse-SDK 2.x.Although this major version increment incorporates some very significant bug fixes it also adds containedBy and includeAll query methods, plus the capabilities to fetch an object with includes.

2.4-Cloud triggers update

You can share data between the beforeSave and afterSave triggers on the same object. See below how.

Parse.Cloud.beforeSave('Comment', async request => {
  request.context = {
    foo: 'bar'
  };
});

Parse.Cloud.afterSave('Comment', async request => {
  console.log(request.context.foo); //Bar
});

2.5-LiveQuery Improvement

The Parse LiveQuery client allows you to subscribe to queries, and receive updates from the server as they come in. Traditional Queries are executed once from the client, so this is very helpful for cases like messaging etc.

With Back4App you can also take advantage of this technology With the release of 3.x, the Parse community has improved the system for Live Query ACLs.

You can pass a session token now to the subscribe method of a live query, and the Parse Server will manage only returning results that this user has access to. For example, a user may have read/write access to certain ‘Messages’, but not all.

The above code will automatically subscribe to all messages that the user has access to, relieving you from the responsibility of querying specific messages.

 

   let query = new Parse.Query('Message');
   // you can get session token with
   // Parse.User.current().getSessionToken() when logged in
   let subscription = client.subscribe(query, sessionToken); 

Upgrade now to Parse Server 3.1.1!

3-Query caching option

To enable the caching of big queries and to significantly improve the handling of all query sizes, we’ve developed and open sourced a new npm module Parse Cache.

As we already know that one of the most common bottlenecks in terms of performance is continuously accessing a database, which can be relatively expensive to make requests for distinctive expressions. Our cache module acts a powerful middleware that boosts your app’s performance without any external dependency since accessing and reading from a cache is fattest than accessing and reading from the database.

This caching module is already available by default on Back4App and can be used on Parse Server version 2.8.4 or higher through a simple cloud code function. See below how to use it on a cloud code:

 

const RecordObject = Parse.Object.extend('Record');
const query = new Parse.Query(RecordObject); // or const query = new Parse.Query('Record');
 
query
  .cache(30) // The number of seconds to cache the query.  Defaults to 60 seconds.
  .equalTo('someField', 'someValue')
  .find(); // you can use find, first, count, countDocuments, estimatedDocumentCount, aggregate, each, get or distinct
 
// on a cloud code with 10s ttl
Parse.Cloud.define('test', function(request, response) {
    const query = new Parse.Query('SomeClass');
    query.cache(10).first().then(f => response.success({fromCache: !!f.fromCache})).catch(response.error)
});
 
// calling your cloud code
curl -X POST -H "X-Parse-Application-Id: your_app_id"  -H "X-Parse-REST-API-Key: your_rest_api_key"  -H "Content-Type: application/json" -d "{}"  https://parseapi.back4app.com/functions/test
 
// the result should be
{"result":{"fromCache":false}}
 
// then run the curl again and...
{"result":{"fromCache":true}}
 
// then run again after 10s and...
{"result":{"fromCache":false}}

 

It is also possible to use it directly from your javascript front-end code. To enable that you should install the Parse Cache npm module on your front-end and setup an appropriate cache on the client side (browser). See below how to use it from your javascript code.

 

<script>
    parseCache(Parse, 'MyUniqueAppNameOrKey', {engine: 'memory', count: 1000});
</script>
<script>
    var query = new Parse.Query('TestClass');
    query.cache(60).find().then(function (results) {
      console.log(1);
      results.map(function (r) {
        console.log(r.fromCache);
      });
      console.log(results);
      query.cache(60).find().then(function (cachedResults) {
        console.log(2);
        cachedResults.map(function (r) {
          console.log(r.fromCache);
        });
        console.log(cachedResults);
      })
    });
  </script>

4-New Push mechanism

We responded to concerns developers raised about their inability to track the successful delivery push notifications or investigate why deliveries fail. Back4App’s major upgrade to the Push notifications mechanism enables sending many more push messages at a much faster rate than previously. Each push message delivery is now logged, including those activities that generate delivery errors. This makes it easier to discover why certain push messages return errors, and to work out a solution.

5-Analytics

Recently we rolled out an exclusive, advanced event-driven analysis module called Analytics. Analytics is a powerful tool at Back4App Platform that helps in gaining insightful information about your app visitors and measuring app usage in real-time. It’s a collection of free and cutting-edge solutions that provide you with informative and statistical reports about growth, user behavior and performance of your app.

audience-report

Understand how people are using your app. Measure growth over time, and examine your app’s retention rate. Get to the bottom of slow queries and investigate what’s happening with your app’s API requests.

Using Analytics reports it’s possible to determine how your consumers are using, interacting, and engaging with your app as well as how frequently, and when. Moreover, these reports enable you to identify performance improvements opportunities and manage these activities to achieve sustainable results regarding App requests.

Back4App delivers you a set of pre-defined, automatically generated tracking reports, including Audience reportsEvent reportsPerformance report, and Slow queries report, to help you track and analyze engagement, conversion, usage behavior, and other significant app metrics.

 

A Word of Appreciation

I’m proud of how our team has worked so well together to introduce so many improvements to the platform. I hope you’ll come to appreciate how these enhancements save the developer’s valuable time and effort.

Read on for more additional details, and keep an eye out for continued improvements to your Back4App experience in the coming months.

 

What ease can you experience with cloud code syntax cleanup?

This is a highly significant cleanup which is meant to make it easier to power es6 async and construct awaits. This update is effective to remove response.error and response.success from code.

How back4app handles all query sizes?

Back4app has brought an effective way to handle all query sizes. Developers now can enable the feature of caching big queries. This is not only effective to handle different sizes of queries but can also work effectively to improve database performance in the best possible way. 

Is back4app offering push notifications log too?

Yes, this is another new in the back4app. This was one of the most common concerns of developers. With back4app, every delivery of push will be logged, including the ones which have generated delivery errors. Ultimately, developers will be able to track their successful and unsuccessful push deliveries effectively.


Comments ( 2 )

  1. Leland
    I like the improvements described in the article. I will give a good test. It is also good timing. I have converted my code base to react native and now have to make a decision about the database. Considering Firebase or Parse as a backend. This will impact about 60 customers of mine and I want to make a long term decision once.
  2. Zig
    Oh yeah. About six months ago I asked about es6 support and had to dump Back4App as my provider because it didn't have it. With this update I know where I'll be hosting my next app! Thanks!

Leave a reply

Your email address will not be published.