Architecture
Folio is a local static-site generator. The CLI reads configuration, parses project sources, writes generated MDX into a Nextra workspace, then runs the Next.js static export.
Runtime Flow
flowchart LR CLI["▸ CLI: build / serve"] --> Config["▣ docs.yaml"] Config --> Sources["▤ Python + Markdown"] Sources --> Parse["⚙ Parse"] Parse --> IRNode["◇ IR objects"] IRNode --> Generate["▥ MDX + metadata"] Extensions["⊕ Internal extensions"] --> Generate Template["▧ Nextra template"] --> Generate Generate --> Export["✓ Static site + search + llms.txt"]
folio.clihandles command arguments and callsfolio.build.run_build.folio.configloadsdocs.yamland resolved project paths.folio.sourcesparses configured Python and Markdown sources.folio.buildorchestrates parsing, page generation, extension registration, link checks, dependency checks, and export.folio.generator.site_builder.SiteBuilderowns generated content files, metadata, manifests, LLM files, and the search index.template/provides the Nextra application that receives the generated content.
Generator Boundaries
SiteBuilder delegates build-environment work to smaller modules:
TemplateWorkspacecopies the template and removes bundled demo content.TemplateConfigInjectorreplaces template placeholders withdocs.yamlvalues.ExtensionEmitterwrites plugin components, typed data modules, and generated views.NextRuntimeinstalls dependencies, runs Next.js, serves development mode, and copies static output.StaticAssetRewriterrewrites exported links so the static site works fromfile://.
Extension Boundary
Folio keeps extension internals isolated from parser, theme, and RST implementation details. The public MVP docs do not expose plugin authoring yet; release-ready hooks will be documented once that surface stabilizes.