Mesrai
All use cases
Use case · Monorepos

Precise review for every package in your monorepo.

A monorepo holds a frontend, a backend, shared libraries and infrastructure — each with different standards. Mesrai applies the right rules to each folder and follows changes across package boundaries.

Config levels
Org → repo → folder
Cross-package
Graph-aware
Works with
Nx, Turborepo, Bazel

How monorepo teams use AI code review

Monorepo teams use AI code review with directory-level configuration: each app or package gets its own rules, review options and noise settings, inherited from organization and repository defaults. Mesrai's repository graph follows imports across packages, so a change to a shared library is reviewed for its effect on every app that uses it.

I.

Why monorepos are hard to review

  • 01

    One set of review settings is too strict for one package and too loose for another.

  • 02

    A small change in a shared library can break apps owned by other teams.

  • 03

    Reviewers know their own package, not the dependents of the code they're approving.

  • 04

    Pull requests that touch several packages mix concerns and standards.

II.

How Mesrai handles monorepos

Directory-level settings

Configure any folder with its own rules, review options, severity filters and ignored paths. Each pull request uses one predictable configuration.

Rule inheritance

Organization rules apply everywhere; repository rules for the monorepo; folder rules for each package.

Cross-package impact

The repository graph shows which apps import the changed shared code.

File references in rules

Point rules at the source of truth, e.g. @file:libs/ui/src/tokens.ts for design tokens.

III.

Real-world scenarios

2 examples

Illustrative examples of the kind of change monorepo teams make every week, and the review comment Mesrai would post.

Scenario 01

A breaking change in a shared library

A developer renames a field in libs/shared/types to fix a typo, updating the API app but not the others.

libs/shared/src/types/order.ts
export interface Order {
  id: string;
  totalAmount: number; // was: totalAmmount
}
MesraiBug agentMUST_FIX

apps/web/src/orders/OrderRow.tsx and apps/mobile/src/screens/Checkout.tsx still read order.totalAmmount, so they'll show undefined after this change. Update them in this PR or keep a deprecated alias.

Result: The breakage in two other apps is caught before merge, not by those teams' users.

Scenario 02

Design tokens in the web app

A new React component in apps/web hardcodes colours.

MesraiMesrai RulesSUGGESTION

Rule for apps/web: components must use design tokens from libs/ui/src/tokens.ts. Replace #1f2937 with tokens.color.gray[800].

Result: The frontend's rule applies only to frontend code; the backend isn't flooded with irrelevant comments.

IV.

Set up a monorepo

Map packages to review needs, then configure folders. The 'Mesrai for monorepos' recipe has the full walkthrough.

  1. 1

    List your packages and their standards (web, api, mobile, shared libs, infra).

  2. 2

    Put shared rules at organization or repository level.

  3. 3

    Configure each package folder with its own rules and review options.

  4. 4

    Use @file references so rules point at the code that defines the standard.

Folder rule for a frontend package
Name: React components must use design system tokens
Scope: File
Paths: apps/web/src/components/**/*.tsx
Severity: High
Instructions:
  Flag hardcoded colours, spacing or font sizes.
  Use tokens from @file:libs/ui/src/tokens.ts.
V.

Who uses it, and how

Package owners
Own the rules for their folder without affecting other teams.
Platform team
Sets monorepo-wide defaults and watches shared-library changes.
VI.

What teams achieve

Relevant rules for each package

Shared-library changes reviewed for their dependents

Less noise from rules that don't apply

Standards tied to the code that defines them

VII.

Monorepos — frequently asked

3 questions
  • Can different folders have different review rules?

    +

    Yes. Configure any folder with its own rules, review options and noise settings. If a pull request touches two configured folders, Mesrai uses the repository configuration to stay predictable.

  • Does Mesrai work with Nx, Turborepo or Bazel?

    +

    Yes. Configuration is based on folders, so it works with any monorepo tool.

  • How does Mesrai catch breaking changes in shared code?

    +

    It builds a repository graph from the syntax tree and checks where changed exports are imported across the monorepo.

Try it on your next pull request.

14-day free trial · every feature unlocked · no credit card required.

Start free