Serverless Architecture For Next App

Serverless Architecture For Next App

Serverless has been there now for a fair amount of time and it slowly but surely has come to a more mature state than it was there about a few years ago. Slowly, as companies are evolving towards a more cloud-native approach, distributed or cloud-native architectures getting more in demand.

In this article, I will be explaining about few key architecture patterns which you can learn and apply in your next product development.

Mobile Backend Single Page/Web App Microservices With Lambda Mobile Backend

We all have been using mobile apps and websites for a long time now, And we understand that mobile is the future as our entire world is shrinking into mobile or watch or tablet slowly but surely. So with this tech transformation, our tech architectures also need to be more mature.

Mobile backend is nothing but a simple architecture for serverless computing where you can create your backend system on serverless methodology and it will be charged based on how much use it. Attaching an image below for more clarity.

As you can see in the image above, there is a mobile client invoking API gateway service on AWS, and that in turn is invoking AWS Cognito and Lambdas and other related services for a complete backend system. Points from the above architecture.

Each API request sent can be authorized via the Amazon Cognito user pool where AWS can authenticate the requests There are some lambdas in the public subnet and some inside in VPC interacting with RDS and creating a secured network. AWS Secrets Manager is being added to hold the critical data required for the app at runtime. Single Page/Web App

Today, because of more evolving UI frameworks like React, Angular, Vue & Ember in javascript, UI development has taken a shift towards single page from a multi-page approach that was there in the early 2000s

1_KRNS4yXB_SDtecn-sCYoLQ.png

You can see two architecture diagrams above, One for a single page and one for a web app. The diagram on the left one accounts for the Webpage app and the other one is for the single-page app. Salient features are listed below.

Hosting a single-page app can be done on S3 based bucket system as well. You can incorporate Amazon Cognito in the case of multi page app for making the user view different pages from CloudFront based on his/her access level, whereas in the case of single page app, one can use lambda authorizer as one of the authorizers for verifying the role and access level info. Microservices With Lambda

Microservices has been the buzzword for a long time now and everyone wants to make their hand dirty on the same and get an understanding of that in detail. There are different architectures around microservices that have already been discussed in different articles and forums, which are around Service Mesh & Service Discovery. Today's architecture is a bit simpler as compared to these.

1_R8buVLStRiNyLBla4wDM4g.png

As one can see above, there are different API gateway endpoints based on different lambda functions at the implementation level. These all lambda functions are acting as a small microservice kind of section. Sailent features around the same.

These small lambda functions are nothing but small microservices for a small business domain

API gateway different endpoints are related to these microservices-based lambda functions based on the integration between API gateway

When to use

Mobile backend can be used when you have a mobile website created in a single page architecture or from a mobile application

Microservices with Lambda is a very minimal kind of architecture that can be used to create a basic MVP or POC kind of solution. Conclusion

I have listed down very basic and multi-tier architectures in very simple worlds. One can use them according to their need and requirement based on the product, one is trying to build.