# waliulrayhan/find-best-cv architecture

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

- Interactive diagram: https://gitdiagram.com/waliulrayhan/find-best-cv
- Repository: https://github.com/waliulrayhan/find-best-cv

## Overview

##### Project Type & Purpose
- This project is a full-stack, AI-driven resume screening tool.
- Its purpose is to allow recruiters/HR professionals to upload multiple CVs along with a job description and then use NLP techniques to extract text, compute similarity scores, and rank resumes accordingly.
- The solution also includes a contact form for email notifications.

##### Main Components
- Frontend Component:
- Built with Next.js, TypeScript, Tailwind CSS, and other modern libraries.
- Contains various pages (Home, Upload, Results, Contact, Privacy, Terms) and API routes (e.g., /api/contact).
- Acts as the client that users interact with and sends requests to the backend.
- Backend Component:
- Built with FastAPI (Python) which serves as the API provider.
- Contains endpoints such as POST /match-cvs/, GET /download-file/{filename}, and GET /health.
- Handles file uploads (PDF, DOCX) and processes them (text extraction, processing, keyword matching, and similarity calculation).
- Incorporates libraries like scikit-learn, NLTK, PyMuPDF, and python-docx to perform core text processing/NLP functions.
- File Storage:
- The “uploads” directory in the backend stores the uploaded resumes/CVs.
- Deployment & Containerization:
- Docker and Docker Compose configurations are provided to containerize the frontend and backend separately.
- Contains Dockerfiles for both “frontend” and “backend” and additional configuration files (Procfile, render.yaml) for deployment purposes.
- External Services:
- Email service integration via Nodemailer.
- Although Nodemailer is mentioned, it may be integrated either server-side (backend) or through API calls from the frontend.

##### Relationships & Data Flow
- The User Interface (frontend) sends a file upload and job description data to the FastAPI backend through REST API calls.
- The backend processes the files (extracting text, preprocessing, feature extraction, similarity score computation) and returns a ranked list of candidates along with keyword matches.
- The frontend then displays the interactive results with detailed similarity scores.
- Additionally, the contact form on the frontend sends email messages to integrated email services (likely via an API endpoint interacting with Nodemailer).
- Docker Compose orchestrates network communication between frontend and backend containers.

##### Key Architectural Patterns and Design Principles
- Clear separation of concerns: a decoupled frontend and backend architecture.
- Containerization: Docker is used to encapsulate and run each part of the application reliably.
- Client/Server Model: The frontend acts as the client while the FastAPI server handles computational logic and file processing.
- Modular design: Frontend pages and components are modular, while the backend’s text processing functionalities are clearly separated (for instance, main.py for orchestrating API requests, text_processor.py for handling NLP tasks).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Entities
    User["User (Recruiter/HR)"]:::user

    %% Frontend Layer
    subgraph "Frontend Layer"
        Frontend["Next.js Frontend (UI)"]:::frontend
        Pages["Pages & API Routes"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        Backend["FastAPI Backend API"]:::backend
        NLP["NLP & Text Processing (main.py, text_processor.py)"]:::backend
    end

    %% Infrastructure
    Storage["File Storage (uploads)"]:::storage
    Email["External Email Service (Nodemailer)"]:::external

    subgraph "Containerization & Deployment"
        Compose["Docker Compose (docker-compose.yml)"]:::container
        DockerF["Frontend Dockerfile"]:::container
        DockerB["Backend Dockerfile"]:::container
        Procfile["Deployment File (Procfile)"]:::container
        Render["Deployment File (render.yaml)"]:::container
    end

    %% Relationships
    User -->|"uploads CVs+JobDesc"| Frontend
    Frontend -->|"API calls (/match-cvs,/download-file,{filename},/health)"| Backend
    Frontend -->|"ContactForm (/api/contact)"| Backend
    Backend -->|"Orchestrates NLP"| NLP
    Backend -->|"Stores/Retrieves Files"| Storage
    Backend -->|"Sends Emails"| Email
    Compose -->|"Orchestrates"| Frontend
    Compose -->|"Orchestrates"| Backend

    %% Click Events for Component Mapping
    click Frontend "https://github.com/waliulrayhan/find-best-cv/tree/main/frontend/"
    click Pages "https://github.com/waliulrayhan/find-best-cv/tree/main/frontend/src/app/"
    click Backend "https://github.com/waliulrayhan/find-best-cv/tree/main/backend/"
    click Storage "https://github.com/waliulrayhan/find-best-cv/tree/main/backend/uploads/"
    click Compose "https://github.com/waliulrayhan/find-best-cv/blob/main/docker-compose.yml"
    click DockerF "https://github.com/waliulrayhan/find-best-cv/tree/main/frontend/Dockerfile"
    click DockerB "https://github.com/waliulrayhan/find-best-cv/tree/main/backend/Dockerfile"
    click Procfile "https://github.com/waliulrayhan/find-best-cv/tree/main/backend/Procfile"
    click Render "https://github.com/waliulrayhan/find-best-cv/blob/main/backend/render.yaml"

    %% Styles
    classDef user fill:#F8C471,stroke:#000,stroke-width:2px,color:#000;
    classDef frontend fill:#AED6F1,stroke:#000,stroke-width:2px,color:#000;
    classDef backend fill:#F9E79F,stroke:#000,stroke-width:2px,color:#000;
    classDef storage fill:#BB8FCE,stroke:#000,stroke-width:2px,color:#000;
    classDef external fill:#82E0AA,stroke:#000,stroke-width:2px,color:#000;
    classDef container fill:#F5B7B1,stroke:#000,stroke-width:2px,color:#000;
```
