Flude is under construction. Features, commands, limits and behavior described here may be incomplete or change without notice.
Skip to content

Architecture: How Flude Works ​

Audience: anyone who wants to understand what happens between "source code with documentation comments" and "a page on a documentation site".

Generation is two independent, sequential phases, connected through the file system rather than a direct function call. Understanding this split explains most of the "why does the site show stale content" and "why did nothing render" questions.


Phase A: content generation (ude.cli compile, per document) ​

Phase A runs once per document — one project, one language, one output format (for example mock_api_cpp for a C++ HTML reference, mock_api_cpp_hugo for the same content as Hugo Markdown):

  • Collect: selects the files of the document (patterns, include and exclude lists).
  • Parse: one of the parser backends reads the code and normalizes it into a ProjectCatalog — the language-independent Intermediate Representation (IR). The backends produce the same model, so everything downstream works the same whichever one you pick.
  • Render: a renderer named <Lang><Output><ID>Renderer writes the final output, with Lang ∈ {Cpp, Cs, Java, Py}, Output ∈ {Html, Hugo} and ID = Default — eight classes in the core engine. A renderer supplied from outside the core registers itself under its own ID.
  • Audit: every successful compile unconditionally prints a documentation coverage table — see CLI Reference.

The orchestrator drives Collect → Parse → Render for a single document; it does not know about, or participate in, Phase B below.

Where Phase A writes ​

The output directory is output_base_dir (set once, in the global config) joined with each document's own output_subdir; see Target Settings and Global Settings.

For renderer.type values html or static_html, the output is already a complete, self-contained static site for that one document — open it directly in a browser, nothing else needs to run. For hugo_markdown (or its aliases), the output is Markdown only, and needs Phase B to become HTML.


Phase B: site build ​

Phase B runs separately and later, and does not invoke the parser at all. Each Hugo-variant document has a matching Hugo project whose hugo.toml mounts the Phase-A Markdown output as that project's content/:

toml
# hugo.toml of a Hugo project (abridged)
[[module.mounts]]
source = "../../../.workdir/output/mock_api_cpp_hugo"
target = "content"

A build script runs hugo --destination for the shared portal and for every such per-document project, producing the final combined HTML tree. No re-parsing of source code happens at this stage.

In other words: there is no direct call between rendering and a finished site — these are two independent processes connected only via the file system.

  • Target Settings — output_base_dir / output_subdir and the rest of the doc-config schema referenced above
  • Parser Backends — the three ways the code is read