The plan is here:
- Why exactly backend is required
- What is the traditional approach
- What is BaaS
- What are the major vendors
- What are the niche vendors
- How to they compare in terms of capabilities and pricing
- How to decide
- What we leared or TL;DR
Why exactly backend is required
Let's imagine we are doing a pet-project: a mobile application for a todo list. We want to write down some todos, add some photos and mark them as done. We also would like to get the lists and todos synchronized between several devices. Let's find out what we would like our backend to do.
Store and process the user data
So, we need to store 3 types of data: user accounts, todo lists and items and media(photos).
Register and authorize users
We definitely do not want everybody to see the todo items of everybody else. So we will have the user accounts, and we need to serve the user data to an authorized user. We also need an ability to register in the system: let's say with email and password, or with a phone number.
Sync data and send push notifications
We agreed we want to sync the data between the mobile app installations. Also you might want your users to get a push notification: about the times runs out for a todo or for some marketing communication(do not do this, please!). Anyway, we need the push notifications support, which is impossible without having some backend.
Accept payments
Eventually you would like to start earning money out of your solution. Even with In-App Purchases you need a backend to verify the payments and properly unlock features.
What is the typical approach
Here is simple diagram for traditional approach:
We have a mobile app, external services(for notifications) and some backend, deployed to a cloud provider. The backend solution consists of API Gateway, a bunch of services and a couple of data storages. The problem is that this cloud rectangle is not comprehensible of you don't have relevant experience, which is the case of most of mobile developers. This is the moment when Backend-as-a-Service comes into play.
Aside of the component complexity, we need to account for the deployment and maintanance complexity. Usually you have to deploy the databases and services, monitor it, backup the data, restart the crashed services, pay for domain names, hostinga and storage and so on.
What is Baas
Basically Baas abstracts you from all this complexity:
What are the major BaaS vendors
Nowadays we have 3 big vendors:
- Amazon Web Services
- Google(Firebase)
- Microsoft Azure
Amazon
Amazon has plenty of services propositions for different types of needs. Amazon Amplify is one of the them. It is a set of tools to spin up the required services quickly, and, what's more important granuarly. For example, you can use only the authentication, or only object storage, or combine them. Β
But today I want to focus on a new service called Amazon AppSync. This is a no-code GraphQL service with real-time and offline capabilities, which are crucial for our TODO app.
Capabilities
- API Url
- Functions via AWS Lambda
- User Pools via AWS Cognito
- DynamoDB tables(NoSQL Data Store)
- Binary storage(via S3)
- Caching
- Logging
- WAF(Web Application Firewall)
- Monitoring
Pricing
You are paying as you go: only for the resources you consume. There is a detailed page on pricing. For our TODO app used by ~2500 users we will have to pay approx $15/month. Β There is also a free tier which should be sufficient to start.
Pros
- Easy setup π
- Great documentation π
- Easy start of using AWS π
- Decent free tier(first year) π
Cons
- No analytics and crashreporting π
- Credit card required to start π
Google Firebase
Mobile developers are highly likely to know about Firebase: they typically use it for crash reporting or push notifications, or application analytics. However, Firebase offering is much richer than that. You can think of Firebase as a fully blown Backend as a Service. So, what's in there?
Capabilities
- API URL
- Firebase Functions(with JS)
- Authentication/Authorization
- Firestore(NoSQL Data Store)
- Real Time Sync
- Object Storage(for photos/videos/etc)
- Machine Learning
- Crash Reporting
- Mobile Test Lab
- Analytics and Performance Monitoring
- A/B testing
- Remote-config
- Dynamic Links
Well, that's impressive!
Pricing
It all depends on what exact capabilities you will be using; however the todo app for 2,500 users should be free. For bigger user bases there is a convenient calculator to help you with pricing.
Pros
- Easy Setup π
- No credit card required π
- Many capabilities offered π
- Already known by developers π
- High free limit π
- Convenient calculator π
- SDKs for every mobile platform you will need π
Cons
- Only JS for Functions π
- Once you hit pricing, it will be hard to calculate π
Microsoft Azure
The 3rd vendor is Microsoft. And no wonder: Each of those 3 has significant cloud capabilities, and offering something for the mobile is an essential step forward. At least, Microsoft was thinking that 4 years ago.
Unfortunately, the service is no more. Microsfot discontinued the Azure Mobile Apps service. Now you can use only a generic App Service, which is a platform for containers. As a mobile developer, you don't want to use that. Case closed.
What are the niche BaaS vendors
Aside of big players, there are some niche vendors which can offer some capabilities as well. Each of them are specialized in a particular area like collaborative editing, hybrid mobile apps(WebView + HTML/JS/CSS) or iOS only synchronization. Let's take a look.
MongoDB/Realm
Realm is an engine for real-time synchronization. MongoDB bought them some time ago and made them a part of their Mobile Backend a as a Service offering. Let's take a closer look.
Capabilities
- User signup/sign-in
- Google/Facebook Integration
- NoSQL storage(Mongo!)
- GraphQL API
- Functions
- Push Notifications
- Secret Management
- Logs
- Real-time data sync
Pros
- Easy setup π
- No credit card required Β π
- Supports collaborative editing πππ
Cons
- No Pay-as-you-Go offering π
- Low count of features offered compared to other services Β π
Pricing
Free tier will be enough for 2500 users. For storage data exceeding 10GB you will be charged $57/month.
iCloud
iCloud is a special item here. It targers only the iOS devices and provides only a capability to sync the data. However, it is really easy to enable and use in iOS environment. Only few steps required:
- Enable CloudKit in Xcode
- Create data scheme
- Start writing data
- Subscribe for data updates
Capabilities
- iOS SDK
- JS SDK
- NoSQL database
- Binary Storage
Pros
- Direct writing π
- Easy integration π
- Enormous free tier πππ
Cons
- Only data sync π
Appcelerator
- Named Titanium before
- SDK for JS
- Mobile Backend services
Capabilities
- API Connector
- API Runtime
- Push notifications
- Object store
- User Management
- NoSQL DB
- Analytics
Pros
- Good if you already have a hybrid app Β π
Cons
- Only JS everywhere π
- Pricing π
Pricing
Starts from $21/month
Back4App
Capabilities
- API Management
- Push Notifications
- Analytics
- Jobs
- Logs
- Remote Config
- REST/GraphQL console
- In-browser IDE
- Sign-up/Sign-in
- Facebook/Twitter login
Pros
- Easy setup π
- No credit card required π
- Really convenient web-console π
- Good to spin up API in JS in no time π
Cons
- Really tiny free tier π
- Good enough tier starts from $40/month π
- Narrow capability scope π
Decision Tree
What we learned today or TL;DR
You can spin up a backend without coding in under half an hour including the registration in a new service and getting your first API up and running. You can forget about scalability, monitoring and other stuff - it gets abstracted from you by Baas. There are plenty of services to do that for you, but there are only 3 great ones. If you don't know what to start with, pick up Firebase.
Don't forget to smile alright! If you have questions or just want to thank me, you can do it on twitter.
Also, if you liked the article, make sure to Subscribe for the upcoming articles as well!