# dmayboroda/minima architecture

> Architecture diagram of the GitHub repository dmayboroda/minima, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dmayboroda/minima
- Repository: https://github.com/dmayboroda/minima

## Overview

##### Project Type and Purpose
- Minima is a modular, on-premises Retrieval-Augmented Generation (RAG) platform delivered as a set of Docker containers. It supports fully local LLMs (via Ollama), ChatGPT integration (Custom GPT), or Anthropic Claude (MCP).
- Core use case: index local documents, embed them, re-rank, and answer user queries via web UI (React), desktop UI (Electron), or MCP (Claude app/GitHub Copilot).

##### File-Structure Analysis
- Top-level containers orchestrated by three Docker Compose files:
- docker-compose-ollama.yml
- docker-compose-chatgpt.yml
- docker-compose-mcp.yml
- Components / microservices:
- chat/      → React web chat UI
- electron/  → Electron desktop UI
- indexer/   → Document ingestion, embedding, vector storage
- linker/    → (If used) connects question → answer sockets
- llm/       → Core RAG: async queues, reranker, LLM chain
- mcp-server/→ MCP (Claude) interface for Copilot/Claude Desktop
- Shared config: .env (LOCAL_FILES_PATH, model IDs, credentials)
- Orchestration helper scripts: run.sh, run_in_copilot.sh

##### README Insights
- Describes three deployment modes and environment variables.
- Emphasizes on-prem vs. ChatGPT vs. Claude.
- Mentions Firebase-based authentication for Custom GPT.
- Electron app as fully-local desktop client.
- MCP integration via uv/MCP server.

##### Detail
- Container as a component.
- Shared .env injecting configuration into all services.
- Optional paths (ChatGPT branch vs. Ollama branch vs. MCP branch)
- Port numbers where relevant (3000, service ports).
- Document async queue messaging and the vector store as first-class entities.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Orchestration & Config
    DC["Docker Compose\n(ollama, chatgpt, mcp)"]:::config
    ENV[".env"]:::config
    RUNSH["run.sh / run_in_copilot.sh"]:::config

    %% UI Layer
    subgraph "UI Layer"
        React["React Chat App\n(chat:3000)"]:::ui
        Electron["Electron Desktop App"]:::ui
    end

    %% Services Layer
    subgraph "Services Layer"
        Indexer["Indexer Service\n(indexer/app.py)"]:::service
        Linker["Linker Service\n(linker/app.py)"]:::service
        LLM["LLM Service\n(llm/app.py)"]:::service
        MCP["MCP-Server\n(mcp-server/server.py)"]:::service
    end

    %% Data & External Layer
    subgraph "Data & External"
        Queue["Async Queue"]:::datastore
        VectorDB["Vector Store\n(Qdrant / Storage)"]:::datastore
        Ollama["Ollama\n(Local LLM)"]:::external
        ChatGPT["ChatGPT API"]:::external
        Claude["Anthropic Claude"]:::external
    end

    %% Connections: Orchestration to Components
    DC --> React
    DC --> Electron
    DC --> Indexer
    DC --> Linker
    DC --> LLM
    DC --> MCP
    DC --> ENV
    DC --> RUNSH

    %% UI to LLM
    React -->|"HTTP / WS"| LLM
    Electron -->|"IPC / WS"| LLM

    %% LLM Workflow
    LLM -->|"publish"| Queue
    Queue --> Linker
    Linker --> Indexer
    Indexer -->|"query"| VectorDB
    VectorDB --> Indexer
    Indexer -->|"results"| LLM
    LLM -->|"rerank & context"| Ollama
    LLM -->|"rerank & context"| ChatGPT
    LLM -->|"rerank & context"| Claude
    Ollama --> LLM
    ChatGPT --> LLM
    Claude --> LLM

    %% LLM to UI
    LLM --> React
    LLM --> Electron

    %% MCP proxy
    MCP -->|"uv"| LLM

    %% Click Events
    click React "https://github.com/dmayboroda/minima/tree/main/chat/"
    click Electron "https://github.com/dmayboroda/minima/tree/main/electron/"
    click Indexer "https://github.com/dmayboroda/minima/tree/main/indexer/"
    click Linker "https://github.com/dmayboroda/minima/tree/main/linker/"
    click LLM "https://github.com/dmayboroda/minima/tree/main/llm/"
    click MCP "https://github.com/dmayboroda/minima/tree/main/mcp-server/"

    %% Styles
    classDef ui fill:#D0E1FF,stroke:#333,stroke-width:1px
    classDef service fill:#D0FFD6,stroke:#333,stroke-width:1px
    classDef external fill:#FFD6A5,stroke:#333,stroke-width:1px
    classDef config fill:#E0E0E0,stroke:#333,stroke-width:1px
    classDef datastore fill:#FFF4C1,stroke:#333,stroke-width:1px
```
