SaaS architecture: Monolithic and Microservices
Tags: webdev, architecture, cloud, productivity
Published: 2021-08-10 00:05:36

###What is a web application architecture?
**Application Architecture:** 
An application architecture is the behavior of how different applications interact with each other. 
![Screen Shot 2021-08-09 at 5.26.06 PM](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lzg7jpszjc0jhhayegez.png)
 

**Software as a Service Architecture:** 
So with software as a service, it is the behavior of how different web applications interact with each other. 

The architecture here also encompasses, the interaction between applications, middleware systems, and database.

![large-3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/46zdoapfd8veqmi09wly.jpeg)


###What are the types of SaaS Architectures?
We want to increase efficiency, and so we want to choose an architecture that ensures all our web applications work well with each other. There are thus two architecture types that we can choose, which we'll go over below. 

**Modules:**
But before we do that you need to understand that an application has different components or modules that define it. E.g an an Ecommerce application might have a modules that takes an order, another one to check inventory, another to authorize payment and finally a module to ship the order.
![modular-web-design-pages](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qm1xomqduvceikbs50v2.jpg)
 

**1. Monolithic Architecture:**
In a monolithic architecture, the application modules are build together, and deployed as a single unit. 

>So in the Ecommerce application example, the developer would build the modules together, and they are linked to each other in such a way, that if we make changes in one part of the application, another part could also change, because of a shared database. So while working on an Ecommerce application, making changes in the module to check inventory would affect the module to authorize payment since they are a single unit.

>![microservices-and-monolithic-architectures](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y073jw9m4l823t6uub3e.jpg)

**2. Micoservice Architecture:**
In a micro-service architecture, the applications modules are built separately, and then connected to each other.

>So with the modules that we had discussed before; each of these modules get built separately, and has their own database. Each of these modules then connect to the other modules. In the Ecommerce application, the module to take an order would get built separately, and the module to check inventory would get built separately. They would then be connected to each other. This way we could work on them independently, and not worry about changes in one module of an application affecting changes in another.

>![cda4db94-ac16-43ba-82c4-53632154afc7](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9oef340219rjq9rbtpw5.jpg)
 
###Which architecture to choose?

####Why you should choose Monolithic Architecture
**1. Faster to debug and test:**
Since a monolithic application is a single application, building and testing it is easier, and faster.
![Screen Shot 2021-08-09 at 5.15.05 PM](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/enbuxzd95voj0pvjtpaa.png)
**2.Simple to develop:**
Monolithic architecture is the older way of developing web applications, and so many developers might feel more comfortable using it.![Developer](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/se2rlik3sw7w0a55v8s1.jpg)
**3.Simple to deploy:**
With a monolithic application you don't have to worry about a lot of files, there is usually just one file or directory.
![1*HTP6u-llOnFya0VvhQ-pHw](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zz5yarna4j89wp4wd6am.png)

**Why you should choose Microservice Architecture**
**1. Work better in groups:**
The best thing about Microservice architecture are independent modules. You can take a part of the application, and make it a module with an independent database. This way you can work on that module and changes made there would not affect changes in another part of the application. This is great if multiple people are working on different modules, since they would not have to worry about their code affecting that of a different developer.
![0*MJ2qIjrP4q56_2h-](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0pn503qududsd4u4kv6b.png)
 

**2. Flexibility to choose technology:**
Another great thing about Microservice architecture is that for each module, a different technology can be used, depending upon the comfort of a developer working on a module, and the needs of the project.![full_front_back](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j9lapfxmil1cyn574pss.jpg)
 
 

**3. Time effective:**
Since each developer is only worried about their own module, without breaking other parts of an application, development teams can work way faster.
![time-management-how-to-create-a-schedule-header@2x](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bnmma9lj8dm5er9pnfra.png)
 

**4.Cost effective:**
Each module can be scaled independently, which could save a lot of money.![1*HmFudfdeSdweh7dzeRQnbQ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l5enfsmb844j2wmkydww.png)

And here is a video where I explain the concepts above:
[Youtube video](https://youtu.be/QX4GMEvlF4g)