# samosusa/beumer-group-localchat architecture

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

- Interactive diagram: https://gitdiagram.com/samosusa/beumer-group-localchat
- Repository: https://github.com/samosusa/beumer-group-localchat

## Overview

BEUMER-GROUP-LocalChat is an offline document assistant: employees manage documents and projects, ask questions, and receive answers grounded in locally stored documents. Its primary workflow runs from the desktop interface through the Python API, where uploads are parsed, chunked, embedded, and indexed; queries retrieve relevant material and invoke the active local language model. Separate capabilities cover conversation history, model selection, evaluation and benchmarking, and the Electron shell. Some subsystem paths and connections are supported by the README rather than inspected source excerpts.

Main entry points: [`src/app.py`](https://github.com/samosusa/beumer-group-localchat/blob/main/src/app.py) (FastAPI application), [`src/ingest/pipeline.py`](https://github.com/samosusa/beumer-group-localchat/blob/main/src/ingest/pipeline.py) (Ingestion pipeline), [`src/rag_service.py`](https://github.com/samosusa/beumer-group-localchat/blob/main/src/rag_service.py) (Answer orchestration), [`src/db.py`](https://github.com/samosusa/beumer-group-localchat/blob/main/src/db.py) (SQLite database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Desktop client"]
  node_renderer["Desktop interface<br/>[ChatPage.tsx]"]
  node_electron["Electron shell<br/>[ipc.ts]"]
  node_contracts["HTTP contracts<br/>[api.ts]"]
end

subgraph group_api["Python API"]
  node_api_app["FastAPI application<br/>[app.py]"]
  node_ingest_api["Upload and status API<br/>[ingest.py]"]
  node_query_api["Query API<br/>[query.py]"]
  node_projects_api["Project management<br/>[projects.py]"]
  node_conversations_api["Conversation API<br/>[conversations.py]"]
  node_health["Health endpoint<br/>[health.js]"]
end

subgraph group_ingestion["Document ingestion"]
  node_ingest_pipeline["Ingestion pipeline<br/>[pipeline.py]"]
  node_document_loader["Document parsing<br/>[loader.py]"]
  node_chunker["Text chunking<br/>[chunker.py]"]
  node_embedder["Embedding models<br/>[embedder.py]"]
  node_vector_store[("FAISS index<br/>[vector_store.py]")]
end

subgraph group_answering["RAG answering"]
  node_rag_service["Answer orchestration<br/>[rag_service.py]"]
  node_retriever["Document retrieval<br/>[retriever.py]"]
  node_llm["Local language model<br/>[llm_adapter.py]"]
end

subgraph group_state["Local state and evaluation"]
  node_database[("SQLite database<br/>[db.py]")]
  node_model_api["Model management<br/>[models.py]"]
  node_eval_api["RAG evaluation<br/>[rag_eval.py]"]
  node_embedding_api["Embedding evaluation<br/>[embeddings.py]"]
end

node_employee(("Employee"))

node_employee -->|"uses"| node_renderer
node_renderer -->|"runs in"| node_electron
node_renderer -->|"calls API"| node_api_app
node_renderer -->|"uses contract"| node_contracts
node_api_app -->|"registers routes"| node_ingest_api
node_api_app -->|"registers routes"| node_query_api
node_api_app -->|"registers routes"| node_projects_api
node_api_app -->|"registers routes"| node_conversations_api
node_ingest_api -->|"queues processing"| node_ingest_pipeline
node_ingest_pipeline -->|"chunks files"| node_chunker
node_ingest_pipeline -->|"embeds chunks"| node_embedder
node_ingest_pipeline -->|"writes vectors"| node_vector_store
node_ingest_pipeline -.->|"parses documents"| node_document_loader
node_query_api -->|"requests answer"| node_rag_service
node_rag_service -->|"retrieves context"| node_retriever
node_rag_service -->|"generates answer"| node_llm
node_retriever -->|"embeds query"| node_embedder
node_retriever -->|"searches index"| node_vector_store
node_query_api -->|"checks project"| node_projects_api
node_projects_api -->|"deletes indexes"| node_vector_store
node_conversations_api -.->|"answers messages"| node_rag_service
node_conversations_api -.->|"persists threads"| node_database
node_ingest_api -->|"tracks jobs"| node_database
node_projects_api -->|"stores projects"| node_database
node_model_api -.->|"selects model"| node_llm
node_embedding_api -->|"manages models"| node_embedder
node_eval_api -->|"evaluates answers"| node_rag_service
node_eval_api -.->|"stores results"| node_database
node_embedding_api -.->|"stores evaluations"| node_database
node_employee -.->|"checks service"| node_health

click node_renderer "https://github.com/samosusa/beumer-group-localchat/blob/main/apps/renderer/src/features/chat/ChatPage.tsx"
click node_electron "https://github.com/samosusa/beumer-group-localchat/blob/main/apps/desktop/src/main/ipc.ts"
click node_contracts "https://github.com/samosusa/beumer-group-localchat/blob/main/packages/contracts/src/api.ts"
click node_api_app "https://github.com/samosusa/beumer-group-localchat/blob/main/src/app.py"
click node_ingest_api "https://github.com/samosusa/beumer-group-localchat/blob/main/src/api/ingest.py"
click node_query_api "https://github.com/samosusa/beumer-group-localchat/blob/main/src/api/query.py"
click node_projects_api "https://github.com/samosusa/beumer-group-localchat/blob/main/src/api/projects.py"
click node_conversations_api "https://github.com/samosusa/beumer-group-localchat/blob/main/src/api/conversations.py"
click node_ingest_pipeline "https://github.com/samosusa/beumer-group-localchat/blob/main/src/ingest/pipeline.py"
click node_document_loader "https://github.com/samosusa/beumer-group-localchat/blob/main/src/ingest/loader.py"
click node_chunker "https://github.com/samosusa/beumer-group-localchat/blob/main/src/ingest/chunker.py"
click node_embedder "https://github.com/samosusa/beumer-group-localchat/blob/main/src/ingest/embedder.py"
click node_vector_store "https://github.com/samosusa/beumer-group-localchat/blob/main/src/ingest/vector_store.py"
click node_rag_service "https://github.com/samosusa/beumer-group-localchat/blob/main/src/rag_service.py"
click node_retriever "https://github.com/samosusa/beumer-group-localchat/blob/main/src/retriever.py"
click node_llm "https://github.com/samosusa/beumer-group-localchat/blob/main/src/llm_adapter.py"
click node_database "https://github.com/samosusa/beumer-group-localchat/blob/main/src/db.py"
click node_model_api "https://github.com/samosusa/beumer-group-localchat/blob/main/src/api/models.py"
click node_eval_api "https://github.com/samosusa/beumer-group-localchat/blob/main/src/api/rag_eval.py"
click node_embedding_api "https://github.com/samosusa/beumer-group-localchat/blob/main/src/api/embeddings.py"
click node_health "https://github.com/samosusa/beumer-group-localchat/blob/main/apps/health-service/src/routes/health.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_renderer,node_electron,node_contracts toneBlue
class node_api_app,node_ingest_api,node_query_api,node_projects_api,node_conversations_api,node_health toneAmber
class node_ingest_pipeline,node_document_loader,node_chunker,node_embedder,node_vector_store toneMint
class node_rag_service,node_retriever,node_llm toneRose
class node_database,node_model_api,node_eval_api,node_embedding_api,node_employee toneIndigo
```

## Components

### Desktop client

- [Desktop interface](https://github.com/samosusa/beumer-group-localchat/blob/main/apps/renderer/src/features/chat/ChatPage.tsx): `apps/renderer/src/features/chat/ChatPage.tsx`
- [Electron shell](https://github.com/samosusa/beumer-group-localchat/blob/main/apps/desktop/src/main/ipc.ts): `apps/desktop/src/main/ipc.ts`
- [HTTP contracts](https://github.com/samosusa/beumer-group-localchat/blob/main/packages/contracts/src/api.ts): `packages/contracts/src/api.ts`

### Python API

- [FastAPI application](https://github.com/samosusa/beumer-group-localchat/blob/main/src/app.py): `src/app.py`
- [Upload and status API](https://github.com/samosusa/beumer-group-localchat/blob/main/src/api/ingest.py): `src/api/ingest.py`
- [Query API](https://github.com/samosusa/beumer-group-localchat/blob/main/src/api/query.py): `src/api/query.py`
- [Project management](https://github.com/samosusa/beumer-group-localchat/blob/main/src/api/projects.py): `src/api/projects.py`
- [Conversation API](https://github.com/samosusa/beumer-group-localchat/blob/main/src/api/conversations.py): `src/api/conversations.py`
- [Health endpoint](https://github.com/samosusa/beumer-group-localchat/blob/main/apps/health-service/src/routes/health.js): `apps/health-service/src/routes/health.js`

### Document ingestion

- [Ingestion pipeline](https://github.com/samosusa/beumer-group-localchat/blob/main/src/ingest/pipeline.py): `src/ingest/pipeline.py`
- [Document parsing](https://github.com/samosusa/beumer-group-localchat/blob/main/src/ingest/loader.py): `src/ingest/loader.py`
- [Text chunking](https://github.com/samosusa/beumer-group-localchat/blob/main/src/ingest/chunker.py): `src/ingest/chunker.py`
- [Embedding models](https://github.com/samosusa/beumer-group-localchat/blob/main/src/ingest/embedder.py): `src/ingest/embedder.py`
- [FAISS index](https://github.com/samosusa/beumer-group-localchat/blob/main/src/ingest/vector_store.py): `src/ingest/vector_store.py`

### RAG answering

- [Answer orchestration](https://github.com/samosusa/beumer-group-localchat/blob/main/src/rag_service.py): `src/rag_service.py`
- [Document retrieval](https://github.com/samosusa/beumer-group-localchat/blob/main/src/retriever.py): `src/retriever.py`
- [Local language model](https://github.com/samosusa/beumer-group-localchat/blob/main/src/llm_adapter.py): `src/llm_adapter.py`

### Local state and evaluation

- [SQLite database](https://github.com/samosusa/beumer-group-localchat/blob/main/src/db.py): `src/db.py`
- [Model management](https://github.com/samosusa/beumer-group-localchat/blob/main/src/api/models.py): `src/api/models.py`
- [RAG evaluation](https://github.com/samosusa/beumer-group-localchat/blob/main/src/api/rag_eval.py): `src/api/rag_eval.py`
- [Embedding evaluation](https://github.com/samosusa/beumer-group-localchat/blob/main/src/api/embeddings.py): `src/api/embeddings.py`

### Other components

- **Employee**

## Connections

- Employee → Desktop interface: uses
- Desktop interface → Electron shell: runs in
- Desktop interface → FastAPI application: calls API
- Desktop interface → HTTP contracts: uses contract
- FastAPI application → Upload and status API: registers routes (evidence: `src/app.py`)
- FastAPI application → Query API: registers routes (evidence: `src/app.py`)
- FastAPI application → Project management: registers routes (evidence: `src/app.py`)
- FastAPI application → Conversation API: registers routes (evidence: `src/app.py`)
- Upload and status API → Ingestion pipeline: queues processing (evidence: `src/api/ingest.py`)
- Ingestion pipeline → Text chunking: chunks files (evidence: `src/ingest/pipeline.py`)
- Ingestion pipeline → Embedding models: embeds chunks (evidence: `src/ingest/pipeline.py`)
- Ingestion pipeline → FAISS index: writes vectors (evidence: `src/ingest/pipeline.py`)
- Ingestion pipeline → Document parsing: parses documents
- Query API → Answer orchestration: requests answer (evidence: `src/api/query.py`)
- Answer orchestration → Document retrieval: retrieves context (evidence: `src/rag_service.py`)
- Answer orchestration → Local language model: generates answer (evidence: `src/rag_service.py`)
- Document retrieval → Embedding models: embeds query (evidence: `src/retriever.py`)
- Document retrieval → FAISS index: searches index (evidence: `src/retriever.py`)
- Query API → Project management: checks project (evidence: `src/api/query.py`)
- Project management → FAISS index: deletes indexes (evidence: `src/api/projects.py`)
- Conversation API → Answer orchestration: answers messages
- Conversation API → SQLite database: persists threads
- Upload and status API → SQLite database: tracks jobs (evidence: `src/api/ingest.py`)
- Project management → SQLite database: stores projects (evidence: `src/api/projects.py`)
- Model management → Local language model: selects model
- Embedding evaluation → Embedding models: manages models (evidence: `src/api/embeddings.py`)
- RAG evaluation → Answer orchestration: evaluates answers (evidence: `src/api/rag_eval.py`)
- RAG evaluation → SQLite database: stores results (evidence: `src/api/rag_eval.py`)
- Embedding evaluation → SQLite database: stores evaluations (evidence: `src/api/embeddings.py`)
- Employee → Health endpoint: checks service
