Last updated:
October 23, 2026

Monorepo Architecture: Managing Multiple Projects in a Single Repository

A monorepo (mono-repository) is a single version-controlled repository that contains multiple distinct projects, libraries, and services — instead of scattering them across separate repos. Companies like Google, Meta, Microsoft, and fast-growing Indian startups use monorepos to share code, enforce consistency, and ship faster. This guide covers when monorepos make sense, which tools to use (Nx, Turborepo, Lerna), and how to set one up for your team in 2026.

Last updated October 2026

What Problem Does a Monorepo Solve?

Imagine your agency or product company has these projects:

  • A React front-end for your SaaS dashboard
  • A Node.js/Express API back-end
  • A React Native mobile app
  • A shared component library (UI kit)
  • Internal CLI tools
  • Documentation site

In a polyrepo setup, each lives in its own Git repo. Sharing code means publishing to npm (private registry — ₹1,500-6,000/month on npm Teams or self-hosted Verdaccio), versioning, and syncing updates across repos. A breaking change in the UI kit means updating 3-4 consumer repos, each with its own CI pipeline.

In a monorepo, all projects live together. A change to the UI kit and its consumers happens in one atomic commit. CI runs affected tests automatically. No publishing step for internal packages.

Monorepo vs Polyrepo vs Monolith: Key Differences

AspectMonorepoPolyrepoMonolith
Code organisationMany projects, one repoOne project per repoOne tightly coupled app
Code sharingDirect importsPublished packagesInternal imports (coupled)
Dependency syncAtomic updatesManual cross-repo PRsSingle dependency tree
CI/CD complexityMedium (needs smart build)Simple per repoSimple but slow (builds everything)
Team autonomyHigh (with CODEOWNERS)HighestLow
Ideal team size5-500 developersIndependent small teamsSmall teams (under 10)

When Should You Use a Monorepo?

A monorepo shines when:

  • Multiple projects share significant code (UI components, utilities, types, schemas)
  • You want one CI/CD pipeline that understands cross-project dependencies
  • Your team needs consistent tooling (linting, testing, formatting) across all projects
  • Cross-project refactoring is frequent
  • You’re a product company or agency building related apps (common in Indian IT companies building SaaS suites)

Avoid monorepos when projects are truly unrelated, when teams are in different organisations, or when your Git hosting struggles with large repos (GitHub free has soft limits around 1GB; Bitbucket limits repos to 2GB).

Top Monorepo Tools Compared (2026)

Nx (by Nrwl)

  • Best for: Full-featured monorepo with smart dependency graph, caching, and code generation.
  • Languages: JavaScript/TypeScript (first class), plus Go, Java, .NET, Python plugins.
  • Key features: Computation caching (local + remote via Nx Cloud — free tier available), affected-only builds, generators (scaffolding), module boundary enforcement.
  • Learning curve: Moderate. Opinionated but powerful.
  • Pricing: Open source. Nx Cloud: free for small teams, paid plans from ~$50/month (~₹4,200/month) for larger teams.

Turborepo (by Vercel)

  • Best for: Lightweight, fast build orchestration for JavaScript/TypeScript monorepos.
  • Key features: Incremental builds, remote caching (via Vercel or self-hosted), pipeline definitions, near-zero config.
  • Learning curve: Low. Adds a turbo.json config and works with existing npm/pnpm/yarn workspaces.
  • Pricing: Open source. Remote caching free on Vercel hobby plan.

Lerna (revived by Nx)

  • Best for: Publishing multiple npm packages from a monorepo (open-source libraries).
  • Key features: Version management, changelog generation, publishing workflows.
  • Learning curve: Low to moderate. Since Nx took over, Lerna uses Nx under the hood.
  • Pricing: Open source.

pnpm Workspaces

  • Best for: Lightweight monorepo with efficient disk usage (shared node_modules via symlinks).
  • Key features: Strict dependency isolation, fast installs, built-in workspace protocol.
  • Learning curve: Low. Just a pnpm-workspace.yaml file.
  • Pricing: Open source.

Setting Up a Monorepo with Nx: Step-by-Step

Here’s a practical setup for a typical Indian product company building a SaaS application:

  1. Create the workspace: npx create-nx-workspace@latest mycompany --preset=ts
  2. Add applications: nx g @nx/react:app dashboard and nx g @nx/node:app api
  3. Add shared libraries: nx g @nx/js:lib shared-types and nx g @nx/react:lib ui-kit
  4. Configure module boundaries using Nx’s @nx/enforce-module-boundaries lint rule — prevent the API from importing React components, for example.
  5. Set up CI: Use nx affected --target=test to run only tests touched by the current PR. Configure in GitHub Actions, GitLab CI, or Bitbucket Pipelines.

