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.

Jochen Lillich

May 25, 2019
Tweet

More Decks by Jochen Lillich

Other Decks in Technology

Transcript

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

    @geewiz • DrupalCamp Scotland 2019 1 / 28
  2. Example SaaS product Web application API Client applications (iOS, Android)

    Shared libraries @geewiz • DrupalCamp Scotland 2019 4 / 28
  3. Monorepo users Google, Facebook, Twitter as well as Symfony, Laravel,

    Symplify, Shopsys, Contao, ... @geewiz • DrupalCamp Scotland 2019 6 / 28
  4. Visibility Finding and discovering code Development in the open Code

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

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

    is responsible Push Dependency Management: Maintainer is responsible @geewiz • DrupalCamp Scotland 2019 11 / 28
  7. Standardisation Central issue tracking Common tooling Common practices (testing etc)

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

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

    Unclear ownership New tooling Broken master ! @geewiz • DrupalCamp Scotland 2019 16 / 28
  10. 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
  11. 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
  12. 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
  13. 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
  14. Splitting a monorepo git subtree split git filter-branch Monorepo-specific tools,

    e.g. split.sh @geewiz • DrupalCamp Scotland 2019 23 / 28
  15. 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
  16. 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