{"id":332,"date":"2023-10-03T19:22:01","date_gmt":"2023-10-03T19:22:01","guid":{"rendered":"https:\/\/valerio.nu\/?p=332"},"modified":"2023-10-03T19:33:07","modified_gmt":"2023-10-03T19:33:07","slug":"monorepo-vs-polyrepo-exploring-code-organization-approaches","status":"publish","type":"post","link":"https:\/\/valerio.nu\/index.php\/2023\/10\/03\/monorepo-vs-polyrepo-exploring-code-organization-approaches\/","title":{"rendered":"Monorepo vs. Polyrepo: Exploring Code Organization Approaches"},"content":{"rendered":"\n<p>Slightly inspired by a <a href=\"https:\/\/two-wrongs.com\/getting-used-to-microservices.html\">Two-Wrongs article<\/a> with a hard take on microservices and its more <a href=\"https:\/\/two-wrongs.com\/benefits-of-microservices\">moderate follow-up<\/a>, I&#8217;ve been thinking for a while to write a few lines about code organisation and specifically the rivalry between monorepo \u26a4 and polyrepo \u26a2\u26a3\u26a5\u26a7. The symbols are for fun, let&#8217;s not get started with the pronouns&#8230; <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"880\" height=\"1024\" src=\"https:\/\/valerio.nu\/wp-content\/uploads\/2023\/10\/image-880x1024.png\" alt=\"\" class=\"wp-image-342\" srcset=\"https:\/\/valerio.nu\/wp-content\/uploads\/2023\/10\/image-880x1024.png 880w, https:\/\/valerio.nu\/wp-content\/uploads\/2023\/10\/image-258x300.png 258w, https:\/\/valerio.nu\/wp-content\/uploads\/2023\/10\/image-768x893.png 768w, https:\/\/valerio.nu\/wp-content\/uploads\/2023\/10\/image.png 980w\" sizes=\"auto, (max-width: 880px) 100vw, 880px\" \/><\/figure>\n\n\n\n<p>The choice between a <a href=\"https:\/\/monorepo.tools\/\">monorepo<\/a> and a polyrepo system for code organization has been a topic of debate for years. Both approaches have their merits and drawbacks, and the choice often depends on the specific needs of a company. Let&#8217;s explore three advantages of each approach.<\/p>\n\n\n\n<p><strong>Advantages of Monorepo:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Simplified Dependency Management:<\/strong> One of the key benefits of a monorepo is streamlined dependency management. With all code and projects housed in a single repository, it&#8217;s easier to ensure that all components are using compatible versions of libraries and dependencies. Google, a prominent advocate for monorepos, relies on this approach to manage its vast codebase efficiently.<\/li>\n\n\n\n<li><strong>Enhanced Collaboration:<\/strong> Monorepos promote collaboration among teams. Developers can access and modify various components of the application within the same repository, making it easier to coordinate efforts, share code, and maintain consistency. Facebook&#8217;s use of a monorepo has facilitated collaboration among its large development teams.<\/li>\n\n\n\n<li><strong>Centralized Testing and Deployment:<\/strong> In a monorepo setup, testing and deployment pipelines can be centralized, leading to more consistent and efficient processes. Companies like Uber have adopted monorepos to streamline their continuous integration and delivery, enabling faster and more reliable releases.<\/li>\n<\/ul>\n\n\n\n<p><strong>Advantages of Polyrepo:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Isolation and Modularity:<\/strong> Polyrepos offer a higher degree of isolation and modularity. Each service or project is kept separate, reducing the risk of unintended changes affecting unrelated code. This approach is favored by companies like Netflix, which operates with a polyrepo structure to maintain clear boundaries between services.<\/li>\n\n\n\n<li><strong>Flexibility in Tooling:<\/strong> Different components within a polyrepo can use different tools, languages, and technologies without affecting the entire codebase. This flexibility can be advantageous when teams have diverse needs or when integrating third-party libraries. GitLab adopts a polyrepo strategy, allowing teams to choose the best tools for their projects.<\/li>\n\n\n\n<li><strong>Scalability and Parallel Development:<\/strong> Polyrepos can scale more easily as they allow for parallel development. Teams can work independently on separate repositories, reducing the risk of bottlenecks in development. Microsoft, for instance, uses polyrepos for some of its open-source projects to manage the complexity of its codebase.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"980\" height=\"748\" src=\"https:\/\/valerio.nu\/wp-content\/uploads\/2023\/10\/image-1.png\" alt=\"\" class=\"wp-image-344\" srcset=\"https:\/\/valerio.nu\/wp-content\/uploads\/2023\/10\/image-1.png 980w, https:\/\/valerio.nu\/wp-content\/uploads\/2023\/10\/image-1-300x229.png 300w, https:\/\/valerio.nu\/wp-content\/uploads\/2023\/10\/image-1-768x586.png 768w\" sizes=\"auto, (max-width: 980px) 100vw, 980px\" \/><\/figure>\n\n\n\n<p>In conclusion, the choice between a monorepo and a polyrepo depends on factors such as team size, project complexity, and organizational culture. Companies like Google, Facebook, and Uber find value in monorepos for their centralized management and collaboration benefits, while Netflix, GitLab, and Microsoft leverage polyrepos to maintain modularity and flexibility. <\/p>\n\n\n\n<p>If you&#8217;re interested in learning more about monorepo and its tools, <a href=\"https:\/\/github.com\/korfuri\/awesome-monorepo\">this curated list of tools and articles<\/a> is a good place to start.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Slightly inspired by a Two-Wrongs article with a hard take on microservices and its more moderate follow-up, I&#8217;ve been thinking for a while to write [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[],"class_list":["post-332","post","type-post","status-publish","format-standard","hentry","category-architecture"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Monorepo vs. Polyrepo: Exploring Code Organization Approaches - Andy&#039;s blog \u2935\ufe0f<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/valerio.nu\/index.php\/2023\/10\/03\/monorepo-vs-polyrepo-exploring-code-organization-approaches\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Monorepo vs. Polyrepo: Exploring Code Organization Approaches - Andy&#039;s blog \u2935\ufe0f\" \/>\n<meta property=\"og:description\" content=\"Slightly inspired by a Two-Wrongs article with a hard take on microservices and its more moderate follow-up, I&#8217;ve been thinking for a while to write [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/valerio.nu\/index.php\/2023\/10\/03\/monorepo-vs-polyrepo-exploring-code-organization-approaches\/\" \/>\n<meta property=\"og:site_name\" content=\"Andy&#039;s blog \u2935\ufe0f\" \/>\n<meta property=\"article:published_time\" content=\"2023-10-03T19:22:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-03T19:33:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/valerio.nu\/wp-content\/uploads\/2023\/10\/image-880x1024.png\" \/>\n<meta name=\"author\" content=\"andy\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"andy\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/10\\\/03\\\/monorepo-vs-polyrepo-exploring-code-organization-approaches\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/10\\\/03\\\/monorepo-vs-polyrepo-exploring-code-organization-approaches\\\/\"},\"author\":{\"name\":\"andy\",\"@id\":\"https:\\\/\\\/valerio.nu\\\/#\\\/schema\\\/person\\\/da69cc3da309893b0d3bc8fcef75f128\"},\"headline\":\"Monorepo vs. Polyrepo: Exploring Code Organization Approaches\",\"datePublished\":\"2023-10-03T19:22:01+00:00\",\"dateModified\":\"2023-10-03T19:33:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/10\\\/03\\\/monorepo-vs-polyrepo-exploring-code-organization-approaches\\\/\"},\"wordCount\":472,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/10\\\/03\\\/monorepo-vs-polyrepo-exploring-code-organization-approaches\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/valerio.nu\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/image-880x1024.png\",\"articleSection\":[\"Architecture\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/10\\\/03\\\/monorepo-vs-polyrepo-exploring-code-organization-approaches\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/10\\\/03\\\/monorepo-vs-polyrepo-exploring-code-organization-approaches\\\/\",\"url\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/10\\\/03\\\/monorepo-vs-polyrepo-exploring-code-organization-approaches\\\/\",\"name\":\"Monorepo vs. Polyrepo: Exploring Code Organization Approaches - Andy&#039;s blog \u2935\ufe0f\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/10\\\/03\\\/monorepo-vs-polyrepo-exploring-code-organization-approaches\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/10\\\/03\\\/monorepo-vs-polyrepo-exploring-code-organization-approaches\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/valerio.nu\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/image-880x1024.png\",\"datePublished\":\"2023-10-03T19:22:01+00:00\",\"dateModified\":\"2023-10-03T19:33:07+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/#\\\/schema\\\/person\\\/da69cc3da309893b0d3bc8fcef75f128\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/10\\\/03\\\/monorepo-vs-polyrepo-exploring-code-organization-approaches\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/10\\\/03\\\/monorepo-vs-polyrepo-exploring-code-organization-approaches\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/10\\\/03\\\/monorepo-vs-polyrepo-exploring-code-organization-approaches\\\/#primaryimage\",\"url\":\"https:\\\/\\\/valerio.nu\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/image.png\",\"contentUrl\":\"https:\\\/\\\/valerio.nu\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/image.png\",\"width\":980,\"height\":1140},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2023\\\/10\\\/03\\\/monorepo-vs-polyrepo-exploring-code-organization-approaches\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/valerio.nu\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Monorepo vs. Polyrepo: Exploring Code Organization Approaches\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/valerio.nu\\\/#website\",\"url\":\"https:\\\/\\\/valerio.nu\\\/\",\"name\":\"Andy&#039;s blog \u2935\ufe0f\",\"description\":\"Abandon all hope, ye who enter here\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/valerio.nu\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/valerio.nu\\\/#\\\/schema\\\/person\\\/da69cc3da309893b0d3bc8fcef75f128\",\"name\":\"andy\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4852a025c6250c852814d4017f646677730a23c1ec14eb5ca36b69dcce5135a5?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4852a025c6250c852814d4017f646677730a23c1ec14eb5ca36b69dcce5135a5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4852a025c6250c852814d4017f646677730a23c1ec14eb5ca36b69dcce5135a5?s=96&d=mm&r=g\",\"caption\":\"andy\"},\"sameAs\":[\"https:\\\/\\\/valerio.nu\"],\"url\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/author\\\/giuseppe\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Monorepo vs. Polyrepo: Exploring Code Organization Approaches - Andy&#039;s blog \u2935\ufe0f","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/valerio.nu\/index.php\/2023\/10\/03\/monorepo-vs-polyrepo-exploring-code-organization-approaches\/","og_locale":"en_US","og_type":"article","og_title":"Monorepo vs. Polyrepo: Exploring Code Organization Approaches - Andy&#039;s blog \u2935\ufe0f","og_description":"Slightly inspired by a Two-Wrongs article with a hard take on microservices and its more moderate follow-up, I&#8217;ve been thinking for a while to write [&hellip;]","og_url":"https:\/\/valerio.nu\/index.php\/2023\/10\/03\/monorepo-vs-polyrepo-exploring-code-organization-approaches\/","og_site_name":"Andy&#039;s blog \u2935\ufe0f","article_published_time":"2023-10-03T19:22:01+00:00","article_modified_time":"2023-10-03T19:33:07+00:00","og_image":[{"url":"https:\/\/valerio.nu\/wp-content\/uploads\/2023\/10\/image-880x1024.png","type":"","width":"","height":""}],"author":"andy","twitter_card":"summary_large_image","twitter_misc":{"Written by":"andy","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/valerio.nu\/index.php\/2023\/10\/03\/monorepo-vs-polyrepo-exploring-code-organization-approaches\/#article","isPartOf":{"@id":"https:\/\/valerio.nu\/index.php\/2023\/10\/03\/monorepo-vs-polyrepo-exploring-code-organization-approaches\/"},"author":{"name":"andy","@id":"https:\/\/valerio.nu\/#\/schema\/person\/da69cc3da309893b0d3bc8fcef75f128"},"headline":"Monorepo vs. Polyrepo: Exploring Code Organization Approaches","datePublished":"2023-10-03T19:22:01+00:00","dateModified":"2023-10-03T19:33:07+00:00","mainEntityOfPage":{"@id":"https:\/\/valerio.nu\/index.php\/2023\/10\/03\/monorepo-vs-polyrepo-exploring-code-organization-approaches\/"},"wordCount":472,"commentCount":0,"image":{"@id":"https:\/\/valerio.nu\/index.php\/2023\/10\/03\/monorepo-vs-polyrepo-exploring-code-organization-approaches\/#primaryimage"},"thumbnailUrl":"https:\/\/valerio.nu\/wp-content\/uploads\/2023\/10\/image-880x1024.png","articleSection":["Architecture"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/valerio.nu\/index.php\/2023\/10\/03\/monorepo-vs-polyrepo-exploring-code-organization-approaches\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/valerio.nu\/index.php\/2023\/10\/03\/monorepo-vs-polyrepo-exploring-code-organization-approaches\/","url":"https:\/\/valerio.nu\/index.php\/2023\/10\/03\/monorepo-vs-polyrepo-exploring-code-organization-approaches\/","name":"Monorepo vs. Polyrepo: Exploring Code Organization Approaches - Andy&#039;s blog \u2935\ufe0f","isPartOf":{"@id":"https:\/\/valerio.nu\/#website"},"primaryImageOfPage":{"@id":"https:\/\/valerio.nu\/index.php\/2023\/10\/03\/monorepo-vs-polyrepo-exploring-code-organization-approaches\/#primaryimage"},"image":{"@id":"https:\/\/valerio.nu\/index.php\/2023\/10\/03\/monorepo-vs-polyrepo-exploring-code-organization-approaches\/#primaryimage"},"thumbnailUrl":"https:\/\/valerio.nu\/wp-content\/uploads\/2023\/10\/image-880x1024.png","datePublished":"2023-10-03T19:22:01+00:00","dateModified":"2023-10-03T19:33:07+00:00","author":{"@id":"https:\/\/valerio.nu\/#\/schema\/person\/da69cc3da309893b0d3bc8fcef75f128"},"breadcrumb":{"@id":"https:\/\/valerio.nu\/index.php\/2023\/10\/03\/monorepo-vs-polyrepo-exploring-code-organization-approaches\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/valerio.nu\/index.php\/2023\/10\/03\/monorepo-vs-polyrepo-exploring-code-organization-approaches\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/valerio.nu\/index.php\/2023\/10\/03\/monorepo-vs-polyrepo-exploring-code-organization-approaches\/#primaryimage","url":"https:\/\/valerio.nu\/wp-content\/uploads\/2023\/10\/image.png","contentUrl":"https:\/\/valerio.nu\/wp-content\/uploads\/2023\/10\/image.png","width":980,"height":1140},{"@type":"BreadcrumbList","@id":"https:\/\/valerio.nu\/index.php\/2023\/10\/03\/monorepo-vs-polyrepo-exploring-code-organization-approaches\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/valerio.nu\/"},{"@type":"ListItem","position":2,"name":"Monorepo vs. Polyrepo: Exploring Code Organization Approaches"}]},{"@type":"WebSite","@id":"https:\/\/valerio.nu\/#website","url":"https:\/\/valerio.nu\/","name":"Andy&#039;s blog \u2935\ufe0f","description":"Abandon all hope, ye who enter here","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/valerio.nu\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/valerio.nu\/#\/schema\/person\/da69cc3da309893b0d3bc8fcef75f128","name":"andy","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4852a025c6250c852814d4017f646677730a23c1ec14eb5ca36b69dcce5135a5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4852a025c6250c852814d4017f646677730a23c1ec14eb5ca36b69dcce5135a5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4852a025c6250c852814d4017f646677730a23c1ec14eb5ca36b69dcce5135a5?s=96&d=mm&r=g","caption":"andy"},"sameAs":["https:\/\/valerio.nu"],"url":"https:\/\/valerio.nu\/index.php\/author\/giuseppe\/"}]}},"_links":{"self":[{"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/posts\/332","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/comments?post=332"}],"version-history":[{"count":11,"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/posts\/332\/revisions"}],"predecessor-version":[{"id":345,"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/posts\/332\/revisions\/345"}],"wp:attachment":[{"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/media?parent=332"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/categories?post=332"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/tags?post=332"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}