TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Just use a monorepo

263 pointsby jmdukeover 2 years ago

62 comments

scarmigover 2 years ago
I always find monorepo&#x2F;polyrepo discussions tiresome, mostly because people take the limitations of git and existing OSS tooling as a given and project those failings onto whichever paradigm they are arguing against.<p>I&#x27;m pretty excited for new OSS source control tools that would hopefully help us move past this discussion. Particularly, Meta&#x27;s Sapling[0] seems like a pretty exciting step forward, though they&#x27;ve only released a client so far. (MS released its VFS for Git awhile back, but unfortunately now is deprecated.)<p>[0] <a href="https:&#x2F;&#x2F;engineering.fb.com&#x2F;2022&#x2F;11&#x2F;15&#x2F;open-source&#x2F;sapling-source-control-scalable&#x2F;" rel="nofollow">https:&#x2F;&#x2F;engineering.fb.com&#x2F;2022&#x2F;11&#x2F;15&#x2F;open-source&#x2F;sapling-so...</a>
评论 #34366458 未加载
评论 #34364770 未加载
评论 #34368065 未加载
评论 #34363644 未加载
评论 #34363361 未加载
评论 #34364541 未加载
评论 #34362788 未加载
评论 #34363496 未加载
评论 #34411166 未加载
评论 #34380306 未加载
015aover 2 years ago
IMO the biggest drawback to a monolith, maybe beyond those listed, is losing the 1-1 mapping of changes to CI to releases. If you know &quot;this thing is broken&quot;, the commit log is a fantastic resource to figure out what changed which may have broke it. You submit a PR, and CI has to run; getting most CI platforms cleanly configured to, say, &quot;only run the user-service tests if only the user-service changes&quot; isn&#x27;t straightforward. I understand there are some tools (Bazel?) which can do it, but the vast, vast majority of systems won&#x27;t near-out-of-the-box, and will require messy pipelines and shell scripts to get rolling.<p>There&#x27;s also challenges with local dev tooling. Many VSCode language extensions, for example, won&#x27;t operate at their best if the &quot;language signaler&quot; file (e.g. package.json for JS) isn&#x27;t in the root of the repo; from just refusing to function, to intellisensing code in another project into this one, all manner of oddities.<p>Meanwhile; I don&#x27;t think the purported advantages are all that interesting. Being able to write the blog post and make the change in the same PR? I&#x27;ve never been in a role where we&#x27;d actually want that; we want the change running silently in prod, publish the blog post, flip a feature flag or A&#x2F;B test proportions. Even an argument like &quot;you can add schemas and the API changes in one go&quot;; you can do that without a &quot;monorepo&quot;, just co-locate your schemas with the API itself, this isn&#x27;t controversial or weird, this is how everywhere I&#x27;ve worked operates.<p>None of that is to even approach the scale challenges that come with monorepos at even reasonable sizes; which you can hit pretty quickly if you&#x27;re, say, vendoring dependencies. Trying to debug something while the Github or Bitbucket UI is falling over because the repo is too large, or the file list is too long, isn&#x27;t fun.<p>I&#x27;m not going to assert this is a hill I would die on, but I&#x27;m pretty staunchly in the &quot;one service, for one deployment artifact, for one CI pipeline, for one repo&quot; camp.
评论 #34361697 未加载
评论 #34362207 未加载
评论 #34362232 未加载
评论 #34362272 未加载
评论 #34366400 未加载
评论 #34362018 未加载
评论 #34362742 未加载
评论 #34364369 未加载
评论 #34361530 未加载
评论 #34361881 未加载
评论 #34362980 未加载
评论 #34367143 未加载
评论 #34361813 未加载
评论 #34362068 未加载
评论 #34362172 未加载
gorgoilerover 2 years ago
Splitting your business’s mission across hard repository boundaries implies that… you know what you are doing! If that’s you then congratulations. Also: you’re kidding yourself.<p>For the rest of us, being virtually unable to rethink the structure of our components because they are ossified as named repositories is a technical and social disaster. Whole teams that should have faded and been reabsorbed elsewhere will live forever because the effort to dismantle and re-absorb their code into other components is astronomical.<p>The value we bring as engineers is in making sequences of small changes that keep us moving towards our business goal. Boundaries that get in the way are anathema to good engineering. Its exactly as if you were unable to move code between top level directories of your project. Ridiculous.
评论 #34362874 未加载
jsnellover 2 years ago
&gt; Rolling out API changes concomitantly with downstream changes to the documentation or the OpenAPI spec.<p>&gt; Introducing feature-level changes and the blog post announcing those changes.<p>These are horrible reasons to use a monorepo. Commits are not units of deployment. Even if you&#x27;re pushing every system to prod on every commit, you&#x27;d still basically always want to make the changes incrementally, system by system, and with a sensibly sequenced rollout plan rather.<p>To take one of the examples above, why would you ever have the code implementing a feature and an annoucement blog post in the same commit? The feature might not work correctly. You&#x27;d want to be able to test it in a staging environment first, right? Or if you don&#x27;t have staging, be able to run it in prod behind a feature flag gated to only test users, or as a dark launch, or <i>something</i> to verify that the feature is working before letting real users at it and having it crash your systems, cause data corruption, or some other critical problem that would necessitate a rollback. But none of this pre-testing is possible if the code changes are really being done in the same commit as the public announcment.<p>And talking of rolling back... When you revert the code changes that are misbehaving, what are you doing with the blog post? Unpublish it? Or do some kind of a dirty partial rollback that just reverts the code and leaves the blog post in place?<p>The same goes for any kind of cross-project change[0], some of which appear more compelling on the surface than the &quot;code and blog post in one&quot; use case (e.g. refactoring an API by changing the interface and callers at the same time). Monorepos allow for making such changes atomically, but you&#x27;d quickly find out that it&#x27;s a bad idea. There are great reasons to use monorepos, but this is not it.<p>[0] I wrote more about this a couple of years back. <a href="https:&#x2F;&#x2F;www.snellman.net&#x2F;blog&#x2F;archive&#x2F;2021-07-21-monorepo-atomic&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.snellman.net&#x2F;blog&#x2F;archive&#x2F;2021-07-21-monorepo-at...</a>
评论 #34363654 未加载
评论 #34364436 未加载
评论 #34364192 未加载
xiphias2over 2 years ago
&#x27;&#x27;I am here to tell you: if you are running a software business and you aren&#x27;t at, like, Google-tier scale, just throw it all in a monorepo.&#x27;&#x27;<p>Google _is_ a monorepo
评论 #34361742 未加载
评论 #34361442 未加载
评论 #34362276 未加载
Yahivinover 2 years ago
Monorepos are great! They&#x27;re so good one place I worked at had dozens of them.
评论 #34363142 未加载
yodsanklaiover 2 years ago
My understanding is that Meta&#x2F;Google had to rewrite tons of stuff (distributed file systems, CVS, search tools, build tools...) and need many teams to maintain all these systems, and sometime their developer experience is inferior to what you get with off-the-shelf OSS. I&#x27;m not super familiar with this topic as I don&#x27;t work with systems of that scale, but I&#x27;m wondering was it worth it or necessary? what would be the alternative?
评论 #34362059 未加载
评论 #34361468 未加载
评论 #34362228 未加载
评论 #34362605 未加载
评论 #34362689 未加载
ankitdceover 2 years ago
For everyone who complains about monorepos, remember some of the most forward thinking engineering companies like Google and FB also use monorepos. All the arguments that people make in favor of polyrepo are making so because of lack of strong tooling for monorepos. That&#x27;s also why Google and FB would not have scaled if they were using GitHub &#x2F; GitLab but had to build their own. Also Google&#x27;s original source control was built on top of perforce!
评论 #34362993 未加载
评论 #34363024 未加载
评论 #34364392 未加载
评论 #34362966 未加载
评论 #34363595 未加载
评论 #34362969 未加载
评论 #34362948 未加载
评论 #34366008 未加载
_rmover 2 years ago
I&#x27;d like to add my own PSA in concurrence with this.<p>Just use a monorepo. Use tooling to work around its limitations if you reach that point.<p>I work in a SaaS that&#x27;s polyrepo based, having split from its original monorepo as part of a microservices push (which never succeeded, leaving us stuck half way in the worst of both worlds).<p>Nothing has been more destructive to productivity than the polyrepos and their consequences. We&#x27;re talking a 20% engineering spend dead weight loss.<p>This is stark obvious to every single engineer, but trying to get people to accept that fact and sign off on a project to coalesce them back into a monorepo is just insurmountable.<p>Polyrepos are irreversible damage, stay away from them. Hold the line on your monorepo. One organisation, one repo.
评论 #34363000 未加载
评论 #34366251 未加载
评论 #34366650 未加载
berjinover 2 years ago
I&#x27;m going to start a new term: goldilocks repo.<p>Too small and you end up needing to deploy 5 apps to get your feature out and tests are difficult to coordinate.<p>Too large and the huge CI suite takes forever, people step on each others toes and it can be difficult to get things done. Access control and permissions is also difficult if you ever want to transfer ownership to another team.<p>The happy middle ground is to follow Conways law a little and have a few related apps&#x2F;modules belonging to the same team in one repo and an a CI that has a simple integration test for all of them. It&#x27;s fairly natural to achieve this if you don&#x27;t have people following cargo cult memes.
throwaway_au_1over 2 years ago
I would like for any article insisting I adopt any practice to put a little more effort into doing so. This seems to amount to &quot;it&#x27;s good&quot;, &quot;I should have done it sooner&quot;, &quot;it&#x27;s not so bad, trust me&quot;, and &quot;smart people like it, too&quot;. Could have been a tweet.
评论 #34361417 未加载
siliconc0wover 2 years ago
Probably disagree - Google has built a boat-load of infrastructure to enable a mono-repo which you don&#x27;t have and (I don&#x27;t think) aren&#x27;t even available either OSS or commercial. Use modules&#x2F;libraries as an alternative to separate repos. This may require a few more commits for distributed changes but that isn&#x27;t hard and forces you to consider realities like, &quot;what if A service is deployed before B service?&quot; which happen whether or not you&#x27;re using a mono-repo. Also use data-lakes for data or generated artifacts (something based on S3 or an S3-alike).
评论 #34362728 未加载
评论 #34361755 未加载
erksaover 2 years ago
Earlier in my career I was so excited to learn about microservices, as I was working with a huge monolith at the time. Then I went a bit overboard, and for a new prototype I had all these services in different repos and running independently. It was all very cool and I felt very accomplished, only to later (and now painfully obvious) be pointed out it was completely unnecessary, to the point each function basically was its own deployment. But not in a way that made any sense. If you were looking for the _most_ expensive way of running things, maybe.. hah<p>Tunnel-vision is a powerful thing, and if this is how people are splitting repos now a days, it seems I might not have been the only one chopping up perfectly good dish only to be left with the individual ingredients.
评论 #34362284 未加载
评论 #34366658 未加载
shagieover 2 years ago
For me, this boils down to a question of &quot;what set of problems do you want to solve?&quot; and &quot;what set of problems do you want the system to solve for you?&quot;<p>To this end, I am generally a monorepo proponent. The problems with &quot;what gets built&quot; and how do you do versioning of the components&quot; for the systems that I work on is an easier set of problems to solve than &quot;how do I ensure that I don&#x27;t break anything else when I update this method?&quot; and &quot;if I do break something when I update the method, where is everything that needs to change?&quot;<p>I&#x27;ve had projects that were fractured across half a dozen repos where libraries were versioned and tagged and and deployed, and then the next down stream was updated to use the newly tagged version... and something broke. This was especially bad when the &quot;something broke&quot; was part of another team&#x27;s code or it had been thrown over a wall. A bunch of changes, many PRs - some of which are just updating a version to pull from the artifact repo.<p>When things were updated, I took the opportunity to move all of those projects into one monorepo and I only had one PR to review - that passed all the tests for all of the projects contained within the monorepo.<p>Yes, deployments and tagging and the &quot;well, just because you reved X to 2.3.0 doesn&#x27;t mean that Y is at 2.3.0 too&quot; (strict semver can get a bit on the messy side).<p>It&#x27;s a question of which problems do you want to solve. I tend to find that me solving the &quot;how do I set up the ci file and coordinate version numbering&quot; is an easier problem to solve than &quot;all these builds need to be updated in a bunch of different repos and one of them breaks.&quot;
osigurdsonover 2 years ago
I call bike shed on the entire debate. One repo or many can work fine depending on the situation.
评论 #34362404 未加载
sakexover 2 years ago
&gt; I am here to tell you: if you are running a software business and you aren&#x27;t at, like, Google-tier scale, just throw it all in a monorepo.<p>Funny because Google is famous for having a monorepo at scale.
wankleover 2 years ago
&quot;Maybe it&#x27;s some abstract sense of purity&quot;<p>Someone gets a few lines of code under their belt and now they overwhelmingly know what is best for all.<p>It&#x27;s simple, if it gets released together, put it in the same repo (even if it&#x27;s a big repo like the Linux kernel). If not, separate it out so you can stay sane.<p>If it&#x27;s not released together then it&#x27;s a monorepo, also defined as a big ball of spaghetti.
Octabrainover 2 years ago
I have my doubts about the mono repo approach. From the top of my head:<p>1. It might increase the complexity of other process on that repo: CI&#x2F;CD configuration, makefiles, branching strategies, codeowners etc<p>2. The versioning might lose its meaning<p>3. Blast radius in case of screwing things up accidentally.<p>I personally split repositories based on responsabilities: here the code base, here the iac, here the configuration, here the manifests. Always using a standard and predefined naming convention for the repository names. That being said, as always, it depends. I might embrace the monorepo if the context demands it and it has been properly discussed and evaluated.
评论 #34362155 未加载
bluGillover 2 years ago
Polyrepo and monorepo both work well if you have the right tools and workflows in place. Both have substantial downsides.<p>If you can&#x27;t admit the above then you are either ignorant or trying to sell something. Either way I don&#x27;t want to talk to you.<p>The rest of us can now discuss pros and cons.
评论 #34363128 未加载
raydiatianover 2 years ago
Here’s why I’ll never go back to anything but a monorepo.<p>My previous org decided on this for their source control&#x2F;build dependency layout:<p>1. Monolith, home to front and back end, artisanal handcrafted openapi spec that plugged into nothing and was just for show.<p>2. Hand-painted service-cli library, which was supposedly going to be open source for customers but never was, and only mattered to the front end, back in the monolith. We manually kept it in sync with the backend, to everybody’s benefit (YFR). Hope you see it: backend changes left the monolith into the service-cli, back to the monolith. Face, meet wall.<p>3. A knapsack full of tiny libraries which all could have been wrapped up in one. They were all dependencies that plugged into the monolith and the service-cli. And they all had subdependencies.<p>4. Everything version-wise was synced via private npm registry. So if you wanted to make a change that went into the next version of monolith, but the code had to live in a leaf dependency way down at the bottom, you had to run a relay race marathon of red-tape PRs that you had to bribe your coworkers to pay attention to and&#x2F;or approve.<p>The entire time, several of us on the team were begging the core team to repair this and they basically told us “no we believe in the tenets of sadism, now take your allotted pain, feature-bitch.”<p>This company employed 150+.
jgavrisover 2 years ago
Even in a private monorepo, Google has tools like Copybara that make it somewhat easy to &#x27;open source&#x27; small pieces of it and sync them in and out of a &#x27;public&#x27; repo. The benefits of a monorepo and just having to &#x27;git checkout&#x27; and your entire environment &#x27;just works&#x27; (I&#x27;m looking at you, scripting languages and build systems) is not to be taken lightly.
TeeMassiveover 2 years ago
Where I work we just package everything (nugets, python packages, npm) on our Artifactory. Contracts dependencies (DLLs, protobufs) are also distributed as packages. We made it easy to fetch and test the source and allow developers to develop, debug and test those dependencies with their own project if needed.<p>Every time we try to assemble repositories in macro-repos we always end up regretting it. Multiple dedicated repositories allow autonomy for teams and enforce modularity and coding as a library. Monorepos have a tendency of becoming huge merge trains easily and often derailed and with lots of fear of being blamed on stepping on someone else&#x27;s toes.<p>We update often all our projects knowing full well that not doing so is just borrowing development time at high interest rate.<p>As a side-note when we do have to do an assembly of different code base, we use git-subrepo: <a href="https:&#x2F;&#x2F;github.com&#x2F;ingydotnet&#x2F;git-subrepo">https:&#x2F;&#x2F;github.com&#x2F;ingydotnet&#x2F;git-subrepo</a> which provide the best of both submodules and subtree.
0xbadcafebeeover 2 years ago
Do not listen to pithy blog posts. Seriously. There&#x27;s too many factors to consider that aren&#x27;t in the blog post. They get upvoted on HN here quickly, and most often when they are written from ignorance, which seems super confident, and leaves out all the detail and nuance that could make such an upvote questionable. I&#x27;m pretty sure the upvotes are based on an emotional reaction to the title alone. (The &quot;reasonable drawbacks&quot; part of this post should have been like 5 pages; and the same for multirepo)<p>If you really want to know whether you should use a monorepo, first go buy a book about them. Then talk to senior leaders in organizations that have gone through an entire growth cycle and migrated from multirepo to monorepo or vice versa. The random dude on the random blog post doesn&#x27;t have the perspective to inform you properly about the implications. Hell, <i>I&#x27;ve done the switch twice</i>, and I still wouldn&#x27;t call myself an expert.
throwaway892238over 2 years ago
The whole thing really comes down to this difference: If you want to change one piece of software, it&#x27;s faster and easier with multirepo; If you want to change many pieces of software, it&#x27;s faster and easier with monorepo.<p>All a repository really is, is a collection of files in one &quot;bucket&quot;. No magic involved, no secret sauce, no woo-woo philosophical jargon to intone, no technical mastery to obtain. There are other <i>features</i> of a repository, like branches, tags, subrepos, LFS, etc. But you don&#x27;t even really have to use any of those things. At its core it&#x27;s just files in buckets.<p>The complexity comes in once you have to start working with these buckets of files. How do I change a lot of files in one bucket? How do I change a lot of files in a lot of buckets? When I want to perform an action with the files (&quot;build&quot;, &quot;test&quot;, &quot;deploy&quot;, etc), in one or many buckets, how do I do that?<p>How do I do these things with multiple people simultaneously changing the same files? Or files that depend on files that depend on files? How do I coordinate the subsequent actions of the first actions on the buckets on the files with multiple people testing multiple changes simultaneously?<p>No matter what option you choose, there will be choices you have to make which require compromise. You will <i>eventually</i> have to work around the complicated consequences of these compromises. No matter what you choose, there is always a way to make things easier, but it always requires work to get there.<p>So really the question isn&#x27;t monorepo or multirepo. It&#x27;s what actions do you want to make easy first, and what consequences you want to spend engineering effort to fix first. But at the end of the line, assuming your product exists long enough, everybody ends up with basically the same system, because all of them, when people use them in complex ways, require complex solutions.
评论 #34364199 未加载
pancakemouseover 2 years ago
Anecdotally, as a developer I really appreciate a well-thought-out monorepo. All the code is there. You don&#x27;t have to dig around anything legacy or outdated. Searching is a breeze and it&#x27;s _fast_. Updating both simple and complex logic is equally easy. You don&#x27;t need to <i>somehow discover</i> that some other repo uses the thing you changed. Everything has the same deployment process. The tests test the thing, as soon as you push it - instead of months down the line, when someone finds forgotten repo again and oh, it&#x27;s never been tested with the new functionality in our main repos. Dependency hell doesn&#x27;t really exist.<p>There seems to be more discipline around monorepos because they&#x27;re collectively owned, whereas many repos across an org each become someone&#x27;s baby, and practices diverge until teams in the _same company_ fork each others&#x27; repos because they don&#x27;t get along.
arrakeenover 2 years ago
this is the first i&#x27;ve heard of &quot;microrepositories&quot; but it appears like the author may have just been overzealous with partitioning their repositories and has now settled on what most of us would just call a &quot;repo&quot;.
ridiculous_fishover 2 years ago
How do monorepos work with something like gitlab or github, which expect a CI file in the repo root?<p>My workplace has dozens of repos, and they all have separate CI needs and test suites. Trying to shoehorn them all into a single set of CI pipelines would be very difficult, even with the include and parent-child pipeline features.
评论 #34362916 未加载
评论 #34362545 未加载
评论 #34363046 未加载
harryvederciover 2 years ago
I use a megarepo, if that&#x27;s a thing.<p>One repo with multiple unrelated apps, plus a &quot;shared&quot; directory.<p>I could put the shared dir in a package, but so far I don&#x27;t really see the need.
评论 #34361851 未加载
Shinchyover 2 years ago
Having worked for a company that had a monorepo approach and seeing what happens when it hits its apex of issues I don&#x27;t think I would ever advocate for one again. I&#x27;m sure it works for some companies, but when it goes wrong it can literally destroy an entire company.
评论 #34366754 未加载
jay-barronvilleover 2 years ago
This might be an unpopular opinion, but to me, this is just an unsolved problem. Between polyrepos and monorepos, I’m not convinced either of them is a clear winner. I’ve used both structures and as a project grows, I dislike them both for different reasons.
LarsDu88over 2 years ago
To all the folks thinking that this project is too small to be representative of the benefits of monorepo -- both real world success stories and theory point towards monorepo being superior.<p>I&#x27;ve seen this at several orgs. A polyrepo runs into dependency hell, so they go to microservice. Now you have dependency hell and microservice hell. Furthermore, your microservice have APIs that need to be updated, so each change needs to be done in multiple microservice repos. So to solve one problem you now created three problems.<p>Monorepo reduce dependency hell to source control. The vast majority of monorepo issues people encounter are due to using &#x27;git&#x27; which is why Google and Meta do not use &#x27;git&#x27; at all.
评论 #34364568 未加载
fullstackchrisover 2 years ago
My 2 cents: monorepos try to solve what is actually a series of devops problems, by essentially abusing the way an organization or individual uses git (or VCS of your choice). These tools that were never designed for devops in the first place.<p>To elaborate: I think you are much better off, whether as a team or solo developer, developing small, isolated, and tested &#x2F; reliable libraries and &#x2F; or packages that can be combined as needed. Ideally, each package or library can build, test, and ship itself at the CI&#x2F;CD level. Trying to encapsulate all that into one giant conglomerate of potentially different languages, file types, frameworks and much more sounds exactly what it is: a mess!
评论 #34361770 未加载
评论 #34362119 未加载
评论 #34361802 未加载
评论 #34363060 未加载
SpeedilyDamageover 2 years ago
No! I&#x27;m tired of being told how to architect systems because other folks refuse to grow their knowledge.<p>Because I&#x27;m good at my job, a monorepo would be pants-on-head stupid. Because I know how to make separate codebases interact with one another successfully, it would be a massive mistake to lose those advantages, all because <i>you</i> (not me) run into problems when <i>you</i> try to do what I find perfectly natural.<p>And if you work with me, you will learn, and I will guide you, and in time you will experience systems design as I do, and no longer be shackled to only doing the things you understand today.<p>But no, &quot;do this because I don&#x27;t know how to do that&quot; will never be a winning argument.
评论 #34367264 未加载
评论 #34362300 未加载
评论 #34363135 未加载
ohCh6zosover 2 years ago
I have worked at places that have micro-repos, places that have polyrepos, and places that have monorepos. From my observation monorepos are a sign of ossification and resistantce to new patterns and new technologies.
maxyurkover 2 years ago
IMO it&#x27;s not really a monorepo. There&#x27;s a single codebase really. The author didn&#x27;t meet the real monorepo pain points yet. The author didn&#x27;t mention git operations slowing down, CI not handling the scale of the commit events from a single source and so on, instability of codebase due to many parallel changes, painful merges etc.<p>The difference between 150K LOC and Google&#x27;s largest codebase in the world is huge and AFAIK google has a monorepo.<p>From my experience real monorepo requires a lot of tooling and maintenance.
karmakazeover 2 years ago
I was curious why it was a big deal either way for a smaller codebase&#x2F;documents to use a monorepo or not. It&#x27;s mentioned:<p>&gt; You may be reading this short essay and thinking: &quot;Yeah, no shit! Of course you do not need a monorepo when you&#x27;re talking about, like, 150K lines of code.&quot;<p>&gt; Maybe it&#x27;s some abstract sense of purity; maybe it&#x27;s because you didn&#x27;t realize most IaaS let you deploy from a subfolder. Whatever the reason is: trust me. Move it into a monorepo. If you do and you end up regretting it, [email me] and I&#x27;ll donate to the charity of your choice.<p>So the new thing being said here is that a monorepo makes sense even at smaller scales. This seems to on the far other end of the scale with a main app, supporting infra, docs, marketing, etc.<p>I&#x27;ve certainly used fullstack repos with backend and frontend together and it&#x27;s fantastic to use and deploy from commits. I can&#x27;t infer from this article or my experience what it would be like to work with a monorepo at medium scale say 10-100 apps with 10s of teams. That would take more adaptation than simply &quot;deploy from folder&quot;. Dependencies as mentioned in another comment and being able to detect if each target should be retested&#x2F;deployed seems like the tough one.
评论 #34362738 未加载
patrick451over 2 years ago
One problem he didn&#x27;t mention with the poly-repo approach is that repositories are like rabbits: as soon as you have more than one they begin breeding. Repositories, plural, beget more repositories.<p>The problem of course is that the only way to share code between repos is to create another repo. As the saying goes, once you have two things, you will soon want three.<p>&quot;Oh, repo B needs to use some code in repo A. We&#x27;ll just split that out into a separate repo.&quot;<p>Be very wary of this impulse. Soon, you end up in the situation I&#x27;m in now, where you have hundreds of tightly coupled repos, some with a single file! Worse, these all compose at runtime into only one application running on one host.<p>Consider instead that perhaps repo A and repo B should be joined. Or, (yes I dare say it), that perhaps the code should be duplicated.
coding123over 2 years ago
This bugs me about Java software. Instead of having a single library, the library maintainers create some interface and then 30 more jars that implement it - xwidget-dropbox, xwidget-google-drive, xwidget-onedrive, etc... It&#x27;s just really stupid. Everyone just pull down xwidget and move forward. Same goes for npm packages and front end things, rely on your treeshaker and ES6
hansvmover 2 years ago
You have a monorepo anyway, and the choice is between dealing with it via wrappers automated or manual wrappers around tools like git (e.g., manually cloning relevant repositories and constructing a build environment referencing all the right versions appropriately) or whether you&#x27;ll use dedicated monorepo tooling.<p>That&#x27;s still maybe an interesting question, but when appropriately framed it highlights that the real issue is that monorepo tooling may or may not fit your use case well, and you might be better served by hacking together more primitive solutions or making your own tooling.<p>IMO, the major point of the article still stands; git and whatnot are pretty good, and the build&#x2F;deploy tools interacting with your code are probably terrible, so absent major outside pressures you&#x27;ll go a long ways figuring out how to leverage git (in a monorepo configuration) against jenkinbuckethubernetes, and that&#x27;s often much less painful than inevitably figuring out how to marry two ancestrally disjoint codebases.
28304283409234over 2 years ago
Does this discussion not also apply to most mono vs poly scenarios? Monolith vs microservices comes to mind. The infamous monolith kernel vs micro kernel discussion between Tannenbaum and Torvalds. Even small companies vs large ones.<p>We shift the complexity and pain to where we are most comfortable with it. Or where we see the best benefits from the trade off.
yellowappleover 2 years ago
Another big disadvantage of monorepos is the size. If you&#x27;re having to clone the repo in its entirety on a routine basis (think CI&#x2F;CD pipelines, or there&#x27;s some other repo that needs to maintain multiple work trees referencing different commits), that repo being some massive monstrosity can be a real pain in the ass.
Dave3of5over 2 years ago
I mean the only ways you can work with a monorepo are either submodules or a package manager. Do devs really think these are better than a folder ?<p>Having used both they both introduce unneeded complexity and get in the way of actual development. If you use a sensible and modern CI they all support a monorepo flow.
jrmcauliffeover 2 years ago
Once you reach a certain scale in a particular type of company the repo just becomes another type of org unit. Your giant fish swallows a minnow, it looks good on paper, someone does a half arse integration, then that repo becomes the one. The one that your manager says, under no circumstances no-one commits to, because then it&#x27;s OUR repo (with whatever baggage that brings)... The org depends on the code, but the org actively resists it like a virus. This kills any attempt at the mono repo at any largish non FAANG org.
erik_seabergover 2 years ago
People keep raving about google3, but it had recurring problems with changelists (far outside your own project) that break the world and stop you from testing or deploying anything new for hours. Eventually they had to give up on using everything at head, and instead use known-good versions of major shared dependencies that were a few hours or days behind head.<p>I want to bump our dependencies when we have the slack to handle the risks. Alpha testing every commit of every library is not really how our team is supposed to be spending our time.
humanrebarover 2 years ago
Most opinions about monorepos conflate monocultures in source control with monocultures in build systems or workflows. Those two considerations are technically orthogonal. You can have one big repo with N build systems (like a node app and a python app in the same repo with disjoint workflows). And you can have N repos that have a common build system (each can combine into one big build with cloning and&#x2F;or submoduling).<p>I find most of these conversations are more interesting when people decide to make that distinction.
IshKebabover 2 years ago
&gt; You cannot apply role-based access controls to certain parts of the repository for security&#x2F;compliance reasons.<p>You can (at least for write access). Maybe he&#x27;s talking about read access.
评论 #34362435 未加载
etherealGover 2 years ago
For your 2nd drawback, I can recommend checking out git subtree. It allows 2 way split and merge of any subtree of a repo. You can easily open source part of your repo in a “fork” and keep it up to date with your mainline as well as incoming pull requests with very little effort.
dajonkerover 2 years ago
I couldn&#x27;t agree more with the author, there&#x27;s nothing worse than the self-flagellation of having a single change in one repository triggering a snowball effect where you have to update a dozen of other repositories, open another dozen pull requests to be approved, and carefully time releases so you don&#x27;t break anything.
评论 #34366175 未加载
ozimover 2 years ago
So author seems to have problem with premature optimization. It is not that you should not use monorepo for everything - only when starting out maybe you will be better off starting with single repo and then if you have the need to make a separate one.
Vekzover 2 years ago
Anyone have resources on how to actually perform the migration of many repos to monorepo? Currently facing the same issue and want to make the consolidation move but now sure on how to merge the git history. This article and the previous one it links to are missing all the implementation details.
评论 #34364371 未加载
评论 #34362861 未加载
评论 #34363185 未加载
v3ss0nover 2 years ago
How it works with a team More than one person?<p>How many merge conflicts it gonna introduce with just a team of 4?<p>Mono repo also means that merging both frontend and backend into one, even with totally different languages? Should be fine with traditional web framework but how it will become for API+ SPAs?
jphover 2 years ago
Monorepo vs. Polyrepo guidance thanks to many contributors: <a href="https:&#x2F;&#x2F;github.com&#x2F;joelparkerhenderson&#x2F;monorepo-vs-polyrepo">https:&#x2F;&#x2F;github.com&#x2F;joelparkerhenderson&#x2F;monorepo-vs-polyrepo</a>
LarsDu88over 2 years ago
Meta, Google, Microsoft, Twitter -- all of these companies use the monorepo. I wonder if taking the monorepo (and managing it successfully) actually has something to do with company&#x27;s becoming successful.
hendryover 2 years ago
Thanks, inspired to create a video because of this post <a href="https:&#x2F;&#x2F;youtu.be&#x2F;pKOF2DQnfno" rel="nofollow">https:&#x2F;&#x2F;youtu.be&#x2F;pKOF2DQnfno</a>
mr90210over 2 years ago
Just use what works well for you and your team, how about that?
jshenover 2 years ago
Does anyone have a pointer to a tutorial or example of what a successful monorepo and process looks like?
voz_over 2 years ago
Monorepos for life, don&#x27;t conflate code storage and organization with deployment lifecycles tho.
exabrialover 2 years ago
I mean you can do whatever you want, but versions, tags, releases seem like a lot less work.
fergieover 2 years ago
But doesn&#x27;t Google actually have a monorepo?
nonethewiserover 2 years ago
And trpc.<p>If you&#x27;re using typescript.
dima_vmover 2 years ago
You cannot open-source parts if it&#x27;s a monorepo.
snow_macover 2 years ago
Just don&#x27;t.