Type safe code, unit tests and CI
Guides
Avo in Monorepo

Avo in monorepos

Avo supports monorepos out of the box. A single avo.json file in the root directory keeps track of all configured Avo sources for the repo, where the code for each source is located and when it was last updated.

To use Avo in a monorepo, initialize the Avo CLI by running avo init in the root of your repository. This will create a single avo.json file in the root of your monorepo. When you run avo pull [--branch my-branch] [SourceName] you pass in for which source you want to pull code for (e.g. avo pull Web). When you run avo pull for a new source for the first time, the CLI will prompt you to pick a location for the generated code (Avo Codegen file) for that source. The avo.json file in the root keeps track of which sources are configured in the repo, where Avo Codegen file for each one lives, when the tracking for that source was last updated, and what Avo branch that update was based on.

Here's an example of how an avo.json could look like in a monorepo containing a web app, microservice, iOS app, Android app and docs page:

{
  "avo": {
    "version": 1
  },
  "schema": {
    "id": "<WORKSPACE_ID>",
    "name": "My Tracking Plan"
  },
  "branch": {
    "id": "main",
    "name": "main"
  },
  "sources": [
    {
      "id": "SOURCE_ID",
      "name": "Docs",
      "path": "projects/docs/Avo.ts",
      "actionId": "<LAST_UPDATED_ID>",
      "branchId": "<LAST_UPDATED_BRANCH_ID>",
      "updatedAt": "<LAST_UPDATED_TIMESTAMP>"
    },
    {
      "id": "SOURCE_ID",
      "name": "Web App",
      "path": "projects/web/Avo.ts",
      "actionId": "<LAST_UPDATED_ID>",
      "branchId": "<LAST_UPDATED_BRANCH_ID>",
      "updatedAt": "<LAST_UPDATED_TIMESTAMP>"
    },
    {
      "id": "SOURCE_ID",
      "name": "Transactions Microservice",
      "path": "projects/transactions/Avo.ts",
      "actionId": "<LAST_UPDATED_ID>",
      "branchId": "<LAST_UPDATED_BRANCH_ID>",
      "updatedAt": "<LAST_UPDATED_TIMESTAMP>"
    },
    {
      "id": "SOURCE_ID",
      "name": "iOS",
      "path": "projects/iOS/Avo.swift",
      "actionId": "<LAST_UPDATED_ID>",
      "branchId": "<LAST_UPDATED_BRANCH_ID>",
      "updatedAt": "<LAST_UPDATED_TIMESTAMP>"
    },
    {
      "id": "SOURCE_ID",
      "name": "Android",
      "path": "projects/Android/Avo.kt",
      "actionId": "<LAST_UPDATED_ID>",
      "branchId": "<LAST_UPDATED_BRANCH_ID>",
      "updatedAt": "<LAST_UPDATED_TIMESTAMP>"
    }
  ]
}