# nthperson/comp-380_group_project architecture

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

- Interactive diagram: https://gitdiagram.com/nthperson/comp-380_group_project
- Repository: https://github.com/nthperson/comp-380_group_project

## Overview

##### Project Type and Purpose
- RezuMe is a full-stack, single-page application built with React on the frontend and Flask on the backend.
- It helps job seekers tailor PDF resumes to specific job descriptions by combining user-uploaded resumes, job description scraping/parsing, keyword selection, and AI-powered resume generation.

##### High-Level Architectural Components
- Frontend (React SPA)
- Components folder with Pages, Helpers, Context providers
- Services layer that wraps API calls via Axios
- Backend (Flask REST API)
- `app.py` exposes endpoints for authentication, PDF upload/listing, JD scraping/parsing, resume generation
- Utility modules for PDF handling, LLM calls (`llm_utils.py`), embedding store (`embeddings_db.py`), Firebase integration
- Local `embeddings.db` and CSV for skill lists
- External Services
- Firebase Authentication, Firestore (metadata), Cloud Storage (PDFs)
- Google Generative AI SDK (Gemini 1.5 Flash) / OpenAI API
- Data Stores
- Firebase services (primary user data & PDFs)
- SQLite-style embeddings database (for local semantic similarity operations)

##### Relationships and Interactions
- The React app obtains a Firebase ID token on login and attaches it as a Bearer token on every request.
- Frontend service modules call backend endpoints (e.g., `/api/upload_pdf`, `/api/jd_from_url`, `/api/generate_targeted_resume`).
- `verify_firebase_token` in the backend validates the token against Firebase Auth for protected routes.
- PDF upload/download flows go through `pdf_utils.py` → Firebase Storage.
- Resume metadata and user profiles are stored/fetched via Firestore wrappers (`user_profile_utils.py`).
- Job description scraping (via `JobDescriptionScraper.py` or URL scrapers) feeds into LLM prompt construction.
- Resume generation endpoint uses `llm_utils.py` to call the Gemini/OpenAI API and returns HTML to the frontend for editing.
- The backend also supports similarity searches against the embeddings database for keyword suggestions.

