# hexui-sh/docs-template architecture

> Architecture diagram of the GitHub repository hexui-sh/docs-template, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hexui-sh/docs-template
- Repository: https://github.com/hexui-sh/docs-template

## Overview

This repository is a Next.js/Fumadocs documentation-site template. Authors maintain MDX documents and collection metadata; visitors navigate documentation routes, read rendered pages, and search the collection. The runtime also exposes Markdown/LLM-oriented content routes and page actions that link to source or external assistants. The graph emphasizes those product paths and the shared content-source layer. The README describes broader customization and responsive/theme capabilities; their detailed wiring is not sampled, so those components are represented at their supported directory paths without speculative call edges.

Main entry points: [`app/[[...slug]]/page.tsx`](https://github.com/hexui-sh/docs-template/blob/main/app/%5B%5B...slug%5D%5D/page.tsx) (Page resolution), [`lib/source.ts`](https://github.com/hexui-sh/docs-template/blob/main/lib/source.ts) (Content source loader), [`app/layout.tsx`](https://github.com/hexui-sh/docs-template/blob/main/app/layout.tsx) (Root documentation layout), [`app/llms.mdx/docs/[[...slug]]/route.ts`](https://github.com/hexui-sh/docs-template/blob/main/app/llms.mdx/docs/%5B%5B...slug%5D%5D/route.ts) (LLM content route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_content["Documentation content"]
  node_docs_content["MDX collections"]
  node_source_config["Collection definition<br/>[source.config.ts]"]
  node_source["Content source loader<br/>[source.ts]"]
end

subgraph group_runtime["Page runtime"]
  node_page_route["Page resolution<br/>[page.tsx]"]
  node_collections["Collection routing"]
  node_root_layout["Root documentation layout<br/>[layout.tsx]"]
end

subgraph group_experience["Reading experience"]
  node_mdx_map["MDX component registry<br/>[mdx-components.tsx]"]
  node_page_actions["Page actions"]
  node_site_header["Site navigation and header"]
  node_ui_components["Documentation UI"]
end

subgraph group_discovery["Search and export"]
  node_search_route["Search endpoint<br/>[route.ts]"]
  node_llms_route["LLM content route<br/>[route.ts]"]
end

subgraph group_config["Site configuration"]
  node_shared_config["Shared route config<br/>[shared.ts]"]
  node_layout_options["Layout options<br/>[layout.shared.tsx]"]
  node_site_config["Branding settings<br/>[site-config.ts]"]
end

node_author(("Documentation author"))
node_visitor(("Documentation visitor"))
node_ai_client(("LLM client"))
node_search_user(("Search user"))
node_markdown_user(("Markdown consumer"))

node_author -->|"writes MDX"| node_docs_content
node_source_config -->|"defines collection"| node_docs_content
node_source -->|"loads content"| node_docs_content
node_page_route -->|"resolves redirects"| node_collections
node_page_route -->|"looks up page"| node_source
node_page_route -->|"renders MDX"| node_mdx_map
node_page_route -->|"provides page links"| node_page_actions
node_visitor -->|"requests page"| node_page_route
node_root_layout -->|"reads page tree"| node_source
node_root_layout -->|"gets options"| node_layout_options
node_root_layout -->|"sets header slot"| node_site_header
node_root_layout -->|"composes layout"| node_ui_components
node_layout_options -->|"reads settings"| node_site_config
node_search_route -->|"indexes source"| node_source
node_search_user -->|"queries"| node_search_route
node_llms_route -->|"reads page text"| node_source
node_llms_route -->|"uses content routes"| node_shared_config
node_markdown_user -->|"requests content"| node_llms_route
node_ai_client -.->|"opens assistant link"| node_page_actions
node_page_actions -.->|"links Markdown"| node_markdown_user

click node_docs_content "https://github.com/hexui-sh/docs-template/tree/main/content/docs"
click node_source_config "https://github.com/hexui-sh/docs-template/blob/main/source.config.ts"
click node_source "https://github.com/hexui-sh/docs-template/blob/main/lib/source.ts"
click node_page_route "https://github.com/hexui-sh/docs-template/blob/main/app/%5B%5B...slug%5D%5D/page.tsx"
click node_collections "https://github.com/hexui-sh/docs-template/blob/main/lib/docs-collections.ts"
click node_root_layout "https://github.com/hexui-sh/docs-template/blob/main/app/layout.tsx"
click node_shared_config "https://github.com/hexui-sh/docs-template/blob/main/lib/shared.ts"
click node_layout_options "https://github.com/hexui-sh/docs-template/blob/main/lib/layout.shared.tsx"
click node_site_config "https://github.com/hexui-sh/docs-template/blob/main/lib/site-config.ts"
click node_mdx_map "https://github.com/hexui-sh/docs-template/blob/main/mdx-components.tsx"
click node_page_actions "https://github.com/hexui-sh/docs-template/blob/main/components/docs-page-actions.tsx"
click node_site_header "https://github.com/hexui-sh/docs-template/blob/main/components/docs-site-header.tsx"
click node_ui_components "https://github.com/hexui-sh/docs-template/tree/main/components"
click node_search_route "https://github.com/hexui-sh/docs-template/blob/main/app/api/search/route.ts"
click node_llms_route "https://github.com/hexui-sh/docs-template/blob/main/app/llms.mdx/docs/%5B%5B...slug%5D%5D/route.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_docs_content,node_source_config,node_source,node_ai_client,node_search_user toneBlue
class node_page_route,node_collections,node_root_layout toneAmber
class node_mdx_map,node_page_actions,node_site_header,node_ui_components toneMint
class node_search_route,node_llms_route toneRose
class node_shared_config,node_layout_options,node_site_config,node_author,node_visitor,node_markdown_user toneIndigo
```

## Components

### Documentation content

- [MDX collections](https://github.com/hexui-sh/docs-template/tree/main/content/docs): `content/docs`
- [Collection definition](https://github.com/hexui-sh/docs-template/blob/main/source.config.ts): `source.config.ts`
- [Content source loader](https://github.com/hexui-sh/docs-template/blob/main/lib/source.ts): `lib/source.ts`

### Page runtime

- [Page resolution](https://github.com/hexui-sh/docs-template/blob/main/app/%5B%5B...slug%5D%5D/page.tsx): `app/[[...slug]]/page.tsx`
- [Collection routing](https://github.com/hexui-sh/docs-template/blob/main/lib/docs-collections.ts): `lib/docs-collections.ts`
- [Root documentation layout](https://github.com/hexui-sh/docs-template/blob/main/app/layout.tsx): `app/layout.tsx`

### Reading experience

- [MDX component registry](https://github.com/hexui-sh/docs-template/blob/main/mdx-components.tsx): `mdx-components.tsx`
- [Page actions](https://github.com/hexui-sh/docs-template/blob/main/components/docs-page-actions.tsx): `components/docs-page-actions.tsx`
- [Site navigation and header](https://github.com/hexui-sh/docs-template/blob/main/components/docs-site-header.tsx): `components/docs-site-header.tsx`
- [Documentation UI](https://github.com/hexui-sh/docs-template/tree/main/components): `components`

### Search and export

- [Search endpoint](https://github.com/hexui-sh/docs-template/blob/main/app/api/search/route.ts): `app/api/search/route.ts`
- [LLM content route](https://github.com/hexui-sh/docs-template/blob/main/app/llms.mdx/docs/%5B%5B...slug%5D%5D/route.ts): `app/llms.mdx/docs/[[...slug]]/route.ts`

### Site configuration

- [Shared route config](https://github.com/hexui-sh/docs-template/blob/main/lib/shared.ts): `lib/shared.ts`
- [Layout options](https://github.com/hexui-sh/docs-template/blob/main/lib/layout.shared.tsx): `lib/layout.shared.tsx`
- [Branding settings](https://github.com/hexui-sh/docs-template/blob/main/lib/site-config.ts): `lib/site-config.ts`

### Other components

- **Documentation author**
- **Documentation visitor**
- **LLM client**
- **Search user**
- **Markdown consumer**

## Connections

- Documentation author → MDX collections: writes MDX
- Collection definition → MDX collections: defines collection
- Content source loader → MDX collections: loads content
- Page resolution → Collection routing: resolves redirects
- Page resolution → Content source loader: looks up page
- Page resolution → MDX component registry: renders MDX
- Page resolution → Page actions: provides page links
- Documentation visitor → Page resolution: requests page
- Root documentation layout → Content source loader: reads page tree
- Root documentation layout → Layout options: gets options
- Root documentation layout → Site navigation and header: sets header slot
- Root documentation layout → Documentation UI: composes layout
- Layout options → Branding settings: reads settings
- Search endpoint → Content source loader: indexes source
- Search user → Search endpoint: queries
- LLM content route → Content source loader: reads page text
- LLM content route → Shared route config: uses content routes
- Markdown consumer → LLM content route: requests content
- LLM client → Page actions: opens assistant link
- Page actions → Markdown consumer: links Markdown
