# abheytiwari/quizard architecture

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

- Interactive diagram: https://gitdiagram.com/abheytiwari/quizard
- Repository: https://github.com/abheytiwari/quizard

## Overview

##### Project type and purpose
- Quizard is a full-stack AI-powered PDF Q&A tool. Users upload a PDF via a Streamlit frontend, which calls a FastAPI backend. The backend extracts text with PyMuPDF, optionally computes embeddings, and issues queries to Google Gemini to generate answers.

##### File structure
- Top-level:
- README.md
- backend/
– main.py (FastAPI app entrypoint)
– embeddings.py (text vectorization logic)
– llm.py (wrapper for Google Gemini API calls)
– utils.py (PDF extraction, logging, config loaders)
– requirements.txt
- frontend/
– app.py (Streamlit UI)
- No separate data-persistence layer (embeddings likely in-memory or ephemeral).
- Deployment uses Uvicorn for the API and Streamlit’s server for the UI.

##### README for additional insights
- Tech stack: FastAPI + Uvicorn (backend), Streamlit (frontend), PyMuPDF for PDF parsing, Google Gemini as the LLM.
- Usage pattern: Upload → Extract → Embed → Query LLM → Return answer & logs in real time.
- Future plans hint at adding vector DBs, OCR, mobile UIs.

##### Elements
- Optionally, group related modules in a shaded “Backend” container.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        UI["Streamlit UI"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        API["FastAPI API"]:::backend
        PDF["PDF Processor<br>(PyMuPDF)"]:::backend
        EMB["Embedding Service"]:::backend
        LLM["LLM Service<br>(Google Gemini)"]:::backend
    end

    %% External Services
    Gemini["Google Gemini"]:::external

    %% Future Components
    VDB["Future Vector DB"]:::future

    %% Data Flow
    UI -->|"POST /upload PDF"| API
    API -->|"extract PDF"| PDF
    PDF -->|"raw text"| EMB
    EMB -->|"embeddings"| LLM
    EMB -.->|"store embeddings"| VDB
    LLM -->|"LLM query"| Gemini
    Gemini -->|"answer"| LLM
    LLM -->|"formatted answer"| API
    API -->|"response"| UI

    %% Click Events
    click UI "https://github.com/abheytiwari/quizard/blob/main/frontend/app.py"
    click API "https://github.com/abheytiwari/quizard/blob/main/backend/main.py"
    click PDF "https://github.com/abheytiwari/quizard/blob/main/backend/utils.py"
    click EMB "https://github.com/abheytiwari/quizard/blob/main/backend/embeddings.py"
    click LLM "https://github.com/abheytiwari/quizard/blob/main/backend/llm.py"

    %% Styles
    classDef frontend fill:#D6EAFE,stroke:#0366d6,stroke-width:1px
    classDef backend fill:#D5E8D4,stroke:#2E7D32,stroke-width:1px
    classDef external fill:#FFE6CC,stroke:#E65100,stroke-width:1px
    classDef future fill:#F5F5F5,stroke:#9E9E9E,stroke-dasharray: 5 5
```
