Going monorepo

All your repos are belong to us

Before git

  • Creating a new repository was a pain
    • git init
  • Setting up continuous integration was a pain
    • .travis-ci.yml
    • .gitlab-ci.yml
    • Jenkinsfile

Here come the repositories

  • Arranged around technological stacks
    • around people and skills
  • Simple commit history per-repository
  • Fast Continuous Integration
  • Simpler file structure per-repository
  • Clean separation of concerns

Code reviews

  • Reviews are feature based
  • As many reviews as there are impacted repositories

What happens when everything is in a single repository ?

Monorepo

  • Single commit history
  • Code reviews span across services
  • No need to synchronize merges
  • One commit / feature becomes available
  • Possible to have integration tests on multiple services as part of CI

Be careful

  • Mono-repo does not mean monolith
  • Keep services separate
  • Think of it as a modular monolith
  • Each service should be independant :
    • compile
    • test (alone)
    • deploy

Disadvantages

  • Continuous Integration can be a burden
  • Even if services are built in parallel
  • Needs work to build only the services which have changed

Who should use monorepos ?

  1. Single team projects
  2. Projects with a lot of dependencies
    • to avoid dealing with integrations and compatibilities
  3. Big companies like Google who are mature enough

Who should not use monorepos ?

  • Projects which have absolutely no link between one another

Questions ?

Going monorepo : all your repos are belong to us

By Jean Detoeuf

Going monorepo : all your repos are belong to us

  • 322