When engineering organizations scale beyond a single monolithic codebase into dozens of distributed microservices and multi-language client SDKs (such as Python, TypeScript, Go, and Java), maintaining technical documentation becomes an acute operational bottleneck. Forcing engineers to submit secondary pull requests into a separate central documentation repository causes documentation rot, API drifts, and delayed release cycles. Conversely, letting each repository host and deploy its own isolated documentation leads to fragmented developer portals, broken navigation, and disjointed brand experiences.
The official mintlify/multirepo-action bridges this divide. It implements an automated GitOps aggregation pipeline where development teams write docs and generate OpenAPI contracts alongside their source code, while a central documentation portal automatically ingests, rewrites, and publishes them into a unified Mintlify site.
At 365Finds, our research indicates that attempting to manage multi-service documentation via Git submodules or custom shell scripts introduces brittle CI failures and merge conflicts. Using mintlify/multirepo-action provides a production-grade, declarative sync pipeline. Here is how engineering teams configure and operate this architecture safely at scale.
1. Architectural Topology: Central Hub vs. Distributed Sources
The multi-repository documentation architecture separates content ownership from presentation governance:
Distributed Child Repositories Central Documentation Hub
┌───────────────────────────┐ ┌───────────────────────────────────────────────┐
│ acme/service-auth │ │ acme/docs-hub │
│ ├── src/ │ │ ├── .github/mintlify-multirepo.yml │
│ ├── docs/ (MDX guides) │───[Sparse Clone]─┼─▶├── api/auth/ (MDX + openapi.json) │
│ └── openapi.json │ │ ├── api/billing/ (MDX + openapi.json) │
├───────────────────────────┤ │ ├── sdks/typescript/ (Quickstarts) │
│ acme/service-billing │ │ ├── docs.base.json (Navigation Blueprint) │
│ ├── docs/ │───[Sparse Clone]─┼─▶├── docs.json (Generated Live Config) │
│ └── openapi.json │ │ └── .mintlify-multirepo.json (Commit State) │
├───────────────────────────┤ │ │ │
│ acme/sdk-typescript │ │ │ [Mintlify Deploy] │
│ └── docs/ │───[Sparse Clone]─┘ ▼ ▼
└───────────────────────────┘ Unified Developer Portal (docs.acme.com)
Core Concepts
- Parent Documentation Repository (
acme/docs-hub): Houses global branding, global styles, root landing pages, global search settings,docs.base.json, and the GitHub Actions aggregation pipeline. It deploys directly to Mintlify. - Child Repositories (
acme/service-*,acme/sdk-*): Retain their local MDX guides, code snippets, and OpenAPI specifications inside a dedicated directory (typicallydocs/). Each child maintains its own lightweightdocs.jsonso engineers can preview their documentation locally usingmint devbefore committing. - The Aggregator (
mintlify/multirepo-action): Executes parallel shallow, sparse checkouts across child repositories, extracts only the documentation paths, rewrites internal links and snippet imports to prevent routing collisions, and compilesdocs.base.jsoninto a deployabledocs.json.
2. Step-by-Step Implementation Guide
Step 1: Define the Navigation Blueprint (docs.base.json)
In the root of your central documentation repository, rename your existing docs.json to docs.base.json. This file acts as the compile-time template for your navigation hierarchy.
Insert sourceRef directives wherever a child repository's navigation tree should be mounted:
{
"$schema": "https://mintlify.com/docs.json",
"name": "Acme Platform Docs",
"theme": "mint",
"colors": {
"primary": "#059669",
"light": "#34D399",
"dark": "#065F46"
},
"navigation": {
"tabs": [
{
"tab": "Guides",
"pages": [
"index",
"quickstart",
"architecture/overview"
]
},
{
"tab": "Authentication API",
"pages": [
{
"sourceRef": "acme/service-auth"
}
]
},
{
"tab": "Billing API",
"pages": [
{
"sourceRef": "acme/service-billing"
}
]
},
{
"tab": "Client SDKs",
"groups": [
{
"group": "TypeScript SDK",
"pages": [
{
"sourceRef": "acme/sdk-typescript"
}
]
}
]
}
]
}
}
How sourceRef Resolves
- When placed inside a
tabsarray,sourceRefreplaces itself with the child repository'snavigation.tabs. - When placed inside a
pagesorgroupsarray,sourceRefis replaced with the child'spages(orgroupsifpagesis absent). - If a child repository is listed in the sync configuration but omitted from
docs.base.json, the action appends it to the top-level navigation automatically using the source's configuredname.
Step 2: Configure Synchronization Sources (.github/mintlify-multirepo.yml)
Create .github/mintlify-multirepo.yml in the parent repository. This file declares the mapping between remote Git repositories and local destination directories:
base: docs.base.json
output: docs.json
sources:
- repo: acme/service-auth
path: docs
destination: api/auth
name: Authentication API
exclude:
- README.md
- "internal/**"
- repo: acme/service-billing
path: docs
destination: api/billing
name: Billing API
ref: main
- repo: acme/sdk-typescript
path: docs
destination: sdks/typescript
name: TypeScript SDK
exclude:
- "drafts/**"
- "*.tmp.md"
Key Source Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
repo | String | Required | GitHub repository slug (owner/repo) |
path | String | . | Directory in the child repository containing docs and OpenAPI specs |
destination | String | Required | Target directory in the parent repository and URL prefix path |
ref | String | Default branch | Git branch, tag, or specific commit SHA to clone |
name | String | Child repo name | Navigation label used when appending unmapped sources |
exclude | List | [] | Glob patterns of files to ignore during sync |
rewriteLinks | Boolean | true | Automatically rewrites root-relative URLs, assets, and snippet paths |
Step 3: Configure Authentication via GitHub App
When child repositories are private, authenticating CI actions across organization repositories is a common failure point.
[!IMPORTANT] 365Finds Recommendation: Avoid using Personal Access Tokens (PATs) for multirepo CI pipelines. PATs are bound to individual developer accounts, creating a single point of failure when employees depart, and they cannot be scoped cleanly. We strongly advise creating a dedicated internal GitHub App and generating ephemeral installation tokens on the fly.
- Create an internal GitHub App in your GitHub Organization (
Settings→Developer Settings→GitHub Apps). - Grant the app
Repository permissions→Contents: Readacross all target child repositories. - Grant
Contents: WriteandPull requests: Writeon the central documentation repository. - Install the app into your organization and save its App ID as an Actions variable (
DOCS_APP_ID) and its Private Key as a secret (DOCS_APP_PRIVATE_KEY) in the parent documentation repository.
Step 4: Build the Parent Aggregation Pipeline (.github/workflows/aggregate-docs.yml)
In your parent repository, set up the aggregation workflow:
name: Aggregate Multirepo Docs
on:
workflow_dispatch:
schedule:
- cron: "0 * * * *" # Hourly fallback sync
repository_dispatch:
types: [docs-updated] # Event-driven real-time trigger
concurrency:
group: mintlify-multirepo
cancel-in-progress: true
permissions:
contents: write
pull-requests: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Generate GitHub App Token
id: app-token
uses: actions/create-github-app-token@v3
with:
app-id: ${{ vars.DOCS_APP_ID }}
private-key: ${{ secrets.DOCS_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Checkout Parent Repository
uses: actions/checkout@v4
- name: Synchronize Documentation Sources
uses: mintlify/multirepo-action@v1
with:
token: ${{ steps.app-token.outputs.token }}
mode: pull-request # Use 'push' for direct commits or 'pull-request' for staging review
branch: mintlify-multirepo/sync
base-branch: main
commit-message: "chore(docs): synchronize distributed API docs and schemas"
concurrency: 8
Why Concurrency Protection Matters
Notice the concurrency block:
concurrency:
group: mintlify-multirepo
cancel-in-progress: true
In high-velocity engineering organizations, multiple microservices and SDKs may merge pull requests within minutes of each other. Setting a concurrency group with cancel-in-progress: true guarantees that burst events collapse into a single fresh synchronization job, preventing Git push collisions and race conditions.
Step 5: Enable Event-Driven Triggers in Child Repositories
Rather than waiting for the hourly cron job, child repositories can ping the parent repository immediately whenever documentation files change.
Add .github/workflows/notify-docs-hub.yml to each child repository:
name: Notify Central Docs Hub
on:
push:
branches:
- main
paths:
- "docs/**"
- "openapi.json"
- "openapi.yaml"
jobs:
dispatch:
runs-on: ubuntu-latest
steps:
- name: Dispatch Event to Parent Repository
env:
GH_TOKEN: ${{ secrets.DOCS_DISPATCH_TOKEN }}
run: |
gh api repos/${{ github.repository_owner }}/docs-hub/dispatches \
-f event_type=docs-updated
(Note: DOCS_DISPATCH_TOKEN requires contents: write permissions on the parent repository, which can also be generated from the organization GitHub App).
3. Handling OpenAPI Specifications and MDX Snippets
In modern API platforms, documentation consists of both narrative guides (.mdx) and technical schema references (openapi.json / openapi.yaml). mintlify/multirepo-action handles both seamlessly.
OpenAPI Contract Ingestion
When a child microservice (for example, acme/service-billing) exports its OpenAPI specification into docs/openapi.json:
- The action clones
docs/openapi.jsonintoapi/billing/openapi.json. - The child's local
docs.jsonspecifies:{ "navigation": { "tabs": [ { "tab": "Billing Reference", "openapi": "openapi.json" } ] } } - During aggregation, the action prefixes the schema path in the compiled
docs.json, transforming it into"openapi": "api/billing/openapi.json". Mintlify then dynamically renders the interactive API playground, code sample generators, and parameter tables atdocs.acme.com/api/billing.
Asset and Snippet Path Rewriting
When authors write documentation inside a child repository, relative links and snippet imports assume local root paths. The action automatically resolves these boundaries:
- Root-relative links: A markdown link
[Quickstart](/guides/quickstart)inacme/service-authis rewritten to[Quickstart](/api/auth/guides/quickstart). - Reusable Snippets: If a child repository contains a
snippets/directory (e.g.,snippets/curl-auth.mdx), it is moved tosnippets/api/auth/curl-auth.mdxin the parent repository, and corresponding imports in.mdxfiles are automatically repathed.
4. Comparing Change Delivery Modes: pull-request vs. push
The action provides three operational modes via the mode input parameter:
| Mode | Deployment Flow | Conflict Handling | Recommended Use Case |
|---|---|---|---|
pull-request | Commits changes to mintlify-multirepo/sync and opens or updates a single PR | Non-destructive; updates PR branch idempotently | Regulated enterprises; teams requiring technical writing review, Vale linting, or manual staging checks |
push | Commits and pushes directly to base-branch (main) | Automatically rebases and retries push if remote moved during sync | High-velocity microservice platforms with automated OpenAPI contract validation in child repos |
none | Modifies the working tree without committing | Leaves state for subsequent workflow steps | Advanced CI chains that bundle additional build scripts or custom validations before committing |
[!TIP] 365Finds Recommendation: Start with
mode: pull-requestduring initial rollout to observe link rewriting behavior and schema merging. Once stability is proven and automated validation is embedded in child CI pipelines, switch tomode: pushfor true continuous deployment.
5. Critical Operational Rules & Failure Safeguards
To maintain zero downtime and prevent build breaks in production:
- Never Manually Edit Synced Folders in the Parent Repository:
Any files inside destination folders (
api/auth/,sdks/typescript/, etc.) and the rootdocs.jsonare overwritten on every sync run. The action maintains an internal state manifest named.mintlify-multirepo.json. If a child repository is removed from.github/mintlify-multirepo.yml, its corresponding destination folder is cleanly purged on the subsequent run. - Preventing Broken Pull Request Triggers:
If you use the default
GITHUB_TOKENto run the action inpull-requestmode, GitHub Actions security safeguards will prevent downstream CI workflows (such as Mintlify preview builds or link-checkers) from triggering on the generated PR. Passing a GitHub App token togithub-tokenbypasses this limitation cleanly. - Pre-commit OpenAPI Validation in Child CI:
Run
mint openapi-checkorspectral lintinside each microservice's CI pipeline before merging changes tomain. If an invalid OpenAPI spec reaches the parent documentation repository, Mintlify may fail to build the entire portal. Ensure child CI acts as the gatekeeper.
Summary of 365Finds Institutional Judgments
- Docs-as-Code Belongs with Source Code: Forcing microservice engineers to context-switch into a centralized documentation monorepo degrades documentation quality. Distributed child repositories with central automated ingestion are mandatory for engineering organizations managing more than five independent services.
- Standardize on GitHub App Credentials: Reject personal access tokens for cross-repository workflows. GitHub App installation tokens provide superior audit trails, automatic secret rotation, and unblock downstream CI execution on synchronization pull requests.
- Decouple Site Architecture from Commercial Tiers: While Mintlify offers native multi-repo capabilities on its Enterprise plan, running
mintlify/multirepo-actionvia GitHub Actions provides identical unified portal benefits while preserving full GitOps version control, transparent file trees, and local offline preview capabilities (mint dev) across all tiers.