# rsrini7/support-buddy architecture

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

- Interactive diagram: https://gitdiagram.com/rsrini7/support-buddy
- Repository: https://github.com/rsrini7/support-buddy

## Overview

##### Project type and purpose
- This is a full-stack, containerized Retrieval-Augmented Generation (RAG) application called “Support Buddy.”
- Purpose: Ingest support data (Outlook MSG files, Jira tickets, Confluence pages, StackOverflow Q&A), index it in a vector store (ChromaDB or FAISS), and serve a unified semantic-search UI with LLM-powered summaries and recommendations.

##### File structure
- Top-level directories:
- backend/ – Python FastAPI service, ingestion pipelines, RAG and embedding logic
- frontend/ – React + Material-UI SPA
- confluence-config/ and jira-config/ – XML configs for local Confluence and Jira testing
- docker-compose.yml – orchestrates backend, ChromaDB server, frontend
- backend/app/services: individual modules for msg_parser, jira_service, confluence_service, stackoverflow_service, unified_rag_service, vector_service, etc.
- backend/app/utils: BM25, DSPy utils, deduplication, retrievers, rerankers
- Environment & build scripts: Dockerfile, start_frontend.sh, start_backend.sh, start_chromadb_server.sh/ps1, set_venv.sh

##### README for additional insights
- Core stacks: FastAPI, React, ChromaDB/FAISS, DSPy (for LLM orchestration), Docker.
- Detailed RAG pipeline: BM25 + vector hybrid, deduplication, reranking (CrossEncoder), LLM generation via DSPy/OpenRouter.

##### Detail
- Break the API container down to its main sub-components.
- DSPy integration explicitly in the retrieval pipeline.
- Hybrid retrieval (vector + BM25) branching.
- Runtime switch for ChromaDB vs FAISS using a decision diamond or note.

## Diagram (Mermaid)

```mermaid
graph TB
    %% External User
    User["User"]:::external

    %% Frontend Layer
    subgraph "Frontend Layer"
        UI["Frontend SPA (React + Material-UI)"]:::frontend
    end

    User -->|uses| UI

    %% Backend Layer
    subgraph "Backend Layer"
        API["Backend API (FastAPI)"]:::backend

        subgraph "Ingestion Services"
            MSG["MSG Parser"]:::service
            JiraTicket["Jira Service"]:::service
            ConfluencePage["Confluence Service"]:::service
            SOQA["StackOverflow Service"]:::service
        end

        subgraph "RAG Pipeline"
            HybridRetriever["Hybrid Retriever (Vector+BM25)"]:::pipeline
            Dedup["Deduplication"]:::pipeline
            Rerank["Neural Reranker"]:::pipeline
            DSPy["DSPy LLM Orchestrator"]:::llm
        end

        subgraph "Vector DB Abstraction"
            Chroma["ChromaClient"]:::db
            FAISS["FaissClient"]:::db
        end

        %% Backend interactions
        UI -->|REST calls| API
        API -->|ingest| MSG
        API -->|ingest| JiraTicket
        API -->|ingest| ConfluencePage
        API -->|ingest| SOQA
        API -->|search| HybridRetriever
        HybridRetriever -->|results| Dedup
        Dedup -->|filtered| Rerank
        Rerank -->|ranked| DSPy
        DSPy -->|response| API
        API -->|vector ops| Chroma
        API -->|vector ops| FAISS
    end

    %% External Systems
    subgraph "External Systems"
        Outlook["Outlook MSG Files"]:::external
        JiraSys["Jira Server/Data Center"]:::external
        ConfluenceSys["Confluence Server/Data Center"]:::external
        StackOverflow["StackOverflow API"]:::external
        OpenRouter["OpenRouter (LLM Provider)"]:::external
    end

    %% External interactions
    MSG -->|reads| Outlook
    JiraTicket -->|calls| JiraSys
    ConfluencePage -->|calls| ConfluenceSys
    SOQA -->|calls| StackOverflow
    DSPy -->|calls| OpenRouter

    %% Docker Compose Orchestration
    Docker["docker-compose"]:::infra
    Docker --> UI
    Docker --> API
    Docker --> Chroma

    %% Click Events
    click UI "https://github.com/rsrini7/support-buddy/tree/main/frontend/"
    click API "https://github.com/rsrini7/support-buddy/blob/main/backend/app/main.py"
    click MSG "https://github.com/rsrini7/support-buddy/blob/main/backend/app/services/msg_parser.py"
    click JiraTicket "https://github.com/rsrini7/support-buddy/blob/main/backend/app/services/jira_service.py"
    click ConfluencePage "https://github.com/rsrini7/support-buddy/blob/main/backend/app/services/confluence_service.py"
    click SOQA "https://github.com/rsrini7/support-buddy/blob/main/backend/app/services/stackoverflow_service.py"
    click Chroma "https://github.com/rsrini7/support-buddy/blob/main/backend/app/services/chroma_client.py"
    click FAISS "https://github.com/rsrini7/support-buddy/blob/main/backend/app/services/faiss_client.py"
    click HybridRetriever "https://github.com/rsrini7/support-buddy/blob/main/backend/app/utils/rag_pipeline.py"
    click Dedup "https://github.com/rsrini7/support-buddy/blob/main/backend/app/services/deduplication_utils.py"
    click Rerank "https://github.com/rsrini7/support-buddy/blob/main/backend/app/services/rerank_service.py"
    click DSPy "https://github.com/rsrini7/support-buddy/blob/main/backend/app/utils/dspy_utils.py"

    %% Styles
    classDef external fill:#cccccc,stroke:#333,stroke-width:1px
    classDef frontend fill:#80bfff,stroke:#333,stroke-width:1px
    classDef backend fill:#b3ffb3,stroke:#333,stroke-width:1px
    classDef service fill:#d9f2d9,stroke:#333,stroke-width:1px
    classDef pipeline fill:#ffe0b3,stroke:#333,stroke-width:1px
    classDef db fill:#ffcc80,stroke:#333,stroke-width:1px
    classDef llm fill:#d6b3ff,stroke:#333,stroke-width:1px
    classDef infra fill:#ff9999,stroke:#333,stroke-width:1px
```
