BaaS – Introduction
Backend as a Service, or depending on your tastes, Mobile Backend as a Service or even Server Stack as a Service is a relatively new cloud offering that is starting to gain momentum in many areas, not just the mobile world.
BaaS, as we shall call it for the sake of brevity, has carved its own little niche nestled neatly between Platform as a Service (PaaS) and Software as a Service (SaaS). Unsurprisingly, it does exactly what it says on the tin – that is – it provides a near complete server side stack including persistence, user management, data retrieval and querying, file storage and a few other things at the flick of a switch.
While the original intention of these BaaS offerings was to avoid the friction and pain of setting up and maintaining a server backend for mobile developers, their use has become much more widespread. After all, if all you need is some data storage and/or some user management why not?
Features of BaaS Offerings
This area of the cloud is still in its infancy and evolving on a daily basis. The competition is quite strong with various companies looking to find a unique way to establish their product, however there are a number of baseline features that you should expect from these providers.
Basic Data Storage and Retrieval
Obviously the most important aspect of any of these services is a way to store and retrieve your data. This is especially useful in mobile situations where you may not be bound to a single device or in a social or collaborative application that requires data be shared.
Existing services offer a somewhat schema-less storage model and adding new object properties (or in a relational DB sense – columns) is a matter of adding them to your client code and pushing the new data. Current services do offer a certain level of control around schema but this is fairly simplistic and not particularly useful for constraining data sent to the services. While this flexibility can be a boon to developer productivity initially its worth remembering that as your applications complexity grows you will need to keep tight reign on your schema.
Data types, as you’d expect, have a very mobile flavour. Your typical types such as Strings, Dates, Booleans, Numbers etc. are obviously all available but the other key types that you can expect to see is GeoPoints – the ability to store location and Binary – for storing media.
APIs and SDKs
Alongside these SDKs, there is usually a basic ReST API that allows other platforms or any bespoke solutions people may dream up to work with these BaaS offerings. It should be noted, however, that the ReST API is generally not as feature complete as the SDKs
While some of the todays services keep true to their mobile roots and officially only offer mobile SDKs, services like StackMob have embraced the extended use cases and made their own official Ruby, Scala and Java SDKs.
Simple fetches of single objects and entire collections are one thing but often it is necessary to perform slightly more complex queries against your data. These services typically offer a way to perform these queries against your collections. You’ll also find most services offer some sort of paging functionality to reduce the risk of unbounded queries being run against your data.
Additional queries that come into their own in the mobile space are also available – namely geospatial queries. For example all services typically offer queries such as “find me data points that are near a certain point” or “find me data points that are within a certain radius of a certain point” – so your “Best Bars in the World” app could easily show the bars/pubs/taverns that are closest to the users current location.
Mobile devices are equipped with all manner of data capture instruments – from cameras for pictures and video to microphones for audio. Its simply no longer all just typing words into a tiny keyboard and as such the BaaS services today generally offer varying levels of binary storage. For example, Parse offers fully integrated file uploading directly from their SDKs while StackMob simply offer a channel to add your own Amazon S3 configuration and access this data via their ReST API. Depending on your solution requirements this may or may not be an issue.
If you are storing users data its vital that all and sundry aren’t allowed to just access it. Parse, Kinvey and StackMob all offer various methods to lock data down in ways you’d typically expect such as granting read/write access to data depending on logged in status, to a particular owner/user, to a particular role. While each service offers similar features, there may be certain quirks or nuances that will want to validate against your requirements before settling on a specific provider.
What good is a server stack if you have no way to authenticate users? Not much I’d bet. Thankfully BaaS offerings typically give you the ability to manage users and perform the various things a user would want to do – login, logout, reset password etc. Most services offer integration into the Twitter and Facebook authentication modules
Finally, in the mobile world one of the key ways to notify users of changes to data or other external events is generally facilitated through Push Notifications. Available on almost every mobile platform, push notifications allow you to send data to users devices even when the app is running in the background. Without the use of a BaaS service you either had to write specific integration code to each OSs specific notification system or make use of another third party cloud service such as Urban Airship. With BaaS its entirely possible to roll all this into a single managed service – in fact Kinvey, one of the three main BaaS providers, actually integrates with Urban Airship to support push notifications.
Considerations for BaaS Offerings
Obviously as with all things cloudy there are some things you need to consider before signing your life away.
A common concern for cloud technologies is that of lock-in. You don’t want to commit to a service only to have the carpet pulled from under you in terms of pricing, support, data sovereignty etc. You want to make sure you can get your data out as fast as possible if you need to. You also want to make sure that platform specific code doesn’t propagate too far into your codebase or at least understand the risk involved if you do decide to heavily integrate some platforms specific functionality. For example – Parse offers an set of (entirely optional) UI widgets with their SDKs that allow you to quickly create login screens and Parse-data bound lists – if you decided you wanted to move to StackMob or Kinvey you would need to consider the effort required to essentially re-write those elements.
Where is your data being stored? If user data is important to you, and of course it is, you’ll want to understand the implications of storing data in certain geographic locations. For example, European user data stored in the United States is subject to certain US laws that it otherwise wouldn’t be if it was stored in Europe.
Not knowing where your data is stored or having the ability to relocate that data could land you in a sticky situation if a user takes exception to your current setup. This is an area that most providers seem to be a bit vague about.
Current BaaS services have varying pricing models. As with most cloud offerings they generally offer a banded cost model and all have a fairly generous free tier. Past the free tier different services offer different levels of granularity. Understanding typical usage of your app upfront is vital. In certain scenarios the monthly cost between any two services can be as drastic as the difference between $30 and $200 per month.
The BaaS world is still finding its feet and rather than being constrained to simply mobile devices they have been utilised in many other solutions and as such many are currently being offered as add-ons on popular PaaS services such as Heroku and AppHarbor. StackMob even goes as far as offering a PaaS model specifically for HTML5 apps utilising its server features. Its truly an exciting area to be involved in.
Hopefully this article has given you a better understanding of the Mobile Backend as a Service ecosystem. In my next article I want to cast a critical eye over the current offerings in this space (Parse, StackMob and Kinvey) and show you where they rise or fall in terms of features and concerns.
James works for Kainos Software Ltd. as a Technical Architect. He is Kainos' Mobile Capability Lead (and previously Microsoft Capability Technology Lead) and responsible for developer engagement throughout the company. In his spare time James likes to talk about himself in the third person, attempt to blog about technical things on http://yobriefca.se and troll Twitter as @kouphax