# vins2534/recruitedge architecture

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

- Interactive diagram: https://gitdiagram.com/vins2534/recruitedge
- Repository: https://github.com/vins2534/recruitedge

## Overview

##### Project Type and Purpose
- RecruitEdge is a full-stack application that integrates a ReactJS frontend with a Flask-based backend. Its primary purpose is to automate and enhance the recruitment process with an AI-driven, NLP-powered candidate screening system.
- The system leverages advanced text processing (using LangChain) and vector embedding generation (via the Gemini API), plus fast similarity search (using libraries like FAISS/HNSWlib), making it both a data-intensive and compute-critical application.

##### Break Down the Main Architectural Components
a. Frontend:
- Frontend as a separate block/cluster using ReactJS.
- Components such as the DashboardHome, InterviewScheduler, ResumeUpload, EmployeeAssignment, ProjectCreation, and Sidebar found in the hr-dashboard/src/components directory.
- Use of Redux for state management and Axios for handling API calls.

b. Backend:
- Features like JWT-based authentication, API documentation (Swagger/OpenAPI), and testing (with Pytest).
- Demonstrate the set of API endpoints for Candidate Management, Job Management, and Analytics.

c. AI & NLP Pipeline:
- Text processing and document parsing (using LangChain).
- Embedding generation (via Gemini API).
- Vector similarity search using FAISS/HNSWlib.
- Multi-level chain-of-thought prompting processes for context-aware screening.
- An example from the README (e.g., the generate_skill_embedding and match_candidate_to_job functions) as a pop-out to capture data flow through various stages.

d. Database Schema:
- Two primary databases:
- A vector store using PostgreSQL with the pgvector extension (mention HNSW indexing for approximate nearest neighbor searches).
- A relational database (MySQL) for user profiles, application tracking, and metrics.

e. Cloud Infrastructure & Deployment:
- Hosting and infrastructure components:
- Managed cloud databases (e.g., Aiven for PostgreSQL/MySQL).
- Docker containers for horizontal scaling and deployment.
- Kubernetes for production deployment with autoscaling.
- Object storage for resume PDFs and caching components such as Redis.
- This block connects with both backend services and the databases.

##### Relationships and Interactions
- From the frontend, API calls should be directed towards the backend.
- Backend communicates with the AI & NLP pipeline to process and analyze resume data.
- Data is stored and fetched from both the vector store and relational store.
- The caching component (Redis) intercepts frequent and API response queries.
- How the authentication mechanism (JWT tokens) is positioned in the communication flow between the frontend and backend.

##### Architectural Patterns & Design Principles
- Separation of concerns between frontend and backend operations.
- Modular design of the AI & NLP pipeline, employing multi-tier processing for text analysis.
- RESTful API design pattern with clear API endpoints.
- Incorporate design principles like scalability and fault tolerance (via Docker, Kubernetes, etc).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend (UI - ReactJS)
    subgraph "Frontend (ReactJS)"
        direction TB
        DH["DashboardHome (Component)"]:::frontend
        IS["InterviewScheduler (Component)"]:::frontend
        RU["ResumeUpload (Component)"]:::frontend
        EA["EmployeeAssignment (Component)"]:::frontend
        PC["ProjectCreation (Component)"]:::frontend
        SB["Sidebar (Component)"]:::frontend
        REDUX["Redux (State Management)"]:::frontend
        AXIOS["Axios (API Client)"]:::frontend
    end

    %% Backend (Flask API Server)
    subgraph "Backend (Flask API Server)"
        direction TB
        API["Flask-based REST API"]:::backend
        JWT["JWT Authentication"]:::backend
        APIE["Candidate/Job/Analytics Endpoints"]:::backend
    end

    %% AI & NLP Pipeline
    subgraph "AI & NLP Pipeline"
        direction TB
        LC["LangChain (Text Processing)"]:::pipeline
        GA["Gemini API (Embedding Generation)"]:::pipeline
        VS["FAISS/HNSWlib (Vector Similarity Search)"]:::pipeline
        COT["Chain-of-Thought Prompting"]:::pipeline
        EF["Example: generate_skill_embedding & match_candidate_to_job"]:::pipeline
    end

    %% Databases
    subgraph "Databases"
        direction TB
        PG["PostgreSQL with pgvector (Vector Store)"]:::database
        MY["MySQL (Relational DB)"]:::database
    end

    %% Cloud Infrastructure & Deployment
    subgraph "Cloud Infrastructure & Deployment"
        direction TB
        CDB["Managed Cloud Databases (Aiven)"]:::infra
        DOCKER["Docker Containers"]:::infra
        K8S["Kubernetes Deployment"]:::infra
        OBJST["Object Storage (Resume PDFs)"]:::infra
        REDIS["Redis (Caching)"]:::infra
    end

    %% Relationships
    %% Frontend to Backend
    AXIOS -->|"API_Calls_with_JWT"| API
    DH ---|"Uses"| REDUX
    IS ---|"UI_Event"| REDUX
    RU ---|"UI_Event"| REDUX
    EA ---|"UI_Event"| REDUX
    PC ---|"UI_Event"| REDUX
    SB ---|"Navigation"| REDUX

    %% Backend internal flow
    API -->|"Validates"| JWT
    API -->|"Handles"| APIE

    %% Backend to AI & NLP Pipeline
    API -->|"Triggers_Resume_Analysis"| LC
    LC -->|"Processes_Text"| GA
    GA -->|"Generates_Embeddings"| VS
    VS -->|"Similarity_Search"| COT
    COT -->|"Executes_ChainLogic"| EF

    %% Backend to Databases
    API -->|"Stores/Fetched_Data"| PG
    API -->|"Stores/Fetched_Data"| MY

    %% Cloud Infrastructure Connections
    DOCKER -->|"Hosts"| API
    K8S -->|"Deploys"| API
    CDB -->|"Manages"| PG
    CDB -->|"Manages"| MY
    API -->|"File_Storage"| OBJST
    REDIS ---|"Caches_API_Responses"| API

    %% Styles (Color Definitions)
    classDef frontend fill:#cceeff,stroke:#333,stroke-width:2px;
    classDef backend fill:#ffcc99,stroke:#333,stroke-width:2px;
    classDef pipeline fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef database fill:#ff9999,stroke:#333,stroke-width:2px;
    classDef infra fill:#e0ccff,stroke:#333,stroke-width:2px;

    %% Click Events
    click DH "https://github.com/vins2534/recruitedge/blob/main/hr-dashboard/src/components/DashboardHome.js"
    click IS "https://github.com/vins2534/recruitedge/blob/main/hr-dashboard/src/components/HR/InterviewScheduler.js"
    click RU "https://github.com/vins2534/recruitedge/blob/main/hr-dashboard/src/components/HR/ResumeUpload.js"
    click EA "https://github.com/vins2534/recruitedge/blob/main/hr-dashboard/src/components/PM/EmployeeAssignment.js"
    click PC "https://github.com/vins2534/recruitedge/blob/main/hr-dashboard/src/components/PM/ProjectCreation.js"
    click SB "https://github.com/vins2534/recruitedge/blob/main/hr-dashboard/src/components/Sidebar.js"
    click API "https://github.com/vins2534/recruitedge/blob/main/last_try.py"
    click EF "https://github.com/vins2534/recruitedge/blob/main/README.md"
```
