# hosanna1616/ai-recruiter- architecture

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

- Interactive diagram: https://gitdiagram.com/hosanna1616/ai-recruiter-
- Repository: https://github.com/hosanna1616/ai-recruiter-

## Overview

##### Main Components
a. Frontend (React + Material-UI)
b. Backend API (Node.js + Express)
c. Database (SQLite)
d. AI-Screening Service (internal module or external API)
e. File‐Storage (for resumes)
f. External Services (e.g., email/SMS scheduler)

##### Relationships and Data Flows
- The React App communicates via REST calls (HTTP/HTTPS) to the Express API.
- Express routes invoke controllers (auth, candidate, job, resume).
- Controllers use models (User, Job, JobApplication) via an ORM or raw SQL to read/write the SQLite database.
- The resume controller passes uploads through upload.middleware, stores files, and may invoke the AI-Screening module.
- The AI-Screening Service returns candidate scores/insights to the backend, which persists results and exposes them to the frontend.
- Real-time analytics data is fetched from the database or pushed via a websocket/pub-sub layer to the dashboard React pages.
- Interview scheduling may integrate with an external calendar/email API.

##### Architectural Patterns
- Layered MVC-style backend (middleware → controllers → models → database).
- RESTful API design.
- Componentized frontend (pages → reusable components → assets).
- Separation of concerns: UI, business logic, data access, and external integrations isolated into distinct modules.

##### Technologies & Frameworks
- Frontend: React, Material-UI, Recharts, React Router
- Backend: Node.js, Express, sqlite3 (via config/db.config.js), multer in upload.middleware.js
- AI Screening: custom JS module or external AI API called within resume.controller.js
- Auth: JWT or session-based in auth.middleware.js + auth.controller.js
- Database: SQLite files (database.sqlite, quenerecruit.sqlite) initialized via config/init-db.js and importSchema.js

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Client (Browser)"
        direction TB
        ReactApp["React App"]:::frontend
        Pages["Pages"]:::frontend
        Components["Components"]:::frontend
    end

    ReactApp --> Pages
    ReactApp --> Components
    ReactApp -->|HTTP/HTTPS| API["Node/Express API"]:::backend

    subgraph "Backend API"
        direction TB
        subgraph "Middleware"
            AuthMW["Auth Middleware"]:::backend
            UploadMW["Upload Middleware"]:::backend
        end
        subgraph "Controllers"
            AuthCtrl["Auth Controller"]:::backend
            CandCtrl["Candidate Controller"]:::backend
            JobCtrl["Job Controller"]:::backend
            ResumeCtrl["Resume Controller"]:::backend
        end
        subgraph "Models"
            UserModel["User Model"]:::backend
            JobModel["Job Model"]:::backend
            JobAppModel["JobApplication Model"]:::backend
        end
        Env["Environment (.env)"]:::config
        ConfigInit["DB Config & Init"]:::config
    end

    API --> AuthMW
    API --> UploadMW
    AuthMW --> AuthCtrl
    UploadMW --> ResumeCtrl
    AuthCtrl --> UserModel
    CandCtrl --> UserModel
    JobCtrl --> JobModel
    ResumeCtrl --> JobAppModel
    ResumeCtrl --> AIService["AI Screening Service"]:::external
    AIService --> ResumeCtrl

    UserModel -->|queries| DB["SQLite DB"]:::db
    JobModel --> DB
    JobAppModel --> DB
    AuthCtrl --> DB

    API -->|WebSocket| ReactApp

    subgraph "Database Files"
        direction TB
        DBFile1["database.sqlite"]:::db
        DBFile2["quenerecruit.sqlite"]:::db
        DBFile3["schema.sql"]:::db
    end
    DB --> DBFile1
    DB --> DBFile2
    DB --> DBFile3

    FileStorage["File Storage (uploads/)"]:::storage
    UploadMW --> FileStorage

    EmailAPI["Email/Calendar API"]:::external
    JobCtrl --> EmailAPI

    click ReactApp "https://github.com/hosanna1616/ai-recruiter-/blob/main/index.html"
    click API "https://github.com/hosanna1616/ai-recruiter-/blob/main/importSchema.js"
    click ConfigInit "https://github.com/hosanna1616/ai-recruiter-/blob/main/config/db.config.js"
    click ConfigInit "https://github.com/hosanna1616/ai-recruiter-/blob/main/config/init-db.js"
    click AuthMW "https://github.com/hosanna1616/ai-recruiter-/blob/main/middleware/auth.middleware.js"
    click UploadMW "https://github.com/hosanna1616/ai-recruiter-/blob/main/middleware/upload.middleware.js"
    click AuthCtrl "https://github.com/hosanna1616/ai-recruiter-/blob/main/controllers/auth.controller.js"
    click CandCtrl "https://github.com/hosanna1616/ai-recruiter-/blob/main/controllers/candidate.controller.js"
    click JobCtrl "https://github.com/hosanna1616/ai-recruiter-/blob/main/controllers/job.controller.js"
    click ResumeCtrl "https://github.com/hosanna1616/ai-recruiter-/blob/main/controllers/resume.controller.js"
    click UserModel "https://github.com/hosanna1616/ai-recruiter-/blob/main/models/User.js"
    click JobModel "https://github.com/hosanna1616/ai-recruiter-/blob/main/models/Job.js"
    click JobAppModel "https://github.com/hosanna1616/ai-recruiter-/blob/main/models/JobApplication.js"
    click DBFile1 "https://github.com/hosanna1616/ai-recruiter-/blob/main/database.sqlite"
    click DBFile2 "https://github.com/hosanna1616/ai-recruiter-/blob/main/database/quenerecruit.sqlite"
    click DBFile3 "https://github.com/hosanna1616/ai-recruiter-/blob/main/database/schema.sql"
    click Env "https://github.com/hosanna1616/ai-recruiter-/blob/main/.env"
    click README "https://github.com/hosanna1616/ai-recruiter-/blob/main/README.md"

    classDef frontend fill:#D0E6F8,stroke:#025B9A,stroke-width:1px
    classDef backend fill:#DFF8E1,stroke:#2E7D32,stroke-width:1px
    classDef db fill:#FFF3E0,stroke:#EF6C00,stroke-width:1px
    classDef external fill:#E8EAF6,stroke:#3949AB,stroke-width:1px
    classDef storage fill:#F3E5F5,stroke:#6A1B9A,stroke-width:1px
    classDef config fill:#ECEFF1,stroke:#607D8B,stroke-width:1px
```
