When building a CMS, staging preview server, or local docs tooling on top of PraisonAIUI, use aiui.create_site_app() to serve compiled output directories with full aiui serve parity and aiui.list_docs_pages() to read the exact compile-aligned page inventory.
aiui.create_site_app()
aiui serve
aiui.list_docs_pages()
aiui.create_site_app() is the shared ASGI factory backing aiui serve. It serves canonical extensionless URLs, base paths, redirects, Accept: text/markdown twins, immutable /assets caching, and content.docs.auth password protection:
Accept: text/markdown
/assets
content.docs.auth
| Parameter | Default | Description |
|---|---|---|
| output | required | Path to the compiled site directory produced by aiui build |
output
aiui build
| mode | "full" | "full" enables optional live site services configured by the build (aiui serve default); "static" keeps feedback, telemetry, MCP, and Ask AI off |
mode
"full"
"static"
| cors_origins | None | Optional list of CORS origins allowed for GET requests |
cors_origins
None
GET
| allow_frame_origin | None | Explicit http(s)://host[:port] origin allowed to frame delivered pages (updates frame-ancestors and drops X-Frame-Options; wildcards * are rejected) |
allow_frame_origin
http(s)://host[:port]
frame-ancestors
X-Frame-Options
*
aiui-access.json
DocsAuth
aiui.list_docs_pages() loads aiui.yaml (or aiui.template.yaml) and runs the compiler's exact scan rules — including numbered-folder stripping, index_files, custom routeBaseDocs, include/exclude, .aiuiignore, expanded snippets and {{variables}}, generated OpenAPI pages, and redirects/aliases:
aiui.yaml
aiui.template.yaml
index_files
routeBaseDocs
include
exclude
.aiuiignore
{{variables}}
Each entry is a frozen DocPageInfo dataclass:
DocPageInfo
| Field | Type | Description |
| route | str | Canonical URL path (e.g. "/docs/guides/setup") |
route
str
"/docs/guides/setup"
| title | str | Effective title after snippet and {{variable}} expansion |
title
{{variable}}
| source_path | str \| None | Checkout-relative POSIX path (e.g. "docs/01-guides/02-setup.md") for kind="editable", else None |
source_path
str \| None
"docs/01-guides/02-setup.md"
kind="editable"
| kind | "editable" \| "generated" \| "alias" | Whether the route maps to editable Markdown, a compiler-generated page, or a redirect/index alias |
kind
"editable" \| "generated" \| "alias"
| editable | bool | True only when kind == "editable" |
editable
bool
True
kind == "editable"
| target | str \| None | Destination route when kind == "alias" |
target
kind == "alias"
| hidden | bool | Whether frontmatter set hidden: true |
hidden
hidden: true
source_path is returned only by this local Python API and is never emitted into public build manifests.
Combine create_site_app(..., mode="static", allow_frame_origin=...) with ui.preview_frame() to embed live themed site previews safely inside a CMS or workspace plugin.
create_site_app(..., mode="static", allow_frame_origin=...)
ui.preview_frame()