DEV Community

Apoorv
Apoorv

Posted on • Originally published at Medium

A Better Understanding Of Micro Rep Vs Mono Repo.

Be well aware before choosing the right strategy.

As software developer, we have definitely worked on some sort of codebase which are in a repository. The repository is responsible for daily activities like code sharing, ownership management, and code merging. The repository has become a critical part of the development journey.

Monorepo vs microrepo.

We could not think of anything digital without some sort of code running behind it and the repository comes as a saviour. It is used to store data, code, files etc which are then deployed on servers for public usage.

We will try to understand in-depth repositories and different ways by which we can maintain the repositories. Moreover, we will also shed some light on the benefit of managing repositories as micro and mono repo.

**Table of content

· Popular Repositories providers:
∘ 1. Bitbucket:
∘ 2. GitLab:
∘ 3. GitHub:
· Mono Repositories Vs Micro Repositories
∘ Mono Repositories
∘ Micro repository
· Pros and Cons of Micro Repositories Vs Mono Repositories
∘ Pros of Micro Repositories
∘ Cons of Micro Repositories
∘ Pros of Mono Repositories
∘ Cons of Mono Repositories
· Famous Companies which use Mono Repositories and Micro Repositories.
∘ Example of Mono Repository
· Final Thoughts**

Enter fullscreen mode Exit fullscreen mode




Popular Repositories providers:

1. Bitbucket:

Bitbucket is one of the popular source maintenance tools which is used to store code, resources etc. Bitbucket provides features like raising the pull request, CI-CD pipelines, branching et cetera on their widely used web interface.

Atlassian Bitbucket

Bitbucket facilitates seamless development and deployment workflows for software projects. Atlassian is the organisation behind bit bucket.

2. GitLab:

Gitlab is owned by a company named as Gitlab Inc., it was founded in 2011 in San Francisco.

GitLab also provides enterprise-level version control. It helps in the development life cycle by offering features like pull requests, maintaining multiple branches etc.

GitLab

GitLab helps in comprehensive DevOps experience by providing continuous integration and continuous development capabilities.

3. GitHub:

GitHub is the web-based version of version control tools i.e. Git. If you are in some sort of software development, then you must be aware of the usage of Git.

Github

GitHub is now owned by Microsoft. It provides most of the available features like merge/pull requests, maintaining various branches, and CI-CD pipelines.

Also, you have the privilege to choose either private or public repositories. The GitHub also has additional features such as actions where you can code online.

Mono Repositories Vs Micro Repositories

In general, repositories are a group of data saved for future reference. As software developers, we store our source code and share it with other people for collaboration.

Since the development team can be big, maintaining the version of the source code becomes difficult. It will become a nightmare if we don’t have a good repository management system.

As an organisation, it becomes crucial to decide which version control tool, or platform needs to be chosen so that the collaboration amongst team becomes easy.

There is a lot which can be learnt about repositories here in this section like branching, versioning, and pull requests, but here we will be discussing mono repositories and micro repositories.

Mono Repositories

In mono repository is somewhat similar to monolithic architecture which means we store different source code in a single repository.

