Skip to main content

Monorepo

Monorepo

The monorepo structure puts several distinct projects in a single repository, one per component or service of the application stack. Its goal is to make their interdependencies clear, whether they are application or infrastructure related. It is the opposite of the polyrepo approach, which often leads to a shared-libraries repository and so reproduces the management weaknesses of monolithic applications.

Structural recommendations​

The monorepo structure has the following advantages:

  • Simpler CI/CD implementation
  • Separation of concerns (integration, provisioning, deployment, etc.)
  • Optimized build context
  • Test isolation
  • Decoupled application functions (frontend/backend modules, serverless functions)
|-- .{{pipeline}} # GitLab CI, AWS CodeBuild/CodeDeploy, Azure Pipelines...
|-- docs # Technical/user documentation
|-- downloads* # Downloads of external dependencies (.gitignore)
|-- deploy # Provisioning/deployment resources
| |-- cloudformation
| |-- kubernetes
| |-- terraform
|-- hack # Local / agent initialization scripts
|-- src # Application source code
| |-- app1
| | |-- src
| | |-- tests
| | | |-- unit # Unit tests
| | |-- Dockerfile # Open Container Image (OCI) definition
| | |-- setup.cfg # Package configuration
| |-- app2
| |-- app3
|-- tests
| |-- integration # Integration tests
| |-- acceptance # User acceptance tests
|-- .gitignore
|-- .gitattributes
|-- CHANGELOG.md # Changes introduced by each delivery
|-- CONTRIBUTING.md # GitFlow contribution rules
|-- README.md # Documentation

* included in the .gitignore file