---
title: Build from a Monorepo
description: Build native iOS and Android apps from a monorepo or subdirectory with Capawesome Cloud using the baseDir option in capawesome.config.json.
---

# Build from a Monorepo

Capawesome Cloud builds standard projects out of the box, but plenty of teams keep their app in a subdirectory or alongside other packages in a monorepo. For those setups, you tell Capawesome Cloud where each app lives with a [`capawesome.config.json`](configuration.md) file.

The key option is `baseDir` — the directory Capawesome Cloud treats as the app's root. Every command runs from there, including `dependencyInstallCommand` and `webBuildCommand`. If you leave it unset, the Cloud builds from the root of the repository.

!!! note "The config file always sits at the repository root"

    `capawesome.config.json` belongs in the **root** of your Git repository, even when your apps live in subdirectories. `baseDir` paths are resolved relative to that root.

## App in a subdirectory

If your app isn't at the repository root, point `baseDir` at it. You can list several apps from the same repository — each entry maps one directory to one Capawesome Cloud App ID:

```
├─ apps/
│  ├─ my-app1/
│  └─ my-app2/
└─ capawesome.config.json
```

```json title="capawesome.config.json"
{
    "cloud": {
        "apps": [
            {
                "appId": "your-app-id-1",
                "baseDir": "apps/my-app1"
            },
            {
                "appId": "your-app-id-2",
                "baseDir": "apps/my-app2"
            }
        ]
    }
}
```

With just `baseDir` set, the Cloud installs dependencies and builds web assets from inside that directory — which is exactly what you want when each app manages its own `package.json` and lockfile.

## Monorepo with shared dependencies

In a workspace monorepo (npm/pnpm/Yarn workspaces), dependencies are usually installed once at the workspace root rather than per app. Because every command runs from `baseDir`, you need to step back up to the root to install and build.

Keep in mind that `dependencyInstallCommand` and `webBuildCommand` run from `baseDir`, so a relative `cd` is the simplest way to reach the workspace root — adjust the number of `../` segments to match how deep your app is nested:

```json title="capawesome.config.json"
{
    "cloud": {
        "apps": [
            {
                "appId": "your-app-id-1",
                "baseDir": "packages/app1",
                "dependencyInstallCommand": "cd ../.. && npm install",
                "webBuildCommand": "cd ../.. && npm run build --workspace=app1"
            },
            {
                "appId": "your-app-id-2",
                "baseDir": "packages/app2",
                "dependencyInstallCommand": "cd ../.. && npm install",
                "webBuildCommand": "cd ../.. && npm run build --workspace=app2"
            }
        ]
    }
}
```

Here `packages/app1` is two levels below the root, so `cd ../..` lands at the workspace root, where the install and the workspace-scoped build run. The native part of the build still happens in `baseDir`, where your Capacitor/Cordova project and its `android`/`ios` folders live.

## Next steps

- [App Configuration](configuration.md) — the full `capawesome.config.json` schema.
- [Use pnpm, Yarn, or bun](package-managers.md) — for workspaces managed by pnpm or Yarn.
- [Configure the web build script](web-build-script.md) — control which script builds your web assets.
