# fabiorg06/cv-analyzer architecture

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

- Interactive diagram: https://gitdiagram.com/fabiorg06/cv-analyzer
- Repository: https://github.com/fabiorg06/cv-analyzer

## Overview

##### Main Components
- Frontend: Represented by the “cv-analyzer” directory. This component includes:
- The Next.js application (in the “app” folder) and page components (e.g., page.tsx, layout.tsx).
- UI components (buttons, cards, dropdown menus, etc.) used for displaying results.
- Services (such as the API layer in “app/services/api.ts”) that handle communication with the backend.
- Backend: The “cv-analyzer-api” directory hosts the Django application. Key sub-components include:
- Two distinct Django apps: “analitics_model” (for AI analytics and model evaluation) and “file_analizer” (for processing and managing file uploads).
- The core Django project configuration (cvAnalizer/cvAnalizer) with settings, URLs, and the WSGI/ASGI entry points.
- Database: Although not explicit in the file tree, the README mentions PostgreSQL. Represent it as a separate component that the backend interacts with.
- AI Model: Highlight the integration with the Gemini-2.0-Flash AI model. This could be encapsulated within the “analitics_model” or as an external service if it is hosted separately.
- Containerization/Deployment: Indicate the use of Docker (and Docker Compose) to containerize both the backend and frontend, ensuring easy deployment and scaling.

##### Relationships and Data Flow
- The backend receives these requests and processes them via its Django apps by:
- Analyzing CV and job offer data,
- Interacting with the AI model to compare skills,
- Communicating with the PostgreSQL database for persisting or retrieving data.

##### Architectural Patterns and Design Principles
- A service-oriented architecture by splitting responsibilities between the Django apps (“analitics_model” and “file_analizer”).
- Clearly delineate the separation of concerns: the frontend handles the presentation and user interactions, whereas the backend is responsible for data processing and integration with the AI model.
- Adding labels such as “API Layer” and “Business Logic” to the backend, and “UI Components” for the frontend to highlight their roles.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Docker Containers"
        subgraph "Frontend Container"
            FL["Next.js Frontend"]:::frontend
            FL1["Layout (app/layout.tsx)"]:::frontend
            FL2["Page (app/page.tsx)"]:::frontend
            FL3["API Service (app/services/api.ts)"]:::frontend
            FL4["UI Components (components)"]:::frontend
            FL5["UI Library (components/ui)"]:::frontend
        end
        subgraph "Backend Container"
            BE["Django Backend"]:::backend
            BE1["Django Core (cvAnalizer)"]:::backend
            BE2["Manage Script (manage.py)"]:::backend
            BE3["Analytics Model"]:::backend
            BE4["File Analyzer"]:::backend
        end
    end

    DB["PostgreSQL Database"]:::database
    AI["Gemini-2.0-Flash AI Model"]:::external

    %% Data Flow
    FL3 -->|"API_Request"| BE1
    BE1 -->|"Process_File_Data"| BE4
    BE1 -->|"Invoke_AI"| BE3
    BE1 -->|"DB_Read/Write"| DB
    BE3 -->|"AI_Analysis"| AI

    %% Click Events for Frontend
    click FL1 "https://github.com/fabiorg06/cv-analyzer/blob/main/cv-analyzer/app/layout.tsx"
    click FL2 "https://github.com/fabiorg06/cv-analyzer/blob/main/cv-analyzer/app/page.tsx"
    click FL3 "https://github.com/fabiorg06/cv-analyzer/blob/main/cv-analyzer/app/services/api.ts"
    click FL4 "https://github.com/fabiorg06/cv-analyzer/tree/main/cv-analyzer/components"
    click FL5 "https://github.com/fabiorg06/cv-analyzer/tree/main/cv-analyzer/components/ui"

    %% Click Events for Backend
    click BE1 "https://github.com/fabiorg06/cv-analyzer/tree/main/cv-analyzer-api/cvAnalizer/cvAnalizer"
    click BE2 "https://github.com/fabiorg06/cv-analyzer/blob/main/cv-analyzer-api/cvAnalizer/manage.py"
    click BE3 "https://github.com/fabiorg06/cv-analyzer/tree/main/cv-analyzer-api/cvAnalizer/App/analitics_model"
    click BE4 "https://github.com/fabiorg06/cv-analyzer/tree/main/cv-analyzer-api/cvAnalizer/App/file_analizer"

    %% Style Classes
    classDef frontend fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef backend fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef database fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef external fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef container fill:#fff3cd,stroke:#856404,stroke-width:2px;
```
