Lean Architecture in the Cloud
How to develop and validate rapid prototypes (or Minimum Viable Products) really fast and cheap? Your software architecture needs to answer this question.
First, you need to be in the cloud. Then you need to be Mobile and Web. Yes, we are in 2020 and these are not optional anymore.
The question is how to do a fast app, test ideas, validate features and get some clients before spending tons of money with development, infrastructure and lots of code. And how not to get bankrupt with all the bug fixes and maintenance problems that is going to happen?
One answer is the diagram below. A practical architecture designed to have daily software updates as fast as your clients can think of them.
This article will be long. Be patient because it will describe every step of the diagram. Just choose what you want to read, as a menu.
- Today’s options
- What is Lean?
- PWA
- Ionic
- Firebase Messaging
- Firebase OAuth
- Build-Measure-Learn
- Analytics
- Serverless
- App Engine
- Google Cloud Platform
- API Endpoints
- NoSQL
- BigQuery
You can see the slides of this article here: bit.ly/ArchLeanAlline
Today’s Options
Software market got insane. There are so many options that if you are a normal person, you can’t deal with it anymore. The solution is: simplify or die.
Below we talk about some of the best options available at this moment to build something practical, fast and affordable, so we can focus on real users and develop what matters.
What is Lean?
In short, Lean is a way of delivering more value while eliminating waste.
In software development we talk a lot about MVP, but to really understand what that is you need a lot of practice. Start reading about it here, and you can practice this mindset using the architecture described below.
PWA
First option in software development could be your frontend because that is, by definition, what users can interact with. What languages and tools to use?
Native Apps are hard to develop and even harder to distribute. To start lean, to validate features fast, to know your clients and find exactly what they will pay for, before spending money with development enhancements, go for the Web. Precisely, WebApps.
Service Workers, from PWA, can make your app looks very likely they are native. And even better.
To be even simpler you can start framework free, it is cheap and avoid maintenance headaches.
Ionic
Even with a PWA you still can push your app to the Mobile Stores. Native platforms have a component called WebView that can be used for that, and it works well.
Instead of developing native code for all different types of devices, you can start light developing simple typescripts with Hybrid frontend platforms.
Ionic can make your life easier. It creates the WebView component in a Javascript format and automatically generates the native code for the mobile platforms (iOS and Android, for example).
Firebase Messaging
On your Ionic typescript you need to configure the push notification token for the device. It needs to come from the client’s mobile to show as app notification.
Google Firebase has a plugin for push notifications called Cloud Messaging. Try it out here.
Firebase OAuth
Don’t start your code with the login page. Who cares about login pages?? Just use some plugin for login and authentication and focus on what clients really want. Many plugins out there will do the job much better than any of us. Let it go.
One example is the Firebase Authentication. The plugin for Javascript, or other languages, does the work for you with many options.
Build-Measure-Learn LOOP
The loop below is a very powerful mindset to move fast in the right direction.
BUILD - Enhance a little bit. Build something relevant but just enough to start a conversation with your customers about it.
MEASURE - How users are behaving about what you just built? What are they thinking about it? Will they pay for? Go where your clients are, analyse them while using your app. Install analytics tools.
LEARN - Open your mind for what your customers are trying to tell you. Listen and don’t argue. Just deal with it. Free yourself from your own believes.
And repeat this cycle weekly.
Analytics
There is a really good feature in Google Analytics that helps us capture and measure everything that users do in our apps. It calls User Explorer.
You need to configure Analytics in your frontend and set in your code every event that is important. Analytics will list them with lots of details and you can learn all the things your users are doing out there with your app.
Serverless
Now let’s talk about the backend. Compare the two diagrams below.
The left one is Google Kubernetes Engine (GKE) and you need to configure and to provision your infrastructure. Even with all the facilities from GKE, like Docker, Container Registry, Container Builder, Deployment Manager, you still need to deploy your infra and take care of it. What can demand A LOT of resources and energy from your development team.
The idea of a Platform as a Service (PaaS), like Google App Engine, is that the dev team doesn’t need to do absolute nothing about the infrastructure. It is ALL managed and configured automatically by the platform for the application. You only need to focus on your business code.
App Engine
App Engine is a platform, not a framework. You can choose any programming language you want and run it on this PaaS.
You will write your code and App Engine will host, setup, configure, update, scale and load balance your application for you as a fully managed platform.
Below is a Python example of a simple code for you to start using App Engine:
Google Cloud Platform
It is very simple to build an app with App Engine. Login at console.cloud.google.com and name your project. Done. You can start deploying your code to the App Engine host.
Google Cloud Platform has an SDK to facilitate these tasks for you. Install it in the machine where your source code is. Initialize with “gcloud init”, authenticate yourself and you are good to go.
You can even use the SDK in the Cloud Shell that GCP offers online. Also, you can edit your source code without leaving the browser! GCP offers an Online Code Editor based on Orion IDE.
App Engine in one of the products offered by GCP, the oldest one. It is FREE to start, there is a menu that lists all the free quotas available in the platform.
Google App Engine has dashboards where you can see your instances and their performances.
API Endpoints
Endpoints can bring a lot of facilities when building APIs. It documents, protects and monitors all API methods automatically for you. See in the Java example below:
With only two annotations, Api and ApiMethod, Cloud Endpoints already gives a URL, with domain and parameters, and the results already come formatted in JSON. And it generates the Swagger openapi.json file for you.
NoSQL
“Not Only SQL” is a good choice to deal with the dynamic data of the real world. There is no relational keys with fixed schema and dependencies that ties you in a enclosed model.
There are many options for non relational databases out there. Chose one that is already in the cloud and don’t need installation, configuration, load balancing or maintenance.
BigQuery
Google BigQuery is a great option for a fully managed database in the cloud. It can natively extends data warehouse and machine learning.