Dependency Management in a Monorepo

Key decisions:

  • Single version policy (recommended): All projects use the same version of React, TypeScript, etc. Avoids “dependency hell.” Nx enforces this by default.
  • Package manager: pnpm is the modern default for monorepos due to strict isolation, disk efficiency, and speed. Yarn 4 (Berry) with PnP is an alternative but has compatibility headaches with some tools.
  • Lockfile: One lockfile at the root. Never check in nested lockfiles.

CI/CD for Monorepos

The biggest operational challenge. Key principles:

  • Build only what changed: Nx’s affected graph or Turborepo’s --filter ensure you don’t rebuild 15 apps when one README changed.
  • Remote caching: CI runs are 10x faster when unchanged computations hit the cache. Nx Cloud, Turborepo remote cache, or self-hosted solutions (Nx supports custom remote cache adapters).
  • Separate deployment pipelines: Even in a monorepo, the API deploys to AWS ECS and the dashboard deploys to Vercel — they just share the same PR and commit.
  • GitHub Actions cost: For Indian startups on tight budgets, optimise runner minutes. Use paths filters in workflows to skip irrelevant pipelines. Self-hosted runners on a spare machine or a ₹500/month DigitalOcean droplet can save ₹3,000-10,000/month in CI costs.

Common Pitfalls and How to Avoid Them

  • Git performance: As the repo grows past 5GB, Git operations slow down. Use Git sparse checkout, shallow clones in CI, and .gitignore build artefacts aggressively.
  • Overwhelming PRs: Cross-project atomic changes mean PRs can be huge. Enforce CODEOWNERS files and automated PR labels per project.
  • IDE slowness: VS Code with a 200,000-file monorepo can be slow. Use workspace trust, exclude build directories, and consider Nx Console extension for targeted builds.
  • Migration pain: Moving from polyrepo to monorepo is disruptive. Start by merging the two most related repos, prove the workflow, then expand.

Monorepos for Indian Dev Teams: Practical Tips

  • If your team is under 5 developers, start with pnpm workspaces + Turborepo. You don’t need Nx’s full power yet.
  • Use Bitbucket if your company mandates Atlassian tools (common in Indian enterprises). Bitbucket Pipelines supports monorepo workflows but has lower free-tier minutes than GitHub Actions.
  • Document your monorepo structure in a root README. Indian dev teams often have high attrition — new joiners should understand the layout within 30 minutes.
  • Enforce commit message conventions (Conventional Commits) and automate changelogs per package.

Frequently Asked Questions

Is a monorepo the same as a monolith?

No. A monolith is a single tightly-coupled application. A monorepo is a code organisation strategy — it can contain microservices, independent apps, and libraries that are loosely coupled but co-located for convenience. Each project in a monorepo can be deployed independently.

Can small Indian startups benefit from monorepos?

Yes, if you’re building multiple related products or a SaaS with separate front-end and back-end apps. A 3-5 person team using pnpm workspaces + Turborepo can share UI components, types, and utilities without the overhead of publishing internal npm packages. The setup cost is under a day.

How does a monorepo handle different programming languages?

Nx supports polyglot monorepos with plugins for Go, Java, .NET, and Python alongside JavaScript/TypeScript. Bazel (used by Google) is the enterprise choice for truly polyglot monorepos but has a steep learning curve. Most Indian product teams are JS/TS-focused, making Nx or Turborepo ideal.

What’s the cost of monorepo tooling for a bootstrapped startup?

All major monorepo tools (Nx, Turborepo, Lerna, pnpm workspaces) are open source and free. Remote caching (the main paid feature) is free on Nx Cloud for small teams and on Vercel’s hobby plan for Turborepo. Total cost for a bootstrapped Indian startup: ₹0 to ₹4,000/month depending on CI needs.

Does GitHub support monorepos well?

GitHub handles monorepos of reasonable size (under 5GB) well. GitHub Actions supports path-based triggering to run workflows only when specific directories change. For very large monorepos (50GB+), companies like Google use custom VCS — but you’re unlikely to reach that scale. GitHub’s CODEOWNERS file is essential for managing team ownership within a monorepo.

Related Articles

Ready to Start Your Project?

Free consultation and custom proposal within 24 hours. No obligation.

Leave a Reply

Your email address will not be published. Required fields are marked *