# atharvvvg/llmrepo architecture

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

- Interactive diagram: https://gitdiagram.com/atharvvvg/llmrepo
- Repository: https://github.com/atharvvvg/llmrepo

## Overview

##### Project type and purpose
- Full‑stack web application.
- Purpose: Provide a chat‑style Q&A, summarization, and insights interface over GitHub repos by combining a React frontend, a FastAPI backend, Google’s Gemini LLM, and the GitHub API.

##### File structure
- Top level
- main.py (orchestrator script to launch both frontend and backend)
- requirements.txt / package-lock.json (dep lists)
- backend/ (FastAPI code)
- frontend/ (Vite + React code)
- backend/
- main.py – FastAPI app, endpoints for repo Q&A, summarization, etc.
- frontend/
- src/ – React components (App.jsx, pages, CodeViewer, RepoFileTree, etc.)
- public/, vite.config.js – dev server config

##### README for additional insights
- Core technologies: React.js frontend, Python FastAPI backend
- External dependencies: Gemini LLM API, GitHub API
- Environment variables: GEMINI_API_KEY, GITHUB_TOKEN
- Launch options: unified script vs. manual startup

##### Main components and interactions
a. Components
- User’s web browser (UI)
- React frontend (Vite dev server in dev, static files in prod)
- FastAPI backend (uvicorn)
- Gemini LLM service (external)
- GitHub REST API (external)
- Orchestrator (main.py at repo root)
b. Relationships & data flow
1. User issues query in React UI
2. UI → HTTP POST → FastAPI endpoint (e.g., /api/query)
3. FastAPI fetches code/metadata from GitHub API
4. FastAPI sends prompt and code context to Gemini API
5. Gemini returns analysis/answer
6. FastAPI returns JSON response to UI
7. UI displays result
c. Architectural patterns/design principles
- Separation of concerns: UI vs. API vs. external services
- Thin client (React) + RESTful backend (FastAPI)
- Environment-based configuration via .env
d. Key technologies
- React.js, Vite, JSX
- Python 3.10+, FastAPI, uvicorn
- Google Gemini API
- GitHub REST API

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        Browser["User’s Browser"]:::ui
        subgraph "React Application"
            Entry["main.jsx"]:::frontend
            Shell["App.jsx"]:::frontend
            subgraph "Components"
                QueryInput["QueryInput.jsx"]:::ui
                RepoFileTree["RepoFileTree.jsx"]:::ui
                CodeViewer["CodeViewer.jsx"]:::ui
                HeaderComp["Header.jsx"]:::ui
                FooterComp["Footer.jsx"]:::ui
            end
            subgraph "Pages"
                HomePage["Home.jsx"]:::ui
                AboutPage["About.jsx"]:::ui
                RepoViewPage["RepoView.jsx"]:::ui
            end
        end
        StaticAssets["public"]:::asset
        FEConfig["package.json"]:::config
        ViteConfig["vite.config.js"]:::config
    end

    %% Backend Layer
    subgraph "Backend Layer"
        Orchestrator["main.py"]:::backend
        subgraph "FastAPI Service"
            BackendApp["backend/main.py"]:::backend
            subgraph "Modules"
                HTTPController["HTTP Controller Module"]:::backend
                GitHubClient["GitHub Client Module"]:::backend
                LLMIntegration["LLM Integration Module"]:::backend
            end
        end
        PyReqs["requirements.txt"]:::config
        Lockfile["package-lock.json"]:::config
        EnvConfig[".env"]:::config
    end

    %% External Services
    subgraph "External Services"
        GitHubAPI["GitHub REST API"]:::external
        GeminiAPI["Gemini LLM API"]:::external
    end

    %% Data Flows
    Browser -->|loads| Entry
    Entry --> Shell
    Shell --> QueryInput
    Shell --> RepoFileTree
    Shell --> CodeViewer
    Shell --> HomePage
    Shell --> AboutPage
    Shell --> RepoViewPage

    QueryInput -->|POST /api/query| BackendApp
    RepoFileTree -->|GET /api/repo| BackendApp
    CodeViewer -->|renders code| Shell

    BackendApp -->|uses| HTTPController
    HTTPController -->|calls| GitHubClient
    GitHubClient -->|fetch code| GitHubAPI
    HTTPController -->|calls| LLMIntegration
    LLMIntegration -->|send prompt| GeminiAPI
    GeminiAPI -->|response| LLMIntegration
    LLMIntegration -->|reply| HTTPController
    HTTPController -->|response JSON| Shell

    Orchestrator -->|launches| BackendApp
    Orchestrator -->|launches| Entry

    BackendApp -->|reads| EnvConfig
    BackendApp -->|installs| PyReqs

    %% Click Events
    click Orchestrator "https://github.com/atharvvvg/llmrepo/blob/master/main.py"
    click BackendApp "https://github.com/atharvvvg/llmrepo/blob/master/backend/main.py"
    click PyReqs "https://github.com/atharvvvg/llmrepo/blob/master/requirements.txt"
    click Lockfile "https://github.com/atharvvvg/llmrepo/blob/master/package-lock.json"
    click Entry "https://github.com/atharvvvg/llmrepo/blob/master/frontend/src/main.jsx"
    click Shell "https://github.com/atharvvvg/llmrepo/blob/master/frontend/src/App.jsx"
    click ViteConfig "https://github.com/atharvvvg/llmrepo/blob/master/frontend/vite.config.js"
    click QueryInput "https://github.com/atharvvvg/llmrepo/blob/master/frontend/src/components/QueryInput.jsx"
    click RepoFileTree "https://github.com/atharvvvg/llmrepo/blob/master/frontend/src/components/RepoFileTree.jsx"
    click CodeViewer "https://github.com/atharvvvg/llmrepo/blob/master/frontend/src/components/CodeViewer.jsx"
    click HeaderComp "https://github.com/atharvvvg/llmrepo/blob/master/frontend/src/components/Header.jsx"
    click FooterComp "https://github.com/atharvvvg/llmrepo/blob/master/frontend/src/components/Footer.jsx"
    click HomePage "https://github.com/atharvvvg/llmrepo/blob/master/frontend/src/pages/Home.jsx"
    click AboutPage "https://github.com/atharvvvg/llmrepo/blob/master/frontend/src/pages/About.jsx"
    click RepoViewPage "https://github.com/atharvvvg/llmrepo/blob/master/frontend/src/pages/RepoView.jsx"
    click StaticAssets "https://github.com/atharvvvg/llmrepo/tree/master/frontend/public"
    click FEConfig "https://github.com/atharvvvg/llmrepo/blob/master/frontend/package.json"

    %% Styles
    classDef ui fill:#AED6F1,stroke:#1F618D;
    classDef frontend fill:#D6EAF8,stroke:#2874A6;
    classDef backend fill:#D5F5E3,stroke:#239B56;
    classDef config fill:#E5E7E9,stroke:#7B7D7D;
    classDef asset fill:#F5EEF8,stroke:#8E44AD;
    classDef external fill:#FAD7A0,stroke:#D68910;
```
