top of page

Serverless Architecture for a SaaS Product

  • TBIS
  • Feb 17
  • 6 min read

Updated: Jul 28

TBIS worked on a project for a New Zealand entrepreneur with the goal of designing a digital product MVP.


Quickmove is a platform that allows users to update their personal details with multiple service providers in just a few clicks.


This platform is a web application connected to a database and comprised of a backend integration layer to share data with multiple organisations through APIs and other methods, all working on a serverless architecture.


This was the third project Andre worked on using serverless architecture. The first was a customer portal for a logistics and supply chain company in New Zealand, designed to provide their customers with analytics data related to their operations and digital services.


The second was another digital product named Binokula enabling organisations to distribute BI reports with their partners while reducing user licensing costs.


What is Serverless Architecture?


Serverless architecture is a cloud computing execution model that abstracts the underlying infrastructure, allowing developers to focus on writing code and building applications without worrying about the complexities of server management. In this model, the cloud provider automatically handles the provisioning, scaling, and management of the servers required to run applications. This contrasts with traditional cloud models, such as virtual machines (VMs), where developers and system administrators must manage the infrastructure themselves.


In a serverless architecture, applications are divided into smaller, stateless functions, known as "functions as a service" (FaaS). These functions are event-driven, meaning they are triggered by specific actions such as API calls, database changes, or other events. The cloud provider runs these functions in response to the event and automatically allocates resources as needed. The functions are typically short-lived and run only when necessary, making this architecture highly efficient in terms of resource usage.


The most common examples of serverless offerings to run serverless applications are AWS Lambda, Azure Functions, and Google Cloud Functions. These services automatically scale based on the workload, meaning that resources are allocated only when functions are executed, leading to a pay-as-you-go pricing model that can result in cost savings.


Another example of a serverless architecture is the use of services such as Azure App Service and Azure Logic Apps, which refers to a cloud computing model where the management of servers and infrastructure is fully abstracted from the developer. This means that developers can focus on writing code and creating applications using the low-code no-code concepts and without having to worry about provisioning, scaling, or maintaining the underlying infrastructure.


One common design approach that works well with serverless architecture is called Microservices. Microservices is a software architectural style that structures an application as a collection of loosely decoupled services. Each microservice is focused on a specific business function or domain and can be developed, deployed, and scaled independently of other services. Microservices typically communicate with each other over lightweight protocols such as HTTP/REST or messaging queues.


In a microservices architecture, each service can be scaled independently based on its own workload. Each microservice can be built as a function or group of functions. Serverless architectures complement this by automatically scaling each microservice as needed, without requiring developers to manage the underlying infrastructure. For example, an API microservice may require more resources during high demand, while another microservice handling user authentication may require fewer resources during the same period.


Examples of microservices include functions such as User Authentication Service, Payment Processing Service, Billing Processing Service, Image Processing Service, Email Notification Service, Data Transformation Service and Inventory Management Service.


I will write an article specifically about Microservice Architecture in another opportunity.


The Solution


Serverless Architecture in Azure Cloud
Serverless Architecture in Azure Cloud

This digital product was developed on the Azure Cloud, and we employed 6 cloud services:


Azure AD B2C: Users sign into the web application by using their ID credentials stored and managed in Azure AD B2C. Azure AD B2C returns an access token for the API, which the web application uses to authenticate API requests.


Azure App Service: The web application developed with NodeJS and React is hosted in the Azure App Service. It is a HTTP-based service for hosting web applications, REST APIs, and mobile back ends. It compiles code written in .Net, .Net Core, Java, Node.js, PUP and Python. Applications run and scale with ease on both Windows and Linux-based environments.


Azure Blob Storage: Other static web content such as images and videos are stored in Azure Blob Storage and served to clients by using static website hosting. All dynamic interaction happens through JavaScript code making calls to the back-end APIs. There's no server-side code to render the web page.


Azure SQL DB: Azure SQL DB is also serverless, a SQL database. For this scenario, the web application fetches data from Azure SQL DB in response to HTTP GET requests from the client. All the data captured by the application will be stored in the Azure SQL DB.


