# taseskics/cvlens architecture

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

- Interactive diagram: https://gitdiagram.com/taseskics/cvlens
- Repository: https://github.com/taseskics/cvlens

## Overview

##### Project Purpose and Type
- CVLens is a full-stack web application that enables users to upload a resume and have its information parsed using a machine learning model.
- Its core components include a Next.js frontend for the user interface, a FastAPI backend for file handling and S3 integration, and AWS services (ECS Fargate, S3, API Gateway, and Lambda) that trigger machine learning model processing.

##### Main Components of the System
- Frontend (Next.js):
- Represents the user interaction layer.
- Includes pages for uploading resumes, viewing API documentation, and other static pages (e.g., "about-us").
- Backend (FastAPI in Python):
- Receives file uploads from the frontend.
- Processes the file by uploading it to AWS S3.
- Exposes endpoints (like /process-resume and /parsedData) for further data retrieval by the frontend.
- AWS S3 Bucket:
- Acts as the storage layer for uploaded resumes.
- Triggers the next steps in the data processing flow by sending data to the API Gateway.
- API Gateway & AWS Lambda:
- API Gateway triggers Lambda functions when new data is available from S3.
- Lambda functions interface with the machine learning component.
- Machine Learning Model:
- Processes data received from the Lambda function.
- Performs analysis, extracts resume data, and returns the processed results.

##### Architectural Patterns and Design Principles
- The project cleanly separates concerns between the frontend and backend.
- Uses a serverless approach to integrate external services like file storage (S3) and event-driven compute (Lambda) for ML processing.
- There’s an emphasis on modularity: each component (upload management, data processing, ML model) functions independently yet the system coalesces through clearly defined APIs and event flows.

##### Relevant Technologies and Frameworks
- Frontend: Next.js, React (with components like InfoCard, Navbar, etc.), Tailwind CSS.
- Backend: FastAPI (despite the README mentioning both Python and Node/Express; the actual file hints FastAPI in backend/main.py – verify if it’s a mix or if part of documentation may be legacy or complementary).
- AWS Components: S3 for storage, API Gateway, Lambda for serverless processing, ECS Fargate for containerized deployment.
- Machine Learning: The pretrained ML model found under the "model" directory, supported by a Jupyter Notebook for training/preliminary investigation.

##### Essential Elements
- Frontend → Backend (file upload and data requests).
- Backend ↔ AWS S3 (file storage and retrieval triggers).
- AWS S3 → API Gateway → Lambda (event-driven processing).
- Lambda → Machine Learning Model (data processing) and then results flow back, either directly to Lambda and then through the backend or directly into S3 for query.

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% Frontend Layer
    subgraph "Frontend (Next.js)"
        FE_MAIN["Next.js Frontend"]:::frontend
        subgraph "Pages"
            FE1["Resume Upload Page"]:::frontend
            FE2["API Documentation Page"]:::frontend
            FE3["About Us Page"]:::frontend
        end
        subgraph "Components"
            FE4["Navbar"]:::frontend
            FE5["InfoCard"]:::frontend
            FE6["TeamCard"]:::frontend
            FE7["UploadButton"]:::frontend
        end
    end

    %% Backend Layer
    subgraph "Backend (FastAPI)"
        BE_MAIN["FastAPI Backend"]:::backend
        BE_REQ["Requirements.txt"]:::backend
    end

    %% AWS Services
    subgraph "AWS Services"
        AWS_S3["S3 Bucket"]:::aws
        AWS_API["API Gateway"]:::aws
        AWS_Lambda["AWS Lambda"]:::aws
    end

    %% Machine Learning Model
    subgraph "Machine Learning Model"
        ML_MAIN["ML Model Processor"]:::ml
        ML_SCRIPT["Model Processing Script"]:::ml
        ML_NOTE["Jupyter Notebook"]:::ml
        ML_DATA1["Annotations.json"]:::ml
        ML_DATA2["Test Resume.pdf"]:::ml
    end

    %% Inter-component Connections
    FE_MAIN -->|"FileUpload(POST)/DataRetrieval(GET)"| BE_MAIN
    BE_MAIN -->|"Uses"| BE_REQ
    BE_MAIN -->|"StoreFile"| AWS_S3
    AWS_S3 -->|"Trigger"| AWS_API
    AWS_API -->|"Invoke"| AWS_Lambda
    AWS_Lambda -->|"ProcessData"| ML_MAIN
    ML_MAIN -->|"ReturnResults"| BE_MAIN
    BE_MAIN -->|"DisplayResults"| FE_MAIN

    %% Internal ML Supporting Relationships (dashed arrows)
    ML_SCRIPT -.-> ML_MAIN
    ML_NOTE -.-> ML_MAIN
    ML_DATA1 -.-> ML_MAIN
    ML_DATA2 -.-> ML_MAIN

    %% Click Events for Frontend
    click FE_MAIN "https://github.com/taseskics/cvlens/tree/main/frontend/app"
    click FE1 "https://github.com/taseskics/cvlens/blob/main/frontend/app/upload/page.jsx"
    click FE2 "https://github.com/taseskics/cvlens/blob/main/frontend/app/api-doc/page.jsx"
    click FE3 "https://github.com/taseskics/cvlens/blob/main/frontend/app/about-us/page.jsx"
    click FE4 "https://github.com/taseskics/cvlens/blob/main/frontend/app/components/Navbar/NavBar.jsx"
    click FE5 "https://github.com/taseskics/cvlens/blob/main/frontend/app/components/InfoCard/InfoCard.jsx"
    click FE6 "https://github.com/taseskics/cvlens/blob/main/frontend/app/components/TeamCard/TeamCard.jsx"
    click FE7 "https://github.com/taseskics/cvlens/blob/main/frontend/app/components/UploadButton/UploadButton.jsx"

    %% Click Events for Backend
    click BE_MAIN "https://github.com/taseskics/cvlens/blob/main/backend/main.py"
    click BE_REQ "https://github.com/taseskics/cvlens/blob/main/backend/requirements.txt"

    %% Click Events for Machine Learning Model
    click ML_SCRIPT "https://github.com/taseskics/cvlens/blob/main/model/main.py"
    click ML_NOTE "https://github.com/taseskics/cvlens/blob/main/model/train/CVLens.ipynb"
    click ML_DATA1 "https://github.com/taseskics/cvlens/blob/main/model/data/annotations.json"
    click ML_DATA2 "https://github.com/taseskics/cvlens/blob/main/model/data/test-resume.pdf"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef backend fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef aws fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef ml fill:#f8d7da,stroke:#721c24,stroke-width:2px;
```
