# Monorepos

This guide covers Flow setup inside a monorepo. In this guide, you will learn:

- Why Flow configures the harness inside your app
- The Flow commands for npm, pnpm, Yarn and Bun
- What to do when the monorepo has more than one AdonisJS app

The examples use an app in `apps/backend`. Flow does not decide where your app lives, so use your app's folder in its place.

## Why Flow lives in the app

Flow configures the harness inside each AdonisJS app of a monorepo, not at the workspace root, because its guidance is specific to one AdonisJS project and the stack you chose for it.

When you start your coding agent at the workspace root, it does not load any of the Flow skills or docs. That is fine, because your agent needs them only when it works inside the AdonisJS codebase.

This setup relies on one thing: a pointer to your AdonisJS app in the `CLAUDE.md` or `AGENTS.md` at the workspace root.

```md [CLAUDE.md]
<!-- FLOW-APPS-START -->
Use the right CLAUDE.md for the area you're working in:

- **AdonisJS backend app** (`apps/backend/**`) → `apps/backend/CLAUDE.md`
<!-- FLOW-APPS-END -->
```

Flow writes the pointer when you run `flow install` with the `--workspace` flag. It leaves the rest of the file as you wrote it. Commit the file.

## Commands

Run the commands on this page from the workspace root. Your package manager runs each one inside your app. Bun cannot do this for a package's commands, so with Bun you move into your app's folder first.

### Installing the package

Install `@adonisplus/flow` as a dev dependency of your app. Your monorepo must point at the Plus registry first, as [Installation and setup](/docs/get-started/installation) shows.

::code-group{sync="pm"}
```sh [npm]
npm i -D @adonisplus/flow -w apps/backend
```

```sh [pnpm]
pnpm --filter ./apps/backend add -D @adonisplus/flow
```

```sh [yarn]
yarn workspace backend add -D @adonisplus/flow
```

```sh [bun]
cd apps/backend
bun add -d @adonisplus/flow
```
::

With Yarn, `backend` is the `name` in your app's `package.json`, not its folder.

### flow install

Configures the harness inside your app. It asks the same questions as in a project with one app.

::code-group{sync="pm"}
```sh [npm]
npm exec -w apps/backend -- flow install --workspace
```

```sh [pnpm]
pnpm --filter ./apps/backend exec flow install --workspace
```

```sh [yarn]
yarn workspace backend flow install --workspace
```

```sh [bun]
cd apps/backend
bunx flow install --workspace
```
::

The `--workspace` flag also writes the pointer at the workspace root. You need it only the first time, because you commit the pointer. After an upgrade or a new clone, run `flow install` without it.

Flow finds the workspace root from a `pnpm-workspace.yaml`, or from the `workspaces` field of a `package.json`. If your monorepo has neither, pass the root as a path from your app's folder, for example `--workspace=../..`.

### flow review

Reviews your branch against the default branch. The code review is a skill you start yourself, and it does not load at the workspace root. This command starts your coding agent inside your app, with the skill.

::code-group{sync="pm"}
```sh [npm]
npm exec -w apps/backend -- flow review
```

```sh [pnpm]
pnpm --filter ./apps/backend exec flow review
```

```sh [yarn]
yarn workspace backend flow review
```

```sh [bun]
cd apps/backend
bunx flow review
```
::

### flow apply

Applies a [feature pack](/docs/feature-packs/introduction) to your app. It starts your coding agent inside your app, the same way as `flow review`.

::code-group{sync="pm"}
```sh [npm]
npm exec -w apps/backend -- flow apply --pack=two-factor
```

```sh [pnpm]
pnpm --filter ./apps/backend exec flow apply --pack=two-factor
```

```sh [yarn]
yarn workspace backend flow apply --pack=two-factor
```

```sh [bun]
cd apps/backend
bunx flow apply --pack=two-factor
```
::

### flow uninstall

Removes Flow from your app. With the `--workspace` flag, it also removes the pointer from the workspace root.

::code-group{sync="pm"}
```sh [npm]
npm exec -w apps/backend -- flow uninstall --workspace
```

```sh [pnpm]
pnpm --filter ./apps/backend exec flow uninstall --workspace
```

```sh [yarn]
yarn workspace backend flow uninstall --workspace
```

```sh [bun]
cd apps/backend
bunx flow uninstall --workspace
```
::

## Multiple apps

A monorepo can hold more than one AdonisJS app, for example an API and an admin panel. Install the package and run `flow install --workspace` once for each app.

Each app gets its own harness: the docs for its packages, the skills for its stack, and its own `flow.lock`. The apps share nothing, so they can use different stacks and different versions of a package.

At the workspace root, each install adds its own pointer and keeps the pointers of the other apps.

```md [CLAUDE.md]
<!-- FLOW-APPS-START -->
Use the right CLAUDE.md for the area you're working in:

- **AdonisJS admin app** (`apps/admin/**`) → `apps/admin/CLAUDE.md`
- **AdonisJS backend app** (`apps/backend/**`) → `apps/backend/CLAUDE.md`
<!-- FLOW-APPS-END -->
```

Every command works on one app, the one you name in the command. `flow uninstall --workspace` in one app removes only that app's pointer.

## Next steps

::card-group
:::card{title="Installation and setup" to="/docs/get-started/installation"}
Sign in to the registry, and what the installer writes.
:::

:::card{title="Pull request reviews" to="/docs/flow/reviews/setup"}
Turn on the Flow review on your GitHub repositories.
:::
::
