{"id":266923,"date":"2021-06-04T19:00:32","date_gmt":"2021-06-04T16:00:32","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/should-you-use-a-monorepo-cloudsavvy-it\/"},"modified":"2021-06-04T19:00:32","modified_gmt":"2021-06-04T16:00:32","slug":"should-you-use-a-monorepo-cloudsavvy-it","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/should-you-use-a-monorepo-cloudsavvy-it\/","title":{"rendered":"#Should You Use a Monorepo? \u2013 CloudSavvy IT"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2bea2867b9a\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a2bea2867b9a\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/should-you-use-a-monorepo-cloudsavvy-it\/#The_Alternative\" >The Alternative<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/should-you-use-a-monorepo-cloudsavvy-it\/#Collaboration\" >Collaboration<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/buradabiliyorum.com\/en\/should-you-use-a-monorepo-cloudsavvy-it\/#Ease_of_Abstraction\" >Ease of Abstraction<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/buradabiliyorum.com\/en\/should-you-use-a-monorepo-cloudsavvy-it\/#Development_Velocity\" >Development Velocity<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/buradabiliyorum.com\/en\/should-you-use-a-monorepo-cloudsavvy-it\/#Who_Are_Monorepos_for\" >Who Are Monorepos for?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/buradabiliyorum.com\/en\/should-you-use-a-monorepo-cloudsavvy-it\/#Summary\" >Summary<\/a><\/li><\/ul><\/nav><\/div>\n<p><strong>&#8220;#Should You Use a Monorepo? \u2013 CloudSavvy IT&#8221;<\/strong><\/p>\n<div id=\"article-content-area\">\n<figure style=\"width: 1838px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"type:primaryImage wp-image-11792 size-full\" data-pagespeed-lazy-src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/05\/6cf6c10d.png?width=1198&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"cloud illustration\" width=\"1838\" height=\"1010\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><figcaption class=\"wp-caption-text\"><span class=\"type:primaryImage imagecredit\"><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.shutterstock.com\/image-vector\/cloud-storage-big-data-analysis-processing-1119224354\">Shutterstock\/Andrey Suslov<\/a><\/span><\/figcaption><\/figure>\n<p>The monorepo pattern uses a single version control repository for all of your projects and assets. You\u2019ll lump your server-side, frontend, and infrastructure config files into one repository that everybody contributes to. Should you use it?<\/p>\n<p>The pattern is popular with large tech companies. Google, Microsoft, and <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/social-mediaa\/\" data-internallinksmanager029f6b8e52c=\"1\" title=\"Social Media\" target=\"_blank\" rel=\"noopener\">Facebook<\/a> <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/github.com\/korfuri\/awesome-monorepo\">are among<\/a> the organizations that use monorepos. What makes a monorepo so <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">app<\/a>ealing?<\/p>\n<h2 id=\"the-alternative\"><span class=\"ez-toc-section\" id=\"The_Alternative\"><\/span>The Alternative<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Monorepo stands against multi-repo. The multi-repo pattern sees you create a new repository for each of your projects. It\u2019s usually pretty clear-cut when a project deserves its own repository.<\/p>\n<p>If you\u2019re building an app, you might have three repositories:<\/p>\n<ul>\n<li><strong>Server-side code:<\/strong>\u00a0Your API (possibly with additional repositories for database schemas and documentation).<\/li>\n<li><strong>Android project:\u00a0<\/strong>Your app\u2019s Android build, using Java or Kotlin.<\/li>\n<li><strong>iOS project:<\/strong>\u00a0Objective-C or Swift for your iOS app.<\/li>\n<\/ul>\n<p>Here, everything that makes up your business is split into distinct units of functionality. With a monorepo, you abandon that grouping and always take the aggregate view. All of your assets belong together and are versioned accordingly.<\/p>\n<h2 id=\"collaboration\"><span class=\"ez-toc-section\" id=\"Collaboration\"><\/span>Collaboration<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>One of the most oft-cited monorepo benefits concerns collaboration. In a monorepo, everyone sees everything. This aids clarity, facilitates openness, and makes it simpler for people on different teams to access each others\u2019 work.<\/p>\n<p>People can more easily work together on a task, even if it falls outside of their usual responsibilities. In a multi-repo scenario, you might need to ask for access to the relevant repository first. This adds friction that the monorepo approach avoids entirely.<\/p>\n<p>Monorepos encourage everyone to hold ownership of the end goal rather than the individual pieces that comprise it. This can lead to people feeling more involved and better informed about what\u2019s going on. An app developer might never touch the server components, but they can \u201cfeel\u201d them evolving alongside their own work.<\/p>\n<h2 id=\"ease-of-abstraction\"><span class=\"ez-toc-section\" id=\"Ease_of_Abstraction\"><\/span>Ease of Abstraction<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Monorepos also simplify code abstraction. It\u2019s common to end up with similar functionality in your backend and frontend components. It makes sense to abstract this out into a shared library.<\/p>\n<p>In the multi-repo paradigm, you\u2019d need to create a new repository and then reference it in the others. That might be by building a package, or by using Git submodules. Either way, a lot of work is needed before your abstracted code can be fed back into the projects it was sourced from.<\/p>\n<p>The process is more straightforward if you have a monorepo. You can move the code to a directory that makes sense, and then import it wherever it\u2019s needed. An \u201cabstraction\u201d takes a matter of seconds. There\u2019s similar convenience when it\u2019s time to document the code: You can add the docs into your shared documentation system.<\/p>\n<p>Multi-repos also exhibit practical hindrances when abstracting code. A development team member often lacks the necessary GitLab, GitHub, or Bitbucket permissions to create a new repository. This results in even greater overheads when a team leader must approve the new library and set up a repository. Monorepos help individual developers create reusable code by eliminating special abstraction processes.<\/p>\n<p>Beyond <em>creating<\/em> the abstraction, monorepos simplify maintenance of shared modules. You don\u2019t need to update each consumer of a package every time that you update it. All dependencies exist in the same codebase, so you can reference them without a package manager or dedicated versioning.<\/p>\n<h2 id=\"development-velocity\"><span class=\"ez-toc-section\" id=\"Development_Velocity\"><\/span>Development Velocity<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Using a monorepo can accelerate development velocity. We\u2019ve touched on this in the previous sections, but it\u2019s worth paying more attention to.<\/p>\n<p>Monorepos reduce duplicate actions. If you need to refactor, it\u2019s a single Find and Replace to apply the change across the codebase. There\u2019s less switching between projects and fewer pull requests to review.<\/p>\n<p>Contributors are given more ability to self-serve. As information isn\u2019t siloed into team repositories, people are better equipped to go looking for the details that they need. This can reduce back-and-forth during code planning and review.<\/p>\n<p>These characteristics also help when you\u2019re refactoring an existing system. Trying to break a legacy application into its \u201cfrontend\u201d and \u201cbackend\u201d might be the wrong approach. Changes in one side will inevitably impact the other, so you\u2019ll be continually reconciling the two repositories. Using a monorepo helps you to quickly refactor large swathes of the codebase, knowing that you\u2019re impacting the whole system rather than piecemeal components.<\/p>\n<h2 id=\"who-are-monorepos-for\"><span class=\"ez-toc-section\" id=\"Who_Are_Monorepos_for\"><\/span>Who Are Monorepos for?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Monorepos are a good fit for large teams with multiple projects. The benefits aren\u2019t necessarily apparent with a handful of small projects. Monorepos work best at a scale where there would be perceptible inefficiency with a multi-repo approach.<\/p>\n<p>Monorepos aren\u2019t the same as monoliths. A monolith usually describes an application where the data and presentational layers are intermixed. The whole system is deployed every time a change is made.<\/p>\n<p>Monorepos <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/general\/\" data-internallinksmanager029f6b8e52c=\"3\" title=\"General\" target=\"_blank\" rel=\"noopener\">general<\/a>ly encapsulate multiple systems. They have multiple output artifacts, such as an API, website, and mobile app. Not all of the artifacts need to be produced for every change. Monorepos are meant to ease code sharing and refactoring. They\u2019re not intended to result in a tightly coupled system that\u2019s artificially bound together.<\/p>\n<p>The pattern isn\u2019t for every team. In many cases, multiple repositories will be easier to work with. They often feel more logical and can be easier to get to grips with. You won\u2019t need to resolve merge conflicts in disparate parts of the system and it\u2019s easier to handle releases. CI pipelines will be quicker, as you won\u2019t be testing every project in each pipeline.<\/p>\n<p>Dedicated repositories present a cleaner commit history, too. Monorepo histories are polluted by commits made to every project within the repo. This makes it harder to track how individual components have evolved.<\/p>\n<p>Multiple repositories are easier to integrate with version control software like GitHub and GitLab. These tools assume a one-to-one mapping between repositories and projects. It can be cumbersome to track issues and pull requests in a monorepo. You\u2019ll need to diligently use tags to scope each issue to the appropriate project.<\/p>\n<p>Finally, take note that most organizations with monorepos are using specialized infrastructure to support them. Git isn\u2019t designed for monorepos, and it can struggle if you reach sufficient scale. Having millions of objects in your commit history can result in slowdowns when Git needs to walk the graph.<\/p>\n<h2 id=\"summary\"><span class=\"ez-toc-section\" id=\"Summary\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The monorepo pattern simplifies code sharing and improves visibility into your assets. This comes at the cost of a clean commit history, increased risk of merge conflicts, and poor support from popular tools. You could also suffer performance issues as the monorepo grows.<\/p>\n<p>A monorepo\u2019s transparency won\u2019t be appropriate in all scenarios. If you\u2019re in a tightly regulated environment, you might need to use individual repositories so that you can enforce appropriate access controls. Monorepos also increase the risk if an employee\u2019s device is lost or stolen. People with physical access would be able to view all of your code instead of just the projects relevant to that individual.<\/p>\n<p>The decision to use a monorepo should be based on your own projects, their cross-project dependencies, and your team members. Don\u2019t look to the big tech companies and expect to observe their successes in your own projects. There\u2019s more to good code culture than the type of repository you use. Monorepos make the most sense where people are already freely collaborating cross-project of their own volition.\n<\/p><\/div>\n<blockquote><p><strong><span style=\"color: #ff6600;\">If you liked the article, do not forget to share it with your friends. Follow us on\u00a0<span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"https:\/\/news.google.com\/publications\/CAAqBwgKMLG0nwswvr63Aw\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google News<\/a><\/span>\u00a0too, click on the star and choose us from your favorites.<\/span><\/strong><\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.cloudsavvyit.com\/11584\/should-you-use-a-monorepo\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#Should You Use a Monorepo? \u2013 CloudSavvy IT&#8221; Shutterstock\/Andrey Suslov The monorepo pattern uses a single version control repository for all of your projects and assets. You\u2019ll lump your server-side, frontend, and infrastructure config files into one repository that everybody contributes to. Should you use it? The pattern is popular with large tech companies. Google,&#8230;<\/p>\n","protected":false},"author":1,"featured_media":266924,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/05\/6cf6c10d.png","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-266923","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/266923","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=266923"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/266923\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/266924"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=266923"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=266923"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=266923"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}