When the user clicks on "Generate" , the following sequence runs:
DB render-engine JSDOM + mermaid SSR llm_cache table Mapper LLM (gpt-5-mini) auto-detect or docs pipeline API Editor DB render-engine JSDOM + mermaid SSR llm_cache table Mapper LLM (gpt-5-mini) auto-detect or docs pipeline API Editor alt [cache hit] [cache miss] alt [layout: docs] [default] POST /generate SELECT mdContent choosePipeline(layout, projectType) runDocsPipeline() extract frontmatter, TOC build sidebar groups runAutoDetectPipeline() sanitize HTML lookup by mdHash cached mapping sectionize prompt { sections: [...] } INSERT mapping detect types per section extract content (V2 parser) validate against schemas prerenderMermaidBlocks(body, pack) { source → svg map } renderDocsPage / renderPage HTML string UPDATE pages SET generatedJson { html, sections, validation } DB render-engine JSDOM + mermaid SSR llm_cache table Mapper LLM (gpt-5-mini) auto-detect or docs pipeline API Editor DB render-engine JSDOM + mermaid SSR llm_cache table Mapper LLM (gpt-5-mini) auto-detect or docs pipeline API Editor alt [cache hit] [cache miss] alt [layout: docs] [default] POST /generate SELECT mdContent choosePipeline(layout, projectType) runDocsPipeline() extract frontmatter, TOC build sidebar groups runAutoDetectPipeline() sanitize HTML lookup by mdHash cached mapping sectionize prompt { sections: [...] } INSERT mapping detect types per section extract content (V2 parser) validate against schemas prerenderMermaidBlocks(body, pack) { source → svg map } renderDocsPage / renderPage HTML string UPDATE pages SET generatedJson { html, sections, validation }
10.1 Auto-Detect-Branch#
sanitize — HTML stripping, dangerous tags removed
sectionize — Markdown is divided into logical sections (--- separator or LLM)
detectSectionTypes — per section: is this a Hero, FAQ, Pricing, …?
extractContent — structured data object per section (e.g. Hero → { title, subtitle, cta, image })
validate — schema check per component, messages[] with severity level
10.2 Docs-Branch#
Extract frontmatter (title, description, group, order)
Generate TOC from headings (h2/h3/h4)
Sidebar groups from all pages of the project (group field)
Body remains raw Markdown (passed through react-markdown in the renderer)
→ DocsPageInput Object → renderDocsPage()
10.3 LLM-Cache#
Every mapping call is keyed with mdHash = sha256(mdContent). On the second generate with the same content → DB lookup, no call. Saves tokens and latency.#