Azure Monitor: Azure Monitor collects performance metrics about the Azure services deployed in the solution. By visualizing these in a dashboard, you can get visibility into the health of the solution. It also collected application logs.


Azure Pipelines: Azure Pipelines is a continuous integration (CI) and continuous delivery (CD) service that builds, tests, and deploys the application.


Serverless Architecture and Process Steps of SaaS Product
Serverless Architecture and Process Steps of SaaS Product

When we had to integrate with other organizations, we introduced another cloud service called Azure Logic Apps, a low-code no-code solution, which helped us develop an integration layer to call APIs and an email notification service in one-third of the time compared to using conventional coding-based solution.


Azure Logic Apps is a serverless solution that allows orchestrating and integrating different services by using prebuilt connectors. It runs the business logic to send data to each business partner API, receive the responses back and update statuses back to the Azure SQL Database.


This type of architecture can be used to develop web applications, backend mobile applications, websites, customer portals, ecommerce websites, data processing and ETL, API-driven solutions, automated business workflows, machine learning and AI-based applications and much more.


Benefits of Serverless Architecture


Serverless architectures are cost-effective because you only pay for the execution time of your functions, database interaction (read/write) or workflow runs. There is no need to maintain idle servers, as with traditional cloud environments or virtual machines, where you pay for the resources regardless of usage.


Serverless platforms automatically scale applications to handle varying levels of demand. Whether it’s handling a sudden spike in traffic or scaling down during off-peak hours, serverless systems can seamlessly adjust the resources needed.


Developers can focus more on writing application logic and less on infrastructure management. Serverless platforms take care of provisioning, scaling, and maintaining the servers, which reduces the operational burden.


Since serverless environments provide automatic scaling and management, developers can deploy applications quickly. This is especially beneficial in agile development cycles where time to market is crucial, which was the case for this product.


Serverless vs. Virtual Machines: A Comparison


While serverless architectures offer numerous advantages, it’s important to compare them with other cloud-based models, such as virtual machines (VMs), to understand their relative benefits and limitations.


Traditional VM-based environments require developers to manage the operating system and resources such as CPU, memory, and storage. While VMs offer more control over the environment, they require manual scaling and management of infrastructure. This can result in inefficiencies, especially during periods of low demand when resources are underutilized.


In contrast, serverless applications abstract infrastructure management, automatically scaling based on demand. Developers don’t need to worry about provisioning or maintaining servers, and they pay only for the computing resources used during function execution. However, serverless is most suitable for event-driven applications and workloads that don’t require long-lived processes or complex configurations.


Drawbacks of Serverless Architecture


When a function is invoked after a period of inactivity, it may experience a delay known as a "cold start." This can affect the performance of real-time applications or services that require consistent low latency.


Serverless functions are typically designed to run for short durations (e.g., up to five minutes). Long-running processes or applications may not be suitable for serverless environments.


Serverless platforms are tightly integrated with their respective cloud providers, making it difficult to migrate applications between providers without significant rework.


Since the serverless environment is highly abstracted, it can be more challenging to debug, monitor, and trace the performance of individual functions.


Serverless architecture is highly versatile and can be used to build a wide variety of solutions across different industries and use cases. Whether it’s for web applications, data processing, APIs, event-driven applications, microservices, or machine learning, serverless allows you to build scalable, cost-effective, and efficient solutions without managing infrastructure.


However, serverless is not a one-size-fits-all solution. While it offers significant benefits in certain scenarios, it might not be suitable for applications requiring long-running processes, complex state management, or strict control over infrastructure. The potential for cold starts, vendor lock-in, and stateful workloads are factors to consider when evaluating serverless for a given project.


Ultimately, serverless should be considered as part of a broader cloud strategy. While it might not fit every use case, it is definitely an option worth exploring, especially when building modern applications. By assessing your application’s specific needs and workload characteristics, you can determine whether serverless is the right fit, or whether a more traditional cloud architecture might be better suited for your goals.


If you want to know more about this solution, or how serverless can benefit your business, do not hesitate to get in touch.

Comments


bottom of page