Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Monorepo vs Multirepo

Monorepo vs Multirepo

A comparison of the two approaches to code repository structure.

3abfc9128fe1aeae3058edc36936f360?s=128

Jochen Lillich
PRO

May 25, 2019
Tweet

Transcript

  1. Monorepo vs Multirepo Which is the superior approach? Jochen Lillich

    @geewiz • DrupalCamp Scotland 2019 1 / 28
  2. Multirepo aka Manyrepo @geewiz • DrupalCamp Scotland 2019 2 /

    28
  3. Monorepo Centralisation Visibility Synchronisation Completeness Standardisation @geewiz • DrupalCamp Scotland

    2019 3 / 28
  4. Example SaaS product Web application API Client applications (iOS, Android)

    Shared libraries @geewiz • DrupalCamp Scotland 2019 4 / 28
  5. About me Jochen Lillich Founder/CTO freistil.it freistilbox.com Managed Drupal Hosting

    @geewiz • DrupalCamp Scotland 2019 5 / 28
  6. Monorepo users Google, Facebook, Twitter as well as Symfony, Laravel,

    Symplify, Shopsys, Contao, ... @geewiz • DrupalCamp Scotland 2019 6 / 28
  7. Multirepo Management overhead Silos Dependency hell Complex cross-project changes @geewiz

    • DrupalCamp Scotland 2019 7 / 28
  8. Monorepo Visibility Synchronisation Completeness Standardisation @geewiz • DrupalCamp Scotland 2019

    8 / 28
  9. Visibility Finding and discovering code Development in the open Code

    sharing Cross-pollination @geewiz • DrupalCamp Scotland 2019 9 / 28
  10. Synchronisation Single history timeline Full-scope CI/CD Version-less dependency management Atomic

    cross-cutting changes @geewiz • DrupalCamp Scotland 2019 10 / 28
  11. Dependency management From "pull" to "push": Pull Dependency Management: Consumer

    is responsible Push Dependency Management: Maintainer is responsible @geewiz • DrupalCamp Scotland 2019 11 / 28
  12. You break it, you fix it. @geewiz • DrupalCamp Scotland

    2019 12 / 28
  13. Completeness No external dependencies No downloads No "download failed" @geewiz

    • DrupalCamp Scotland 2019 13 / 28
  14. Standardisation Central issue tracking Common tooling Common practices (testing etc)

    Single CI integration Shared coding style guides @geewiz • DrupalCamp Scotland 2019 14 / 28
  15. Strengths More transparency Easier access Less overhead Simplified workflows Faster

    feedback loops Higher code quality Improved application security @geewiz • DrupalCamp Scotland 2019 15 / 28
  16. Weaknesses Volume of code Intimidating Long build times IDE lag

    Unclear ownership New tooling Broken master ! @geewiz • DrupalCamp Scotland 2019 16 / 28
  17. Monorepo best practices Build everything from source for every change

    Have clear ownership Set a file size limit Avoid breaking changes Use feature flags Use only short-lived branches @geewiz • DrupalCamp Scotland 2019 17 / 28
  18. Trunk Based Development "A source-control branching model, where developers collaborate

    on code in a single branch called ‘trunk’, resist any pressure to create other long-lived development branches by employing documented techniques. They therefore avoid merge hell, do not break the build, and live happily ever after." trunkbaseddevelopment.com @geewiz • DrupalCamp Scotland 2019 18 / 28
  19. Build tools Bazel (Google, Asana, Braintree, Dropbox) Buck (Facebook) Lerna

    (Babel, Cloudflare, WP Gutenberg) monobuild symplify/monorepobuilder shopsys/monorepo-tools @geewiz • DrupalCamp Scotland 2019 19 / 28
  20. Which approach should you choose? @geewiz • DrupalCamp Scotland 2019

    20 / 28
  21. Why not both? " @geewiz • DrupalCamp Scotland 2019 21

    / 28
  22. The "Splitrepo" hybrid A monorepo split into read-only project repositories

    Example: symfony/symfony splits into: symfony/console symfony/dom-crawler etc @geewiz • DrupalCamp Scotland 2019 22 / 28
  23. Splitting a monorepo git subtree split git filter-branch Monorepo-specific tools,

    e.g. split.sh @geewiz • DrupalCamp Scotland 2019 23 / 28
  24. Using git (lter-branch to split a monorepo @geewiz • DrupalCamp

    Scotland 2019 24 / 28
  25. Learn more @geewiz • DrupalCamp Scotland 2019 25 / 28

  26. Background Awesome Monorepo Monorepos in Git Monorepo: From Zero to

    Hero Advantages of Monolithic Version Control Monorepo? Please do! Why don't you have a monorepo? Advantages and Disadvantages of a Monolithic Codebase @geewiz • DrupalCamp Scotland 2019 26 / 28
  27. Case studies "Why is Babel a monorepo?" "Monorepo to Multirepo

    and back again" "The Symfony Monolith Repository" "The Many Benefits of a Monorepo" @geewiz • DrupalCamp Scotland 2019 27 / 28
  28. Thanks! Slides: http://bit.ly/monorepo-dcscot19 Feedback: @geewiz jochen@freistil.it @geewiz • DrupalCamp Scotland

    2019 28 / 28