# zcag/tela architecture

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

- Interactive diagram: https://gitdiagram.com/zcag/tela
- Repository: https://github.com/zcag/tela

## Overview

tela is a self-hostable, markdown-native team wiki with a Go backend and React/Milkdown client. A team member signs in, opens or edits canonical Markdown pages, and can collaborate live; agents can also search, read, and author through MCP. Search spans ranked full-text and optional semantic retrieval, while Atlas turns source repositories into maintained wiki pages. The graph includes the documented public-sharing, organization, and agent capabilities. Several subsystems are represented at their exact tree paths because their implementation excerpts were not sampled; those links rely on README claims rather than inspected calls.

Main entry points: [`backend/internal/api/router.go`](https://github.com/zcag/tela/blob/main/backend/internal/api/router.go) (HTTP API), [`frontend/src/components/app/PageView.tsx`](https://github.com/zcag/tela/blob/main/frontend/src/components/app/PageView.tsx) (Page editor and reader), [`backend/internal/api/search.go`](https://github.com/zcag/tela/blob/main/backend/internal/api/search.go) (Search and ask API), [`frontend/src/main.tsx`](https://github.com/zcag/tela/blob/main/frontend/src/main.tsx) (Client bootstrap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_frontend_boot["Client bootstrap<br/>[main.tsx]"]
  node_app["App shell<br/>[App.tsx]"]
  node_router["Route surfaces<br/>[router.tsx]"]
  node_page_ui["Page editor and reader<br/>[PageView.tsx]"]
  node_markdown_view["Markdown rendering<br/>[MarkdownView.tsx]"]
  node_query_client["Query cache<br/>[queryClient.ts]"]
  node_api_client["HTTP client<br/>[api.ts]"]
end

subgraph group_backend["Wiki backend"]
  node_api_routes["HTTP API<br/>[router.go]"]
  node_auth["Authentication<br/>[middleware.go]"]
  node_pages["Pages and spaces<br/>[pages.go]"]
  node_database[("PostgreSQL access<br/>[db.go]")]
  node_collaboration["Live collaboration"]
end

subgraph group_search["Search and answers"]
  node_search_api["Search and ask API<br/>[search.go]"]
  node_rag["Semantic retrieval<br/>[rag.go]"]
end

subgraph group_atlas["Atlas docs engine"]
  node_atlas_api["Atlas run API<br/>[atlas_run.go]"]
  node_atlas_engine["Atlas pipeline<br/>[engine.go]"]
end

subgraph group_integrations["Agent and sharing"]
  node_mcp["MCP server<br/>[mcp.go]"]
  node_sharing["Public sharing<br/>[share_links.go]"]
end

node_member(("Team member"))
node_agent(("AI agent"))

node_member -->|"opens wiki"| node_frontend_boot
node_frontend_boot -->|"renders"| node_app
node_app -->|"hosts routes"| node_router
node_router -->|"routes to"| node_page_ui
node_page_ui -.->|"renders content"| node_markdown_view
node_page_ui -.->|"loads and saves"| node_query_client
node_query_client -->|"requests data"| node_api_client
node_api_client -->|"calls HTTP API"| node_api_routes
node_api_routes -->|"uses middleware"| node_auth
node_api_routes -.->|"dispatches page routes"| node_pages
node_pages -.->|"reads and writes"| node_database
node_api_routes -.->|"dispatches search"| node_search_api
node_search_api -.->|"retrieves context"| node_rag
node_api_routes -.->|"dispatches Atlas"| node_atlas_api
node_atlas_api -.->|"runs pipeline"| node_atlas_engine
node_atlas_engine -->|"publishes wiki pages"| node_member
node_agent -->|"searches and authors"| node_mcp
node_member -->|"creates share links"| node_sharing
node_page_ui -->|"edits collaboratively"| node_collaboration
node_member -->|"searches pages"| node_search_api
node_search_api -->|"returns ranked results"| node_member

click node_frontend_boot "https://github.com/zcag/tela/blob/main/frontend/src/main.tsx"
click node_app "https://github.com/zcag/tela/blob/main/frontend/src/App.tsx"
click node_router "https://github.com/zcag/tela/blob/main/frontend/src/routes/router.tsx"
click node_page_ui "https://github.com/zcag/tela/blob/main/frontend/src/components/app/PageView.tsx"
click node_markdown_view "https://github.com/zcag/tela/blob/main/frontend/src/components/view/MarkdownView.tsx"
click node_query_client "https://github.com/zcag/tela/blob/main/frontend/src/lib/queryClient.ts"
click node_api_client "https://github.com/zcag/tela/blob/main/frontend/src/lib/api.ts"
click node_api_routes "https://github.com/zcag/tela/blob/main/backend/internal/api/router.go"
click node_auth "https://github.com/zcag/tela/blob/main/backend/internal/auth/middleware.go"
click node_pages "https://github.com/zcag/tela/blob/main/backend/internal/api/pages.go"
click node_database "https://github.com/zcag/tela/blob/main/backend/internal/db/db.go"
click node_search_api "https://github.com/zcag/tela/blob/main/backend/internal/api/search.go"
click node_rag "https://github.com/zcag/tela/blob/main/backend/internal/rag/rag.go"
click node_atlas_api "https://github.com/zcag/tela/blob/main/backend/internal/api/atlas_run.go"
click node_atlas_engine "https://github.com/zcag/tela/blob/main/backend/internal/atlas/engine/engine.go"
click node_mcp "https://github.com/zcag/tela/blob/main/backend/internal/api/mcp.go"
click node_sharing "https://github.com/zcag/tela/blob/main/backend/internal/api/share_links.go"
click node_collaboration "https://github.com/zcag/tela/blob/main/frontend/src/lib/collab/use-collab-session.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_frontend_boot,node_app,node_router,node_page_ui,node_markdown_view,node_query_client,node_api_client toneBlue
class node_api_routes,node_auth,node_pages,node_database,node_collaboration toneAmber
class node_search_api,node_rag toneMint
class node_atlas_api,node_atlas_engine toneRose
class node_mcp,node_sharing,node_member,node_agent toneIndigo
```

## Components

### Web client

- [Client bootstrap](https://github.com/zcag/tela/blob/main/frontend/src/main.tsx): `frontend/src/main.tsx`
- [App shell](https://github.com/zcag/tela/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Route surfaces](https://github.com/zcag/tela/blob/main/frontend/src/routes/router.tsx): `frontend/src/routes/router.tsx`
- [Page editor and reader](https://github.com/zcag/tela/blob/main/frontend/src/components/app/PageView.tsx): `frontend/src/components/app/PageView.tsx`
- [Markdown rendering](https://github.com/zcag/tela/blob/main/frontend/src/components/view/MarkdownView.tsx): `frontend/src/components/view/MarkdownView.tsx`
- [Query cache](https://github.com/zcag/tela/blob/main/frontend/src/lib/queryClient.ts): `frontend/src/lib/queryClient.ts`
- [HTTP client](https://github.com/zcag/tela/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### Wiki backend

- [HTTP API](https://github.com/zcag/tela/blob/main/backend/internal/api/router.go): `backend/internal/api/router.go`
- [Authentication](https://github.com/zcag/tela/blob/main/backend/internal/auth/middleware.go): `backend/internal/auth/middleware.go`
- [Pages and spaces](https://github.com/zcag/tela/blob/main/backend/internal/api/pages.go): `backend/internal/api/pages.go`
- [PostgreSQL access](https://github.com/zcag/tela/blob/main/backend/internal/db/db.go): `backend/internal/db/db.go`
- [Live collaboration](https://github.com/zcag/tela/blob/main/frontend/src/lib/collab/use-collab-session.ts): `frontend/src/lib/collab/use-collab-session.ts`

### Search and answers

- [Search and ask API](https://github.com/zcag/tela/blob/main/backend/internal/api/search.go): `backend/internal/api/search.go`
- [Semantic retrieval](https://github.com/zcag/tela/blob/main/backend/internal/rag/rag.go): `backend/internal/rag/rag.go`

### Atlas docs engine

- [Atlas run API](https://github.com/zcag/tela/blob/main/backend/internal/api/atlas_run.go): `backend/internal/api/atlas_run.go`
- [Atlas pipeline](https://github.com/zcag/tela/blob/main/backend/internal/atlas/engine/engine.go): `backend/internal/atlas/engine/engine.go`

### Agent and sharing

- [MCP server](https://github.com/zcag/tela/blob/main/backend/internal/api/mcp.go): `backend/internal/api/mcp.go`
- [Public sharing](https://github.com/zcag/tela/blob/main/backend/internal/api/share_links.go): `backend/internal/api/share_links.go`

### Other components

- **Team member**
- **AI agent**

## Connections

- Team member → Client bootstrap: opens wiki (evidence: `README.md`)
- Client bootstrap → App shell: renders (evidence: `frontend/src/main.tsx`)
- App shell → Route surfaces: hosts routes (evidence: `frontend/src/App.tsx`)
- Route surfaces → Page editor and reader: routes to (evidence: `frontend/src/routes/router.tsx`)
- Page editor and reader → Markdown rendering: renders content
- Page editor and reader → Query cache: loads and saves
- Query cache → HTTP client: requests data (evidence: `frontend/src/lib/queryClient.ts`)
- HTTP client → HTTP API: calls HTTP API (evidence: `README.md`)
- HTTP API → Authentication: uses middleware (evidence: `backend/internal/api/router.go`)
- HTTP API → Pages and spaces: dispatches page routes
- Pages and spaces → PostgreSQL access: reads and writes
- HTTP API → Search and ask API: dispatches search
- Search and ask API → Semantic retrieval: retrieves context
- HTTP API → Atlas run API: dispatches Atlas
- Atlas run API → Atlas pipeline: runs pipeline
- Atlas pipeline → Team member: publishes wiki pages (evidence: `README.md`)
- AI agent → MCP server: searches and authors (evidence: `README.md`)
- Team member → Public sharing: creates share links (evidence: `README.md`)
- Page editor and reader → Live collaboration: edits collaboratively (evidence: `README.md`)
- Team member → Search and ask API: searches pages (evidence: `README.md`)
- Search and ask API → Team member: returns ranked results (evidence: `README.md`)
