# wiranata-orion/llm-lan-server architecture

> Architecture diagram of the GitHub repository wiranata-orion/llm-lan-server, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wiranata-orion/llm-lan-server
- Repository: https://github.com/wiranata-orion/llm-lan-server

## Overview

LLM DIY is a local Ollama-based AI chat and coding assistant, with a Vue interface and Node/TypeScript agent backend. The main workflow runs from user chat in the UI, through its API client and backend routes to the agent orchestrator, which generates responses through Ollama and can use tools, memory, retrieval, and workspace context. Separate branches cover document ingestion, persistent conversation/vector memory, and Vibe Coding workspace indexing and file access. Edges use README statements and SOURCE INDEX references; unsampled internals are not assumed to call one another.

Main entry points: [`agent-server/src/ollama.ts`](https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/ollama.ts) (Ollama client), [`agent-server/src/orchestrator.ts`](https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/orchestrator.ts) (Turn orchestrator), [`web-ui/src/services/api.js`](https://github.com/wiranata-orion/llm-lan-server/blob/main/web-ui/src/services/api.js) (API client), [`agent-server/src/services/workspace-indexer.ts`](https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/services/workspace-indexer.ts) (Workspace indexer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interface"]
  node_app["Chat interface<br/>[App.vue]"]
  node_api["API client<br/>[api.js]"]
  node_workspace_ui["Workspace interface<br/>[WorkspaceView.vue]"]
  node_local_memory[("Browser memory<br/>[memory.js]")]
end

subgraph group_agent["Chat agent"]
  node_routes["Agent API routes<br/>[routes.ts]"]
  node_context["App context<br/>[app-context.ts]"]
  node_orchestrator["Turn orchestrator<br/>[orchestrator.ts]"]
  node_ollama["Ollama client<br/>[ollama.ts]"]
  node_tools["Tool execution<br/>[executor.ts]"]
end

subgraph group_memory["Memory and retrieval"]
  node_memory_core["Memory core<br/>[memory-core.ts]"]
  node_history[("Conversation history")]
  node_retriever["Document retrieval<br/>[retriever.ts]"]
  node_vector[("Vector store<br/>[vector-store.ts]")]
  node_ingestion["Document ingestion<br/>[ingestion.ts]"]
end

subgraph group_workspace["Coding workspace"]
  node_workspace_routes["Workspace API<br/>[workspace.ts]"]
  node_workspace_rag["Workspace context<br/>[workspace-rag.ts]"]
  node_indexer["Workspace indexer"]
  node_workspace_store[("Workspace index store<br/>[workspace-store.ts]")]
end

node_user(("User"))
node_ollama_service(("Ollama engine"))

node_user -->|"asks"| node_app
node_app -->|"requests"| node_api
node_api -->|"calls API"| node_routes
node_routes -->|"uses context"| node_context
node_context -->|"provides agent"| node_orchestrator
node_orchestrator -->|"generates chat"| node_ollama
node_ollama -->|"sends requests"| node_ollama_service
node_orchestrator -->|"executes tools"| node_tools
node_orchestrator -->|"uses memory"| node_memory_core
node_orchestrator -->|"retrieves context"| node_retriever
node_memory_core -->|"embeds content"| node_ollama
node_memory_core -->|"reads and writes"| node_vector
node_retriever -->|"embeds query"| node_ollama
node_retriever -->|"searches vectors"| node_vector
node_ingestion -->|"embeds chunks"| node_ollama
node_ingestion -->|"stores chunks"| node_vector
node_api -->|"persists chats"| node_local_memory
node_app -->|"opens workspace"| node_workspace_ui
node_workspace_ui -.->|"uses API"| node_api
node_workspace_routes -->|"uses indexer"| node_indexer
node_workspace_routes -->|"uses workspace context"| node_workspace_rag
node_workspace_routes -->|"uses store"| node_workspace_store
node_workspace_rag -->|"reads and searches"| node_indexer
node_workspace_rag -->|"embeds search"| node_ollama
node_indexer -->|"indexes data"| node_workspace_store
node_indexer -->|"embeds chunks"| node_ollama

click node_app "https://github.com/wiranata-orion/llm-lan-server/blob/main/web-ui/src/App.vue"
click node_api "https://github.com/wiranata-orion/llm-lan-server/blob/main/web-ui/src/services/api.js"
click node_routes "https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/routes.ts"
click node_context "https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/app-context.ts"
click node_orchestrator "https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/orchestrator.ts"
click node_ollama "https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/ollama.ts"
click node_tools "https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/tools/executor.ts"
click node_memory_core "https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/memory-core.ts"
click node_history "https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/chat-history-store.ts"
click node_retriever "https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/retriever.ts"
click node_vector "https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/vector-store.ts"
click node_ingestion "https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/ingestion.ts"
click node_workspace_routes "https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/routes/workspace.ts"
click node_workspace_rag "https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/services/workspace-rag.ts"
click node_indexer "https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/services/workspace-indexer.ts"
click node_workspace_store "https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/services/workspace-store.ts"
click node_workspace_ui "https://github.com/wiranata-orion/llm-lan-server/blob/main/web-ui/src/components/WorkspaceView.vue"
click node_local_memory "https://github.com/wiranata-orion/llm-lan-server/blob/main/web-ui/src/services/memory.js"

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_app,node_api,node_workspace_ui,node_local_memory,node_user toneBlue
class node_routes,node_context,node_orchestrator,node_ollama,node_tools toneAmber
class node_memory_core,node_history,node_retriever,node_vector,node_ingestion toneMint
class node_workspace_routes,node_workspace_rag,node_indexer,node_workspace_store toneRose
class node_ollama_service toneIndigo
```

## Components

### User interface

- [Chat interface](https://github.com/wiranata-orion/llm-lan-server/blob/main/web-ui/src/App.vue): `web-ui/src/App.vue`
- [API client](https://github.com/wiranata-orion/llm-lan-server/blob/main/web-ui/src/services/api.js): `web-ui/src/services/api.js`
- [Workspace interface](https://github.com/wiranata-orion/llm-lan-server/blob/main/web-ui/src/components/WorkspaceView.vue): `web-ui/src/components/WorkspaceView.vue`
- [Browser memory](https://github.com/wiranata-orion/llm-lan-server/blob/main/web-ui/src/services/memory.js): `web-ui/src/services/memory.js`

### Chat agent

- [Agent API routes](https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/routes.ts): `agent-server/src/routes.ts`
- [App context](https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/app-context.ts): `agent-server/src/app-context.ts`
- [Turn orchestrator](https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/orchestrator.ts): `agent-server/src/orchestrator.ts`
- [Ollama client](https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/ollama.ts): `agent-server/src/ollama.ts`
- [Tool execution](https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/tools/executor.ts): `agent-server/src/tools/executor.ts`

### Memory and retrieval

- [Memory core](https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/memory-core.ts): `agent-server/src/memory-core.ts`
- [Conversation history](https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/chat-history-store.ts): `agent-server/src/chat-history-store.ts`
- [Document retrieval](https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/retriever.ts): `agent-server/src/retriever.ts`
- [Vector store](https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/vector-store.ts): `agent-server/src/vector-store.ts`
- [Document ingestion](https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/ingestion.ts): `agent-server/src/ingestion.ts`

### Coding workspace

- [Workspace API](https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/routes/workspace.ts): `agent-server/src/routes/workspace.ts`
- [Workspace context](https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/services/workspace-rag.ts): `agent-server/src/services/workspace-rag.ts`
- [Workspace indexer](https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/services/workspace-indexer.ts): `agent-server/src/services/workspace-indexer.ts`
- [Workspace index store](https://github.com/wiranata-orion/llm-lan-server/blob/main/agent-server/src/services/workspace-store.ts): `agent-server/src/services/workspace-store.ts`

### Other components

- **User**
- **Ollama engine**

## Connections

- User → Chat interface: asks (evidence: `README.md`)
- Chat interface → API client: requests (evidence: `web-ui/src/App.vue`)
- API client → Agent API routes: calls API (evidence: `README.md`)
- Agent API routes → App context: uses context (evidence: `agent-server/src/routes.ts`)
- App context → Turn orchestrator: provides agent (evidence: `agent-server/src/app-context.ts`)
- Turn orchestrator → Ollama client: generates chat (evidence: `agent-server/src/orchestrator.ts`)
- Ollama client → Ollama engine: sends requests (evidence: `agent-server/src/ollama.ts`)
- Turn orchestrator → Tool execution: executes tools (evidence: `agent-server/src/orchestrator.ts`)
- Turn orchestrator → Memory core: uses memory (evidence: `agent-server/src/orchestrator.ts`)
- Turn orchestrator → Document retrieval: retrieves context (evidence: `agent-server/src/orchestrator.ts`)
- Memory core → Ollama client: embeds content (evidence: `agent-server/src/memory-core.ts`)
- Memory core → Vector store: reads and writes (evidence: `agent-server/src/memory-core.ts`)
- Document retrieval → Ollama client: embeds query (evidence: `agent-server/src/retriever.ts`)
- Document retrieval → Vector store: searches vectors (evidence: `agent-server/src/retriever.ts`)
- Document ingestion → Ollama client: embeds chunks (evidence: `agent-server/src/ingestion.ts`)
- Document ingestion → Vector store: stores chunks (evidence: `agent-server/src/ingestion.ts`)
- API client → Browser memory: persists chats (evidence: `web-ui/src/App.vue`)
- Chat interface → Workspace interface: opens workspace (evidence: `web-ui/src/App.vue`)
- Workspace interface → API client: uses API
- Workspace API → Workspace indexer: uses indexer (evidence: `agent-server/src/routes/workspace.ts`)
- Workspace API → Workspace context: uses workspace context (evidence: `agent-server/src/routes/workspace.ts`)
- Workspace API → Workspace index store: uses store (evidence: `agent-server/src/routes/workspace.ts`)
- Workspace context → Workspace indexer: reads and searches (evidence: `agent-server/src/services/workspace-rag.ts`)
- Workspace context → Ollama client: embeds search (evidence: `agent-server/src/services/workspace-rag.ts`)
- Workspace indexer → Workspace index store: indexes data (evidence: `agent-server/src/services/workspace-indexer.ts`)
- Workspace indexer → Ollama client: embeds chunks (evidence: `agent-server/src/services/workspace-indexer.ts`)
