This repository contains the Next.js site that serves docs.margo.org. It assembles content from multiple repositories into a single documentation website.
margo-docsThe website application. This is where the Next.js app, Fumadocs configuration, MDX components, Netlify config, and the content sync pipeline live.general_website_contentGeneral documentation pages that are copied fromsystem-design/into the website.specificationSpecification pages, OpenAPI files, MkDocs assets, and LinkML-generated Markdown that are copied fromsystem-design/specification/into the website.
- package.json Top-level scripts for sync, development, and production build.
- scripts/sync-general-content.sh The content assembly pipeline. This is the key script that pulls content from the other repos and prepares it for the site.
- app/layout.tsx Global layout, metadata, and sidebar tree composition.
- app/[...slug]/page.tsx Catch-all documentation page renderer.
- lib/source.ts Fumadocs content loader used to resolve pages and routes.
- source.config.ts MDX collection and remark plugin configuration.
- mdx-components.tsx Custom MDX components available in documentation pages.
- components/mdx/swagger-ui.tsx Swagger UI wrapper used by generated OpenAPI pages.
- next.config.mjs Next.js configuration, including redirects for legacy documentation routes.
- netlify.toml Netlify build configuration for the production site.
The website build is a two-stage process:
- Sync and prepare content.
- Run the Next.js production build.
npm run sync:docs runs scripts/sync-general-content.sh.
That script does the following:
- Pulls content from
general_website_content. It copiessystem-design/intomargo-docs/content/docs/. - Pulls content from
specification. It copiessystem-design/specification/intomargo-docs/content/docs/specification/. - Optionally regenerates LinkML documentation from the
specificationrepo. Ifpoetryis installed, it runs the spec repo’s generation flow. Ifpoetryis not available butlinkmlandmkdocsare available, it runs those directly. If those tools are missing, the site still builds, but LinkML-generated pages are not refreshed. - Creates
meta.jsonfor the specification section. - Copies shared figure assets into
public/figures/. - Generates Swagger UI MDX pages next to matching OpenAPI YAML files.
- Copies OpenAPI YAML files into
public/so Swagger UI can fetch them at runtime. - Rewrites known legacy Swagger links to the current generated route.
- Normalizes Markdown titles into frontmatter for Fumadocs.
The generated site content in content/docs/ is intentionally ignored by Git. It is treated as build output, not source of truth.
npm run build runs:
prebuildThis runsnpm run sync:docs.buildThis runsnext build.
The site is rendered by the catch-all route in app/[...slug]/page.tsx, which loads pages through the Fumadocs source defined in lib/source.ts.
There are currently no checked-in GitHub Actions in this repository. Production deployment is configured through Netlify using netlify.toml.
Netlify runs:
npm run buildThat means every Netlify deployment executes the sync script first, then builds the Next.js site.
- general_website_content/.github/workflows/netlify-build.yml
Triggers a Netlify build hook on pushes to
pre-draft. - general_website_content/.github/workflows/pr-checks.yml Runs sign-off checks on pull requests.
Important detail: the netlify-build.yml workflow lives in general_website_content, but it triggers a build of the website hosted from margo-docs. During that Netlify build, margo-docs pulls the latest pre-draft content from both general_website_content and specification.
- specification/.github/workflows/pages.yml Builds and deploys the standalone MkDocs site for the specification repo and runs validation/document-generation jobs.
- specification/.github/workflows/pr-checks.yml Runs sign-off checks on pull requests.
Important detail: the specification repo’s pages.yml workflow does not deploy docs.margo.org. It builds the standalone MkDocs version of the specification. The website at docs.margo.org only picks up spec changes when a margo-docs Netlify build runs.
There are two supported local workflows:
- Preview against the remote
pre-draftbranches. - Preview against local sibling checkouts of all three repos before opening PRs.
- Node.js and npm
gitrsyncjq
Optional, but recommended for a full specification refresh:
- Python 3
poetry
Alternative to poetry:
linkmlmkdocs
The Python dependencies used by the sync pipeline are listed in requirements.txt.
From margo-docs:
npm installThis is the simplest flow and matches what Netlify does by default.
cd /Users/osama/Desktop/Others/margo/margo-docs
npm run devThis will:
- Clone
general_website_contentpre-draftinto.cache/. - Clone
specificationpre-draftinto.cache/. - Assemble
content/docs/. - Start the Next.js dev server.
Open http://localhost:3000.
Use this when you are editing general_website_content and/or specification locally and want margo-docs to render those unmerged changes.
The sync script supports two environment variables:
GENERAL_WEBSITE_CONTENT_DIRSPECIFICATION_DIR
If they are set, the website uses those local directories instead of cloning from GitHub.
If your local layout matches this workspace:
/Users/osama/Desktop/Others/margo/margo-docs/Users/osama/Desktop/Others/margo/general_website_content/Users/osama/Desktop/Others/margo/specification
run either:
cd /Users/osama/Desktop/Others/margo/margo-docs
npm run dev:local-contentor explicitly:
cd /Users/osama/Desktop/Others/margo/margo-docs
export GENERAL_WEBSITE_CONTENT_DIR=/Users/osama/Desktop/Others/margo/general_website_content
export SPECIFICATION_DIR=/Users/osama/Desktop/Others/margo/specification
npm run devFor a production-style local build with local source repos:
cd /Users/osama/Desktop/Others/margo/margo-docs
npm run build:local-contentThe sync script will still copy Markdown and OpenAPI files, but it will print:
Skipping LinkML documentation generation (missing dependencies)
That is acceptable for many editorial changes, but not ideal if your change depends on regenerated spec artifacts. For full fidelity, install the Python tooling first.
For content contributors and SUP owners, the safest check is:
cd /Users/osama/Desktop/Others/margo/margo-docs
npm run build:local-contentThis validates the combined site using your local general_website_content and specification checkouts.
If a SUP owner needs to validate documentation changes before opening PRs:
- Update content in
general_website_contentand/orspecification. - In
margo-docs, runnpm run dev:local-contentto preview the complete site. - Check the relevant rendered routes in the browser.
- Run
npm run build:local-contentbefore submitting PRs. - Open PRs in the source repo or repos that contain the actual content changes.
- Do not edit
margo-docs/content/docs/directly for permanent content changes. That directory is regenerated by the sync script. - Edit
general_website_contentfor general docs pages. - Edit
specificationfor spec pages, OpenAPI definitions, and LinkML-backed spec content. - Edit
margo-docswhen the issue is in the website shell, routing, rendering, sync/build pipeline, or custom MDX components.