/home/josephspurrier

Monolithic Repository vs Multiple Repositories for a Go Application

This article will use Go as the primary programming language, but many of these concepts are applicable to other languages as well.

There are two ways you can set up your application:

There are benefits to each method so you’ll need to decide which is best for your team.

Monolithic Repository

An example of a monolithic repository would be a web application with an Angular frontend, Go API, and multiple Go microservices for loading data into a database.

The benefits of this structure are:

Factors to keep in mind:

If you’re building an application with your team that has many components with different technologies or programming languages, you should probably use a monolithic repository. Google, Facebook, and Twitter all use monolithic repositories.

The Go repository on GitHub is a monolithic repository. You can tell because the src folder is in the root of the repository. You cannot use go get on the repository because of this restriction (nor would you want to). The Kubernetes repository is also a monolithic repository, but it does support go get. You can see all the different microservices in the repository by browsing the cmd folder.

Multiple Repositories

An example where multiple repositories could benefit is team is when you are building applications for multiple customers and each one uses the same core, but each requires customizations for each customer. The core could be in one repositories and the customizations for each customer could be in their own repositories.

The benefits of this structure are:

Factors to keep in mind:

If you’re building an application with your team that has a specific purpose or is designed to be used as a component of another application, you may want to use separate repositories for each one.

The Gorilla repositories are set up separately so developers can import just the components they wish to use. Buffalo has a few repositories that not part of the main repository.

#go #code