How I Built a Cloud Native Mobile App?

How I Built a Cloud Native Mobile App?

Visually impaired or specially-abled need a scribe to write an exam for them. I had a first-time experience of scribing in 2018. After, for a while was thinking of how technology can help in getting scribe service within a time and not limited to metro cities like Bangalore. Then came the idea of creating an app to act as a bridge between Scribe and students. Due to various reasons couldn’t materialize the idea until corona strike the world. Corona time has allowed me to think and execute this idea. Following covers technical journey into building and launching of this app.

I started to work on this as early as October of 2020. Very soon realized the need for the clear goal of the app and high-level use cases to be defined. The goal is to “Connect Scribe with Aspirants”.

High level use cases

I started with pretty ambitious use cases. But eventually reduced the use cases to suffice MVP (Minimum Viable Product) for the initial release. Since my main strength is in backend development, started with the design of APIs to cater to identified use cases.

API design to cater use cases

Before jumping into coding, needed to define the data model for the app. I felt this was the most critical part of application development. This will directly affect your API design and implementation, performance, and maintenance of the application.

Data model

Now that the design is ready, need to decide on a technology. Since I am familiar with Spring boot and Postgres, they were my first choice for backend and database. It will be an application with a single microservice (or you can call it a monolith 😉).

However, extra caution was exercised while designing the data model and APIs to avoid tight coupling between seemingly different resources. This can ensure, to break the application into microservices, if needed.

Jumped into Intellij and coded 👨‍💻 for the next 3–4 months (of course, using my free time apart from work hours 😊) for the backend development.

Unit tests helped me to implement and test most of the APIs without having any front end yet.

After 2 months into development work and most of the APIs are almost done, I had this realization about JPA. JPA was making my implementation seemingly complex and the data model doesn’t seem to be properly normalized.😕 Then I was looking for an alternative to JPA which is simple and makes things more evident. Spring Data JDBC seemed promising. Then, it took me about a month to revamp everything from JPA to Spring Data JDBC. It was worth it. Now the application behavior was more predictable.

Now, that backend is ready, time to jump into the front end. As it’s going to be a mobile app and probably in both android and iOS, was looking for good hybrid platforms. React Native and Flutter were top contenders. I settled for React Native by its acceptance rate and community support. Spent the next 2 months learning React Native. The course by Mosh Hamedani was incredibly helpful.👍 Also, accessibility support from react native is quite decent for my need.

Next, needed to define wire mocks to achieve the above-described use cases. During this process, I discovered few missing use cases.

Hence, I think it’s better to design wire mocks initially and probably much before the design process.

Sample screen design

Spent the next 2 months implementing the front end. It was challenging! For me, being a beginner in React Native, it took me a while to figure out the nitty-gritty details of it. Finally, by June 2021 was able to integrate and test the application with the backend. React Native with Expo turned out to be developer-friendly and reduced development time.

Next, to deploy the backend application and database, Kubernetes seemed a natural choice. Tested the application in the local environment using K3s.

Local Kubernetes cluster

I left login screen integration postponed till the last moment as it doesn’t seem to be blocking any feature implementation. Keycloak seemed a better choice for the IAM server compared to other paid alternatives. It does come with its learning curve for the configuration of OAuth and service accounts. It took me a while to integrate Keycloak with Spring Security. Spring Authorization Server is another upcoming promising alternative worth trying.

After successful local deployment, the next is to deploy into a cloud environment. Here, my main criteria were cost and ease of use. I selected GKE of GCP (Google Cloud Platform) for cloud deployment. The main challenge here was for database deployment since it needs to be fault-tolerant and highly available. GCP provides regional persistent disks for this purpose. But it seemed to be costly when compared with Cloud SQL of GCP. Hence, deployed DB to Cloud SQL. To deploy to Cloud SQL, need to ensure that GKE cluster and the Cloud SQL Postgres instance are in the same VPN. In the past few weeks, I have observed even GCP with managed Kubernetes turning out to be expensive. I may switch to cheaper alternatives such as Linode or Digital Ocean.

Next, time to publish the app to the play store. Since I had the developer account of Google Play Store, wanted to deploy the android app, for now. React Native with Expo makes it a breeze to create an app bundle for deployment. Once the app is submitted to Google Play Store, it takes 3–7 days to appear in Play Store. Finally, the app was accepted by Google and appeared in the store in the 4th week of August 2021.🚀

Now since the app is launched, its time to breathe some fresh air and connect to self.🧘‍♂️ I hope people will find it useful and effort was worth it. 🙏