Before getting the answer to this question let’s have a look at 3 major different types of software architecture.

1.  Monolithic  Architecture

According to the geeksforgeeks blog, Monolithic Architecture is like a big container, wherein all the software components of an app are assembled and tightly coupled, i.e., each component fully depends on each other.

In a Monolithic application, every feature is in the same code and deployed on a single server.

It looks like this 👇 

Pros:

  • Code refactoring is easy.
  • Cost-efficient in comparison to microservices.
  • Low latency in comparison to microservices.
  • Easy to reuse code.

Cons:

  • Deploying monolithic is complex as small changes need complete code base deployment.
  • As the size of the project increases the deployment time can increase.
  • Single point of failure as everything is in a single server, if down then our application is down.
  • Lots of testing is required for even small changes.

2. Microservices architecture

According to the google cloud blog, Microservices architecture (often shortened to microservices) refers to an architectural style for developing applications. Microservices allow a large application to be separated into smaller independent parts, with each part having its own realm of responsibility. To serve a single user request, a microservices-based application can call on many internal microservices to compose its response.

Pros

  • No risk of a single point of failure as every feature has a different codebase and different deployment
  • Ownership will be easy as a team can own the complete feature.
  • Scaling up is easier as we have to have a different number of replicas based on feature usage.
  • Ease of understanding codebase.
  • You can add different technologies to different microservices.

Cons:

  • Increase latency of application as communication between 2 different features can be done via network only.
  • Testing and debugging is difficult for an app as we have to test all microservices individually then we have to test the complete app.
  • Costly in comparison to monolith as microservices require more resources.
  • Creating a micro-service for each feature can also cause maintenance issues.

3. Hybrid: Monorepo with Microservices Architecture

Monorepo is a software development strategy where code for many projects is stored in the same repository.

Monorepo with Microservices is having the same codebase for the different applications so that you can have the same code for different deployments as per your need.

This is what it looks like 👇

Pros:

  • Code refactoring is easy.
  • Cost-efficient in comparison to microservices.
  • Scaling up is easier as we have to scale based on feature usage.
  • Testing and debugging are easier.
  • No single point of failure.
  • Easy to reuse code.

Cons:

  • Increase latency of application as communication between 2 different features can be done via network only.
  • Maintenance of the codebase is difficult if it grows very big.
  • Higher build time.

Which architecture is best for a small team?

Why Monolithic is not good?

One single and important reason is that you can’t have a single point of failure for a complete app.

Why microservices is difficult for small teams?

Fundamentally microservices are worked on the principle of having a single application for single business features and because of this, we can have a large number of services that in the end hard to manage for a small team.

In the ideal scenario, we should have a dedicated team for one service but in a small team, this is not possible to maintain a proper microservices architecture is difficult in small teams.

Monorepo with microservices can be a great choice for the small team, as we can have the benefits of microservices and monolith both the architecture without adding the overhead of multiple services and their maintenance.

Thanks, Aniket and Som for feedback.