##### Key Architectural Patterns and Design Principles
- Clear separation of concerns:
- Presentation layer (React components and contexts)
- API layer (Flask routes)
- Business logic and utilities (PDF parsing, LLM prompting)
- Data layer (Firebase + local embeddings)
- Modular code organization: each major feature has its own utility module and corresponding frontend service.
- Stateless backend: each request is independently authenticated and processed.
- Service-oriented frontend: React service modules abstract away REST calls from components.
- Use of contexts in React for cross-cutting state (e.g., PDF context, targeted-resume context).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend (React SPA)"
        direction TB
        ReactSPA["React SPA"]:::frontend
        UIComponents["UI Components"]:::frontend
        PdfContext["PdfContext"]:::frontend
        TargetedResumeContext["TargetedResumeContext"]:::frontend
        ServicesLayer["Service Layer"]:::frontend
        AuthService["Auth Service"]:::frontend
        JDService["JobDescription Service"]:::frontend
        KeywordService["Keyword Service"]:::frontend
        ProfileService["Profile Service"]:::frontend
        ResumeService["Resume Service"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend (Flask API)"
        direction TB
        FlaskAPI["Flask API Gateway (app.py)"]:::backend
        VerifyToken["verify_firebase_token"]:::backend
        FirebaseConfig["Firebase Config"]:::backend
        subgraph "Business Logic"
            direction TB
            PDFUtils["pdf_utils.py"]:::backend
            JobDescScraper["JobDescriptionScraper.py"]:::backend
            JDUtils["jd_utils.py"]:::backend
            LLMUtils["llm_utils.py"]:::backend
            GeminiUtils["gemini_utils.py"]:::backend
            EmbeddingsDBModule["embeddings_db.py"]:::backend
            InspectEmbeddings["inspect_embeddings.py"]:::backend
            KeywordUtils["keyword_utils.py"]:::backend
            ResumeUtils["resume_utils.py"]:::backend
            UserProfileUtils["user_profile_utils.py"]:::backend
        end
    end

    %% External & Data Layer
    subgraph "External & Data Stores"
        direction TB
        FirebaseAuth["Firebase Auth"]:::external
        Firestore["Firestore"]:::external
        FirebaseStorage["Cloud Storage"]:::external
        EmbeddingsDBFile["embeddings.db"]:::datastore
        SkillsCSV["skills.csv"]:::datastore
        ExternalLLM["OpenAI/Gemini API"]:::external
    end

    %% Relationships
    ReactSPA -->|"uses components"| UIComponents
    UIComponents --> PdfContext
    UIComponents --> TargetedResumeContext
    ReactSPA --> ServicesLayer
    ServicesLayer --> AuthService
    ServicesLayer --> JDService
    ServicesLayer --> KeywordService
    ServicesLayer --> ProfileService
    ServicesLayer --> ResumeService

    AuthService -->|"calls /api/auth"| FlaskAPI
    JDService -->|"calls /api/jd_from_url"| FlaskAPI
    KeywordService -->|"calls /api/keywords"| FlaskAPI
    ProfileService -->|"calls /api/profile"| FlaskAPI
    ResumeService -->|"calls /api/generate_targeted_resume"| FlaskAPI

    FlaskAPI --> VerifyToken
    VerifyToken --> FirebaseAuth

    FlaskAPI --> FirebaseConfig

    FlaskAPI --> PDFUtils
    PDFUtils --> FirebaseStorage

    FlaskAPI --> UserProfileUtils
    UserProfileUtils --> Firestore

    FlaskAPI --> JobDescScraper
    JobDescScraper --> JDUtils

    FlaskAPI --> LLMUtils
    LLMUtils --> GeminiUtils
    LLMUtils --> ExternalLLM

    FlaskAPI --> EmbeddingsDBModule
    EmbeddingsDBModule --> EmbeddingsDBFile
    EmbeddingsDBModule --> InspectEmbeddings
    EmbeddingsDBModule --> KeywordUtils
    KeywordUtils --> SkillsCSV

    FlaskAPI --> ResumeUtils

    %% Click Events
    click ReactSPA "https://github.com/nthperson/comp-380_group_project/tree/test/frontend/src"
    click UIComponents "https://github.com/nthperson/comp-380_group_project/tree/test/frontend/src/Components"
    click PdfContext "https://github.com/nthperson/comp-380_group_project/blob/test/frontend/src/Components/PdfContext.js"
    click TargetedResumeContext "https://github.com/nthperson/comp-380_group_project/blob/test/frontend/src/Components/TargetedResumeContext.js"
    click AuthService "https://github.com/nthperson/comp-380_group_project/blob/test/frontend/src/services/authHandlers.js"
    click JDService "https://github.com/nthperson/comp-380_group_project/blob/test/frontend/src/services/jobDescriptionService.js"
    click KeywordService "https://github.com/nthperson/comp-380_group_project/blob/test/frontend/src/services/keywordService.js"
    click ProfileService "https://github.com/nthperson/comp-380_group_project/blob/test/frontend/src/services/profileService.js"
    click ResumeService "https://github.com/nthperson/comp-380_group_project/blob/test/frontend/src/services/resumeService.js"
    click FlaskAPI "https://github.com/nthperson/comp-380_group_project/blob/test/backend/app.py"
    click VerifyToken "https://github.com/nthperson/comp-380_group_project/blob/test/backend/verify_token.py"
    click FirebaseConfig "https://github.com/nthperson/comp-380_group_project/blob/test/backend/firebase_config.py"
    click PDFUtils "https://github.com/nthperson/comp-380_group_project/blob/test/backend/pdf_utils.py"
    click JobDescScraper "https://github.com/nthperson/comp-380_group_project/blob/test/backend/JobDescriptionScraper.py"
    click JDUtils "https://github.com/nthperson/comp-380_group_project/blob/test/backend/jd_utils.py"
    click LLMUtils "https://github.com/nthperson/comp-380_group_project/blob/test/backend/llm_utils.py"
    click GeminiUtils "https://github.com/nthperson/comp-380_group_project/blob/test/backend/gemini_utils.py"
    click EmbeddingsDBModule "https://github.com/nthperson/comp-380_group_project/blob/test/backend/embeddings_db.py"
    click InspectEmbeddings "https://github.com/nthperson/comp-380_group_project/blob/test/backend/inspect_embeddings.py"
    click KeywordUtils "https://github.com/nthperson/comp-380_group_project/blob/test/backend/keyword_utils.py"
    click ResumeUtils "https://github.com/nthperson/comp-380_group_project/blob/test/backend/resume_utils.py"
    click UserProfileUtils "https://github.com/nthperson/comp-380_group_project/blob/test/backend/user_profile_utils.py"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366D6,color:#0366D6;
    classDef backend fill:#E6FFEB,stroke:#28A745,color:#28A745;
    classDef external fill:#FFE8E8,stroke:#D73A49,color:#D73A49;
    classDef datastore fill:#FFF5E5,stroke:#DBAB09,color:#DBAB09;
```
