Backend-Driven Mobile Apps

Backend-Driven Mobile Apps

Languages and Cross-Platform Approaches

The more you build native mobile apps, the more you realize the pain that supporting client-side business logic brings, due to the nature of mobile app versions having a long life. The idea of building apps that are mostly backend driven will likely come around sooner or later.

Sending executable logic to the mobile app is treading on thin ice. Apple has prohibited all forms of executable code up until 2017, when they softened this policy for developer tools. Sending JavaScript code from the backend to the mobile app is currently allowed. However, Apple could decide to change this policy in the future.

Sending over metadata that controls the mobile app’s behavior is a more common approach: this solution is future proof, on iOS as well. The idea is to create a “shell” that interprets the metadata and dynamically builds interfaces and functionality in the app. Apps like this still cannot get around the fact that the mobile “shell” can not be updated easily. The “shell” should contain no client-side business logic beyond interpreting backend instructions. Even for the v1 of this “shell”, you’ll need to think several backend versions ahead.

The backend will need to be aware of different mobile versions, and ensure it sends compatible “messages” to each client. This leads to needing to decide how to handle versioning: when to make changes to an API, when to introduce a new API version, or when to create a new endpoint.

Luckily, neither versioning nor building for backwards-compatibility are novel problems. Still, if you decide to build a mobile “shell” that interprets metadata, you will probably be up for a challenge. At Uber, we built an in-house system similar to this, and learned the hard way to not ship hardcoded client-side logic in the “shell” code, on how to get versioning right, and how challenging testing of such a system can be.

You are reading an early draft from the book Building Mobile Apps at Scale. For the final, expanded and improved content, grab the book now - it's free to download as a PDF until 31 May.

Building Mobile Apps at Scale

"An essential read for anyone working with mobile apps. Not just for mobile engineers - but also on the backend or web teams. The book is full of insights coming from someone who has done engineering at scale."
     - Ruj Sabya, formerly Sr Engineering Manager @ Flipkart

Get the book here