Compare monorepo and polyrepo strategies in CI/CD

Tests repo structure impact on builds, dependencies, and pipeline triggers. Contrast monorepo atomicity with polyrepo autonomy; cover monorepo change-detection versus polyrepo versioning and contract tests.
What's really being asked
This question tests whether you can reason about second-order effects of repository topology on continuous integration and delivery systems. Interviewers care less about which strategy you prefer and more about whether you understand the mechanical implications for build graphs, pipeline triggers, dependency resolution, and team autonomy at scale. They want to see systems thinking about how a git boundary changes caching, blast radius, and coordination overhead.
The full answer
First, define the core tradeoff: monorepo optimizes for code sharing and atomic changes across services, while polyrepo optimizes for deployment independence and team sovereignty. Second, for build orchestration, explain that monorepos require incremental builds and fine-grained dependency graphs to avoid O(n) build times, typically using tools like Bazel, Buck, Nx, or Turborepo with remote caching, whereas polyrepos naturally scope builds to a single service but require orchestrating downstream builds when shared libraries change. Third, for dependency management, note that monorepos can use source-based dependencies where all code moves in lockstep, eliminating version skew but requiring strict code health, while polyrepos rely on published artifacts, semantic versioning, and artifact registries, introducing diamond dependency problems and upgrade lag. Fourth, for pipeline triggering, describe how monorepos need path-based filters or affected-graph detection to run only relevant pipelines, while polyrepos need cross-repo webhook chains or metadata files to trigger dependent service builds when a shared library is released. Fifth, propose concrete mitigations: for monorepo, invest in change-detection algorithms, build caching layers, and CODEOWNERS for scoped approvals; for polyrepo, invest in internal package registries, contract tests, and automated dependency update bots.
The mistakes people make
Declaring monorepo is always simpler because everything is in one place without acknowledging the CI complexity of rebuilding a thousand services on every commit. Conversely, claiming polyrepo eliminates coupling without explaining how you prevent breaking changes in shared libraries consumed by ten downstream repos. Another red flag is suggesting git submodules as a clean polyrepo solution, since submodules create more CI orchestration pain than they solve. Finally, confusing the repository strategy with the deployment strategy, such as assuming monorepo means monolith or that polyrepo requires microservices.
What usually comes next
How would you migrate from one model to the other without halting releases? What is your strategy for handling security patches across a hundred polyrepo services versus a monorepo? How do you manage long-running feature branches in a monorepo when mainline changes affect multiple services? Describe how you would design a build cache eviction policy for a monorepo with hundreds of daily developers.
A concrete example
At a previous company using a monorepo with roughly fifty microservices, CI time ballooned because any commit triggered every pipeline. We mitigated this by migrating to Nx with a distributed task execution graph and remote caching. The CI system computed the affected project graph from the merge base, running only tests and builds for changed services and their dependents. Build times dropped from forty-five minutes to eight minutes for typical changes. In contrast, when I worked with a polyrepo setup, we established an internal npm registry and required every shared library change to pass a downstream compatibility matrix in CI before the artifact could be promoted from release candidate to stable, preventing silent breakages in consuming services.
Interview question
What is the key CI pipeline difference between a monorepo and polyrepo when a developer modifies a shared library?
- a.Polyrepos allow atomic updates across all consuming services in a single commit, while monorepos require coordinated releases
- b.Monorepos need path-based filters to avoid rebuilding unaffected services, while polyrepos need cross-repo triggers to rebuild downstream consumersCorrect
- c.Monorepos automatically version the library with semantic versioning, while polyrepos require manual version bumps
- d.Monorepos eliminate the need for build caching because all services share a single build graph
Why? this is the answer
Monorepos rely on path-based or affected-graph detection to prevent every commit from rebuilding all services, while polyrepos must use cross-repo webhooks or metadata to trigger downstream pipelines when a shared library changes. Option A dangerously reverses the actual tradeoff: atomic cross-service commits are a monorepo advantage, whereas polyrepos optimize for deployment independence rather than atomicity.
Just read this? Test yourself on what you have been reading.
Read the original → aviator.co
You just looked this up. Could you explain it out loud?
That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on ci/cd — each one lists the topics its interview covers.
See open roles