Architecture
Hub and Spoke model
Section titled “Hub and Spoke model”Each product keeps its documentation in its own repository (a Spoke). The Hub repository owns the Astro Starlight portal, Spoke registry, build pipeline, and staging deployment.
Spoke documentation is never committed into the Hub. The Hub fetches configured docs/ trees at exact SHAs during CI, validates them, then builds.
Registry
Section titled “Registry”Enabled Spokes live in config/spokes.json. Each entry defines:
id— unique route under/products/<id>/repository— GitHubowner/repobranch— trusted branch used for rebuilds (MVP:main)docsPath— directory to extract (MVP:docs)enabled— whether the Hub includes it in every build
Build flow
Section titled “Build flow”- Trigger via
repository_dispatchfrom a Spoke or manualworkflow_dispatch. - Validate the triggering repository against the registry.
- Resolve exact SHAs for all enabled Spokes.
- Clean previously generated product content.
- Fetch and extract only each Spoke’s configured docs directory.
- Validate content, assets, links, routes, and security rules.
- Write
build-manifest.jsonwith every Spoke SHA. - Run
bun run buildwith broken-link validation. - Deploy the complete portal to staging (Cloudflare Pages).
Security boundaries
Section titled “Security boundaries”- Spokes hold
DOCS_HUB_DISPATCH_TOKEN(Contents: Write on the Hub only) to sendrepository_dispatch. - The Hub holds
DOCS_SPOKES_READ_TOKEN(Contents: Read on private Spokes; no write). - Hub workflows never write to Spoke repositories.
- Workflows use minimum
contents: read/pull-requests: readunless deploying Pages. - Fork PRs never receive dispatch or Spoke-read secrets.
- Spoke PR checks and dispatch workflows live in the Spoke (a few product repos; no Hub-hosted contract package). Hub
fetch-spokes.mjsvalidates fetched docs before staging deploy and is the publish gate.