# lin327/sre-wiki architecture

> Architecture diagram of the GitHub repository lin327/sre-wiki, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lin327/sre-wiki
- Repository: https://github.com/lin327/sre-wiki

## Overview

SRE Atlas is a bilingual, primarily Chinese static operations knowledge site. Readers browse or search published Linux, Docker, Kubernetes, and related guides; canonical content is eligible for search and sitemap discovery, while drafts in `src/inbox/` are held for human review and PR handoff. Astro configures the route index, wikilink transformation, and discovery filtering; MDX components and the shared layout support rendered pages. The README documents Pagefind search and Docker/nginx hosting. Some UI and layout wiring is inferred from documented capabilities and the tree rather than inspected source.

Main entry points: [`src/pages`](https://github.com/lin327/sre-wiki/tree/main/src/pages) (Published pages), [`src/layouts/BaseLayout.astro`](https://github.com/lin327/sre-wiki/blob/main/src/layouts/BaseLayout.astro) (Shared layout), [`src/lib/remark-wikilinks.mjs`](https://github.com/lin327/sre-wiki/blob/main/src/lib/remark-wikilinks.mjs) (Wikilink plugin), [`src/lib/route-index.mjs`](https://github.com/lin327/sre-wiki/blob/main/src/lib/route-index.mjs) (Route index)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_content["Content and publishing"]
  node_pages["Published pages"]
  node_inbox["Review drafts"]
  node_metadata["Content metadata"]
  node_publish["Publish contract"]
  node_routeindex["Route index<br/>[route-index.mjs]"]
  node_wikilinks["Wikilink plugin"]
  node_brokenlinks["Link audit"]
end

subgraph group_site["Site rendering"]
  node_layout["Shared layout<br/>[BaseLayout.astro]"]
  node_mdxmap["MDX components<br/>[mdx-components.ts]"]
  node_mdxwidgets["MDX widgets"]
  node_theme["Theme controls<br/>[ThemeToggle.tsx]"]
  node_language["Language switcher"]
  node_mermaid["Diagram renderer<br/>[Mermaid.tsx]"]
end

subgraph group_discovery["Search and discovery"]
  node_searchui["Search UI<br/>[PagefindSearch.tsx]"]
  node_pagefind["Pagefind search"]
  node_discovery["Discovery policy"]
end

subgraph group_identity["Identity"]
  node_authbutton["Auth button<br/>[AuthButton.tsx]"]
  node_authclient["Auth client<br/>[auth-client.ts]"]
end

node_reader(("Reader"))
node_authservice["Auth service"]
node_cdn["Mermaid CDN"]
node_host["Static host"]

node_reader -.->|"browses"| node_layout
node_pages -.->|"renders as"| node_layout
node_inbox -->|"human PR handoff"| node_pages
node_pages -->|"metadata read"| node_metadata
node_publish -->|"validates with"| node_metadata
node_publish -->|"compiles with"| node_wikilinks
node_wikilinks -->|"resolves against"| node_routeindex
node_brokenlinks -->|"loads and resolves"| node_routeindex
node_brokenlinks -->|"parses with"| node_wikilinks
node_mdxmap -->|"maps components"| node_mdxwidgets
node_mdxmap -->|"registers"| node_mermaid
node_mermaid -->|"loads runtime"| node_cdn
node_searchui -.->|"queries"| node_pagefind
node_reader -.->|"searches"| node_searchui
node_discovery -->|"filters routes"| node_pages
node_routeindex -->|"indexes routes"| node_pages
node_wikilinks -->|"configured with"| node_routeindex
node_theme -.->|"controls appearance"| node_layout
node_language -.->|"switches locale"| node_layout
node_authbutton -->|"calls"| node_authclient
node_authclient -->|"connects to"| node_authservice
node_layout -.->|"served by"| node_host

click node_pages "https://github.com/lin327/sre-wiki/tree/main/src/pages"
click node_inbox "https://github.com/lin327/sre-wiki/tree/main/src/inbox"
click node_metadata "https://github.com/lin327/sre-wiki/blob/main/src/lib/content-metadata.mjs"
click node_publish "https://github.com/lin327/sre-wiki/blob/main/src/lib/publish-contract.mjs"
click node_routeindex "https://github.com/lin327/sre-wiki/blob/main/src/lib/route-index.mjs"
click node_wikilinks "https://github.com/lin327/sre-wiki/blob/main/src/lib/remark-wikilinks.mjs"
click node_brokenlinks "https://github.com/lin327/sre-wiki/blob/main/scripts/report-broken-links.mjs"
click node_layout "https://github.com/lin327/sre-wiki/blob/main/src/layouts/BaseLayout.astro"
click node_mdxmap "https://github.com/lin327/sre-wiki/blob/main/src/components/mdx/mdx-components.ts"
click node_mdxwidgets "https://github.com/lin327/sre-wiki/tree/main/src/components/mdx"
click node_searchui "https://github.com/lin327/sre-wiki/blob/main/src/components/react/PagefindSearch.tsx"
click node_discovery "https://github.com/lin327/sre-wiki/blob/main/src/lib/discovery-policy.mjs"
click node_theme "https://github.com/lin327/sre-wiki/blob/main/src/components/react/ThemeToggle.tsx"
click node_language "https://github.com/lin327/sre-wiki/blob/main/src/components/react/LanguageSwitcher.tsx"
click node_authbutton "https://github.com/lin327/sre-wiki/blob/main/src/components/react/AuthButton.tsx"
click node_authclient "https://github.com/lin327/sre-wiki/blob/main/src/lib/auth-client.ts"
click node_mermaid "https://github.com/lin327/sre-wiki/blob/main/src/components/react/Mermaid.tsx"

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_pages,node_inbox,node_metadata,node_publish,node_routeindex,node_wikilinks,node_brokenlinks toneBlue
class node_layout,node_mdxmap,node_mdxwidgets,node_theme,node_language,node_mermaid toneAmber
class node_searchui,node_pagefind,node_discovery toneMint
class node_authbutton,node_authclient toneRose
class node_reader,node_authservice,node_cdn,node_host toneIndigo
```

## Components

### Content and publishing

- [Published pages](https://github.com/lin327/sre-wiki/tree/main/src/pages): `src/pages`
- [Review drafts](https://github.com/lin327/sre-wiki/tree/main/src/inbox): `src/inbox`
- [Content metadata](https://github.com/lin327/sre-wiki/blob/main/src/lib/content-metadata.mjs): `src/lib/content-metadata.mjs`
- [Publish contract](https://github.com/lin327/sre-wiki/blob/main/src/lib/publish-contract.mjs): `src/lib/publish-contract.mjs`
- [Route index](https://github.com/lin327/sre-wiki/blob/main/src/lib/route-index.mjs): `src/lib/route-index.mjs`
- [Wikilink plugin](https://github.com/lin327/sre-wiki/blob/main/src/lib/remark-wikilinks.mjs): `src/lib/remark-wikilinks.mjs`
- [Link audit](https://github.com/lin327/sre-wiki/blob/main/scripts/report-broken-links.mjs): `scripts/report-broken-links.mjs`

### Site rendering

- [Shared layout](https://github.com/lin327/sre-wiki/blob/main/src/layouts/BaseLayout.astro): `src/layouts/BaseLayout.astro`
- [MDX components](https://github.com/lin327/sre-wiki/blob/main/src/components/mdx/mdx-components.ts): `src/components/mdx/mdx-components.ts`
- [MDX widgets](https://github.com/lin327/sre-wiki/tree/main/src/components/mdx): `src/components/mdx`
- [Theme controls](https://github.com/lin327/sre-wiki/blob/main/src/components/react/ThemeToggle.tsx): `src/components/react/ThemeToggle.tsx`
- [Language switcher](https://github.com/lin327/sre-wiki/blob/main/src/components/react/LanguageSwitcher.tsx): `src/components/react/LanguageSwitcher.tsx`
- [Diagram renderer](https://github.com/lin327/sre-wiki/blob/main/src/components/react/Mermaid.tsx): `src/components/react/Mermaid.tsx`

### Search and discovery

- [Search UI](https://github.com/lin327/sre-wiki/blob/main/src/components/react/PagefindSearch.tsx): `src/components/react/PagefindSearch.tsx`
- **Pagefind search**
- [Discovery policy](https://github.com/lin327/sre-wiki/blob/main/src/lib/discovery-policy.mjs): `src/lib/discovery-policy.mjs`

### Identity

- [Auth button](https://github.com/lin327/sre-wiki/blob/main/src/components/react/AuthButton.tsx): `src/components/react/AuthButton.tsx`
- [Auth client](https://github.com/lin327/sre-wiki/blob/main/src/lib/auth-client.ts): `src/lib/auth-client.ts`

### Other components

- **Reader**
- **Auth service**
- **Mermaid CDN**
- **Static host**

## Connections

- Reader → Shared layout: browses (evidence: `README.md`)
- Published pages → Shared layout: renders as (evidence: `README.md`)
- Review drafts → Published pages: human PR handoff (evidence: `README.md`)
- Published pages → Content metadata: metadata read (evidence: `src/lib/content-metadata.mjs`)
- Publish contract → Content metadata: validates with (evidence: `src/lib/publish-contract.mjs`)
- Publish contract → Wikilink plugin: compiles with (evidence: `src/lib/publish-contract.mjs`)
- Wikilink plugin → Route index: resolves against (evidence: `src/lib/remark-wikilinks.mjs`)
- Link audit → Route index: loads and resolves (evidence: `scripts/report-broken-links.mjs`)
- Link audit → Wikilink plugin: parses with (evidence: `scripts/report-broken-links.mjs`)
- MDX components → MDX widgets: maps components (evidence: `src/components/mdx/mdx-components.ts`)
- MDX components → Diagram renderer: registers (evidence: `src/components/mdx/mdx-components.ts`)
- Diagram renderer → Mermaid CDN: loads runtime (evidence: `src/components/react/Mermaid.tsx`)
- Search UI → Pagefind search: queries (evidence: `README.md`)
- Reader → Search UI: searches (evidence: `README.md`)
- Discovery policy → Published pages: filters routes
- Route index → Published pages: indexes routes
- Wikilink plugin → Route index: configured with (evidence: `astro.config.mjs`)
- Theme controls → Shared layout: controls appearance (evidence: `README.md`)
- Language switcher → Shared layout: switches locale (evidence: `README.md`)
- Auth button → Auth client: calls (evidence: `src/components/react/AuthButton.tsx`)
- Auth client → Auth service: connects to (evidence: `src/lib/auth-client.ts`)
- Shared layout → Static host: served by (evidence: `README.md`)
