Lesson 16 of 30
One repository holding multiple packages that depend on each other — trading the overhead of many separate repos for the ability to change a shared library and every consumer in one atomic commit.
12 min read
Every option explains itself — why the right one is right, and why each wrong one is wrong. Miss one and it comes back later on a spaced-repetition schedule.
Question 1 of 2
In a monorepo, you change packages/ui's API and need two apps that depend on it updated to match. How does this typically happen, compared to a multi-repo setup?
Hints without spoilers, and a plain explanation of why a wrong answer was wrong — answered only from this lesson. Free account, no card.
Sign up freeWhat interviewers actually ask about this, and what a strong answer has to cover.
A strong answer covers
Likely follow-ups
A monorepo holds multiple, separately-publishable packages (an app, a shared UI library, a shared config) in one repository, with tooling that understands the dependency graph between them:
apps/
web/ (imports from packages/ui)
admin/ (imports from packages/ui)
packages/
ui/ (the shared component library)
config/ (shared eslint/tsconfig)
Changing packages/ui and updating both apps/web and apps/admin to use the new API happens in one commit, one PR — instead of publishing a new version of ui to a registry, then separately updating and testing each consumer repo, each on its own timeline.
Separate repos: packages/ui and apps/web live in different git histories — a shared change means publish, bump version, reinstall.
"Why would a company choose a monorepo over separate repositories?" is a real architectural-tradeoffs question — the strong answer names the actual mechanism (atomic cross-package changes, shared tooling) and the real cost (build/CI complexity at scale), not just "it's what Google/Meta does."