Photo by [Towfiqu barbhuiya](https://unsplash.com/@towfiqu999999?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&utm_medium=referral)

The repository size increases since various teams are working on the same code base. Different services will be having all of the source code in a single repository which can be distinguished by folder structure.

The sanity of the Codebase is maintained by proper ownership of that folder structure.

Micro repository

Micro repository on the other hand can be compared with micro service-based architecture. Here we have different repositories for different services. Ideally, one repository should have a code of one service in the case of the micro repository.

For your information in no circumstances, monolithic and microservice base architecture should be compared with monorepo or micro repository. We can have a microservice-based architecture of our services even by having mono repositories.

Pros and Cons of Micro Repositories Vs Mono Repositories

Pros of Micro Repositories

  1. Fast Development.
    In microservice repositories, the pace of development is comparatively faster than in mono repositories. As you don't have to depend upon the other teams for some major updation.
    You can release at your ease and managing becomes very easy with micro repositories.

  2. Flexibility.
    Flexibility can be seen as repositories dedicated to individual service. You have the leverage of choosing your own frameworks, libraries or modules.
    Dependence among the team becomes minimal, at least for initial development.

  3. Choice of Version Control and Release Cycle.
    Using the micro repositories, you have the leverage to choose among the available version control tools. We are not restricted, rather we can go with any tool available in the market like git, svn, mercurial etc.
    Although as of now, in industry the Git is the tool which is used the most, but still we are good with that.

Cons of Micro Repositories

  1. Increased Overhead.
    Overhead increases as we have to maintain multiple repositories, which required a shift in focus, we need to juggle between different source codes for the same.
    Although with the help of modern code editors, this issue can be mitigated to an extent. But still, we require the added effort of coding with different source codes.

  2. Duplication of code.
    There is a principle in software development called DRY in short. DRY stands for don't repeat yourself. So mainly if you have the same source code written in two places, It is better to move it to a commonplace and import it from there.
    But with micro repositories, there could be chances that we have the same source code in more than one place.

Pros of Mono Repositories

  1. Easy Code Sharing.
    The micro repository enables fast development as the software development team has all the code codebase centralized.
    It facilitates code reuse as we have the entire code base present in the same repository, streamlined collaboration, and efficient CI/CD pipelines.

  2. Code Reusability.
    Code is well reused since most of the code is in the same repositories. So exposure to the source code is better.
    Due to this, we can reuse the code, like creating some common class where we have written the common logic and imported it across the folder structure.

Cons of Mono Repositories

  1. *Increased Repository Size. *
    We have multiple codes based on single repositories, it becomes a bit difficult to manage. As more source code means an increase in the size of the source code.
    We have to have a system to manage such kind of huge code base. Even in single repositories many times the repository become too large, imagine what could happen in the case of the mono repo.

  2. Permission management becomes a bit difficult.
    Permission management becomes a bit difficult since many owners are there to access the source code. Anyone can make a change in others' code. Also, the repository management tool like Bitbucket, GitHub etc. make it a bit more efficient to provide permission.
    But for the mono repo, it becomes a bit cumbersome, if not doesn’t have a proper system.

  3. Build and release time increases.
    With the micro repository, the build and release time increases manifold. In the case of upgrading the version of the libraries, it becomes crucial to maintain backward compatibility for all the other code bases.
    Implementation of POC becomes a bit difficult, as it might impact a larger audience.

Famous Companies which use Mono Repositories and Micro Repositories.

Both mono repositories and micro repositories are having its own pros and cons. Based upon the use case each one of them is using either mono or micro repository.

Talking about mono repositories, some of the famous organisations using these are Google, Facebook, Twitter, Airbnb, Uber, Khan Academy, Auth0 etc. These are some of the organisations which have their mono repositories which contain various services etc.

Some of the repositories like Auth0 has auth0-monorepo, Khan Academy has khanacademy-monorepo, Google has Piper, Twitter has Flock

Example of Mono Repository

Following is one such open-source repository for the organisation i.e. Mattermost. You can visit their repository for looking at the source code

Mattermost Source Code [https://github.com/mattermost/mattermost](https://github.com/mattermost/mattermost)

Micro Repository is used by companies like Slack, Github, Gitlab, SoundCloud etc. Here is a diagrammatic example of the micro repository architecture. Each Repository will have ideally single responsibility.

Final Thoughts

So mainly we have understood the difference between monorepo and micro repo. Now micro repositories are the most common ones as the effort of the maintenance is minimal.

Now mostly it's an organisation wide decision of which one to use since upkeeping of both of them have its own challenges.

Now for a beginner software developer, I don't want you to be confused, start with a micro repository by simply using any of the source control platforms like bitbucket, GitHub etc discussed above.

Hopefully, this article gave you a good idea about the monorepo and micro repo.

Suggested Article

Perks / Hardships of Becoming A Technical Blogger 2023 | Technical.

About The Author

Apoorv Tomar is a software developer and part of Mindroast. You can connect with him on Twitter, and Telegram. Subscribe to the newsletter for the latest curated content. Don’t hesitate to say ‘Hi’ on any platform, just stating a reference of where did you find my profile.

Top comments (0)