# eriktromp/ragmeup architecture

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

- Interactive diagram: https://gitdiagram.com/eriktromp/ragmeup
- Repository: https://github.com/eriktromp/ragmeup

## Overview

##### Project type and purpose
- RAGMeUp is a full-stack, modular RAG (Retrieval-Augmented Generation) framework.
- The Python “server” directory implements your RAG logic (chunkers, retrievers, LAG orchestration, LLM calls, provenance).
- The “ui/scala” directory is a Play Framework front-end delivering a web app and calling the Python API.
- A PostgreSQL container provides the vector-enabled storage and user data persistence.

##### File structure
- Top-level:
- postgres/ – Dockerfile for a Postgres instance (likely with pgvector extension)
- server/ – Python RAG server with Dockerfile, .env template, and modules:
– LLMHelper.py, RAGHelper.py, ParagraphChunker.py, PostgresHybridRetriever.py, Reranker.py, provenance.py, server.py
- ui/scala/ – Play Framework app:
– app/controllers (HomeController.scala)
– app/models/daos (ChatDAO, FeedbackDAO)
– app/models/SQLTables.scala
– conf/routes, application.conf, evolutions (DB migrations)
– public assets (JS/CSS), views (.scala.html)
– build.sbt, plugins.sbt, build.properties
- Patterns:
- Two separate services (Scala frontend, Python backend) communicating over HTTP
- Modular “server” code adopting plug-in pattern for chunkers/retrievers/LLM
- Play’s MVC for UI, DAOs for data access, migrations under conf/evolutions

##### README for additional insights
- Modularity (“Use your own chunkers, vectorstores or retrievers”)
- Quickstart: spin up Python server and SBT UI separately
- Docs mention API references and architecture guides

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Layer
    Browser["Browser / End-user"]:::frontend

    %% Frontend Layer
    subgraph "Frontend Layer"
        PlayServer["Play Framework Web Server"]:::frontend

        subgraph "MVC Components"
            Controllers["HomeController.scala"]:::frontend
            DAOsChat["ChatDAO.scala"]:::frontend
            DAOsFeedback["FeedbackDAO.scala"]:::frontend
            SQLTables["SQLTables.scala"]:::frontend
            Views["*.scala.html (Twirl Templates)"]:::frontend
        end

        subgraph "Config & Assets"
            Routes["conf/routes"]:::frontend
            ConfApp["conf/application.conf"]:::frontend
            Evolutions["conf/evolutions/ragmeup/1.sql"]:::frontend
            AssetsJS["public/javascripts/main.js"]:::frontend
            AssetsCSS["public/stylesheets/main.css"]:::frontend
            BuildCfg["build.sbt / plugins.sbt / build.properties"]:::frontend
        end
    end

    %% Backend Layer
    subgraph "Python RAG Server" 
        ServerPy["server.py (API Entry Point)"]:::backend
        LLMHelper["LLMHelper.py"]:::backend
        RAGHelper["RAGHelper.py"]:::backend
        Chunker["ParagraphChunker.py"]:::backend
        Retriever["PostgresHybridRetriever.py"]:::backend
        Reranker["Reranker.py"]:::backend
        Provenance["provenance.py"]:::backend
        EnvDeps["requirements.txt /.env.template / Dockerfile"]:::backend
    end

    %% Database
    Postgres["PostgreSQL Vector Store"]:::db

    %% External Service
    LLMService["External LLM Service"]:::external

    %% Connections
    Browser -->|HTTP request| PlayServer
    PlayServer -->|"JSON /chat"| ServerPy
    ServerPy -->|"SQL + VECTOR query"| Retriever
    Retriever -->|"exec SQL"| Postgres
    ServerPy -->|"calls LLM"| LLMHelper
    LLMHelper -->|"HTTP API"| LLMService
    ServerPy -->|"log / persist"| DAOsChat
    ServerPy -->|"log feedback"| DAOsFeedback
    DAOsChat -->|"SQL insert"| Postgres
    DAOsFeedback -->|"SQL insert"| Postgres
    ServerPy -->|"return JSON"| PlayServer
    PlayServer -->|"render HTML/JS"| Browser

    %% Click Events
    click PlayServer "https://github.com/eriktromp/ragmeup/tree/main/ui/scala"
    click Controllers "https://github.com/eriktromp/ragmeup/blob/main/ui/scala/app/controllers/HomeController.scala"
    click DAOsChat "https://github.com/eriktromp/ragmeup/blob/main/ui/scala/app/models/daos/ChatDAO.scala"
    click DAOsFeedback "https://github.com/eriktromp/ragmeup/blob/main/ui/scala/app/models/daos/FeedbackDAO.scala"
    click SQLTables "https://github.com/eriktromp/ragmeup/blob/main/ui/scala/app/models/SQLTables.scala"
    click Views "https://github.com/eriktromp/ragmeup/tree/main/ui/scala/app/views"
    click Routes "https://github.com/eriktromp/ragmeup/tree/main/ui/scala/conf/routes"
    click ConfApp "https://github.com/eriktromp/ragmeup/blob/main/ui/scala/conf/application.conf"
    click Evolutions "https://github.com/eriktromp/ragmeup/blob/main/ui/scala/conf/evolutions/ragmeup/1.sql"
    click AssetsJS "https://github.com/eriktromp/ragmeup/blob/main/ui/scala/public/javascripts/main.js"
    click AssetsCSS "https://github.com/eriktromp/ragmeup/blob/main/ui/scala/public/stylesheets/main.css"
    click BuildCfg "https://github.com/eriktromp/ragmeup/blob/main/ui/scala/build.sbt"
    click ServerPy "https://github.com/eriktromp/ragmeup/blob/main/server/server.py"
    click LLMHelper "https://github.com/eriktromp/ragmeup/blob/main/server/LLMHelper.py"
    click RAGHelper "https://github.com/eriktromp/ragmeup/blob/main/server/RAGHelper.py"
    click Chunker "https://github.com/eriktromp/ragmeup/blob/main/server/ParagraphChunker.py"
    click Retriever "https://github.com/eriktromp/ragmeup/blob/main/server/PostgresHybridRetriever.py"
    click Reranker "https://github.com/eriktromp/ragmeup/blob/main/server/Reranker.py"
    click Provenance "https://github.com/eriktromp/ragmeup/blob/main/server/provenance.py"
    click EnvDeps "https://github.com/eriktromp/ragmeup/blob/main/server/requirements.txt"
    click EnvDeps "https://github.com/eriktromp/ragmeup/blob/main/server/.env.template"
    click EnvDeps "https://github.com/eriktromp/ragmeup/tree/main/server/Dockerfile"
    click Postgres "https://github.com/eriktromp/ragmeup/tree/main/postgres/Dockerfile"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366D6,color:#0366D6;
    classDef backend  fill:#E6F4EA,stroke:#22863A,color:#22863A;
    classDef db       fill:#FFF5B1,stroke:#DBAB09,color:#735C0F;
    classDef external fill:#FEE2E2,stroke:#D73A49,color:#D73A49;
```
