StoicBuilder

HandbookIX the CuriaMonorepos

IXthe Curia, Work as a team

Monorepos

1 min readUpdated 28 November

In plain words

A monorepo holds several projects in one repository, such as a web app, a background worker and a shared package, so one change can update all of them together.

Where you see it

Harbor's repository has apps/web, apps/worker for sending invoices, and packages/billing used by both. npm, pnpm or Yarn workspaces link them locally, and tools like Turborepo or Nx run only the builds and tests a change affects.

Repository layoutconfig
harbor/ apps/web/ the Next.js app customers use apps/worker/ sends invoices and retries failed charges packages/billing/ prices, proration and tax, used by both apps package.json "workspaces": ["apps/*", "packages/*"]
Change a pricing rule once in packages/billing, and both apps get it in the same commit.

What goes wrong

  1. Running every test on every change

    A one-line fix in the web app triggers the worker's slow test suite too, and CI takes 40 minutes. Use your tool's affected or filter option so each change runs only what it can touch.

  2. Agents wandering across the whole repository

    An agent asked to fix the worker reads all three projects and edits code in the wrong one. Point it at the folder by path, and give each app a short rules file saying how to build and test it.

  3. Apps reaching into each other's internals

    apps/web imports a file deep inside apps/worker, and now neither can change without breaking the other. Share code only through packages, imported by package name.

    import { retry } from "../../worker/src/lib/retry";

What to tell your agent

Copy this into Lovable, Bolt, Cursor or any agent
This is a monorepo. Work only inside apps/web unless the change needs packages/billing, and if it does, tell me which other apps use that package. Import shared code by package name, never by a relative path into another app, and run only the affected builds and tests.

Quick check

Sign in to earn +10 XP for it

Harbor's web app and worker both need the proration rules. In a monorepo, where should that code live?

Got a prompt that touches monorepos?

Paste it. You get a better prompt first, then the cards that explain it.

Check your own prompt

Free, no sign-up.