Drupal can be a great backend platform for building native mobile applications rapidly. For those not familiar with Drupal, it is an open-source content management system like WordPress that has been gaining popularity and attracted a strong base of developers and users since it was initially released in 2000.
I had opportunities to use Drupal on a number of mobile app projects and those apps have been in production for a few years now without any issues.
Here in this post, I’ll summarize some of the benefits of using Drupal as a mobile backend platform and maybe go into details of how to implement specific features such as location-based query, notifications, and search at later posts. You will see that Drupal takes care of much of heavy lifting when it comes to mobile app development and all you really focus on is getting data from Drupal via REST API and building the presentation layer on your mobile app.
Please note that even though you can still build mobile apps with Drupal 7, when I say Drupal in this post and forward, I am referring to Drupal 8 as this new version makes app development much easier and faster.
Flexible Content Modeling
One of the popular features of Drupal is its flexible content modeling which makes creating new content types a breeze. Without writing a single line of code, you can create pretty complex content types (post types for those coming from WordPress background) within minutes. Let’s say you’re building a Yelp-like review app and creating three models – user, business, and review – and each has its own set of fields as following:
If you know a little about how Drupal content modeling works, creating above data structure in Drupal would take less than 15 minutes. Additionally, Drupal provides a number of field types – string, email, phone number, address, date just to name a few – that creating new fields of a particular type and adding them to a new or existing model is very easy. Yes, if those are the three models and fields that you know you will need, you can use frameworks like Laravel and code yourself.
However, a lot of times, when you are building a new application and you don’t have all the requirements identified, reviewed, and finalized, you end up making a lot changes – changing model or field names, changing field type, deleting and adding new fields that you didn’t foresee, etc. And because Drupal provides user-friendly interface for modeling these content types, you can model your data structure fairly easily and quickly.
Built-in Web Services REST API
Drupal has REST API built-in and any content types created from content modeling and the actual content you create can be exposed through the API. This makes it easy to expose single content as well as list of content where you can control sorting, filtering, and what fields to expose for each content type.
The feature allows you to select JSON or XML, or both, and authentication is also provided: basic and cookie-based. More advanced authentication types are available through contributed modules which are all free.
Drupal provides easy-to-use backend interface where you can easily update your content. Other mobile backend platforms such as Google Firebase, Kinvey, and Parse (no longer in business and only provides SDK for developers) provide similar backend services for building mobile apps but I believe they do not provide easy-to-user interface for updating content using browsers.
Ability to update content means that you can publish your mobile apps and control the content using browsers and the content in the apps will reflect the updated content instantly. This is great for online publishers who want to build a mobile app and also have complete control over the app’s content while the app is in production.
Option to Build Web Application
Let’s say that the initial requirements require you to build mobile app and mobile app only. Later on, market changes and mobile app users are looking to use the same service through browser on their laptop – it is common to see nowadays services or ideas being developed as mobile app first and then later web app being built. If the mobile app was built on Drupal, you’d have the web application already built and would mainly focus on the look & feel – theme – of the web app. This is available to you whether you build your application as mobile-only or mobile and web together.
Other Useful Features
Drupal provides Geolocation module which you can use to convert address field to latitude and longitude coordinates. So in the above example data structure, you would be able to easily query businesses over REST API and have the them sorted by distance from user.
Private message module along with the Services module means that you can easily build a messaging app where users can send messages to each other. However, this module hasn’t been ported over to Drupal 8 yet.
You can use Drupal as the notification server and send notifications to both iOS and Android devices. I haven’t tried this yet on a project yet but am looking to try it out as the Drupal 8 version of the Push Notifications module was recently ported over.
On top of all, Drupal is free and open source. There are tons of modules you can use and if something doesn’t meet your needs, you can always improve the current modules or create a new one.
If you are a mobile app developer, you should give it a try. It may not give you everything you need to build the next big social media app like Facebook or Snapchat, but I think it’s good enough to build a decent app that you can publish in app stores. At least, I plan to continue using it on new projects.