# mernamohamed09/hirehub architecture

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

- Interactive diagram: https://gitdiagram.com/mernamohamed09/hirehub
- Repository: https://github.com/mernamohamed09/hirehub

## Overview

#### Purpose and Entry Points
This is a full-stack recruitment platform: candidates manage CVs and applications; companies post jobs, operate an ATS, assess applicants, and schedule interviews; administrators manage users and companies. It consists of a React/Vite SPA, a Node/Express backend, and a Python AI scoring service.

Primary runtime entry points are `Frontend/src/main.jsx`, `Backend/app.js`, and `ai-service/app.py`.

#### Frontend Application
The React client provides public job discovery plus role-oriented candidate, company, and admin workspaces. Routing/application composition begins in `Frontend/src/App.jsx`; shared dashboard and public layouts are in `Frontend/src/layouts/DashboardLayout.jsx` and `Frontend/src/layouts/MainLayout.jsx`.

Frontend API calls are centralized through `Frontend/src/api/axiosConfig.js` and domain service modules such as `Frontend/src/services/applicationService.js`. Authentication state is held in `Frontend/src/store/slices/authSlice.js`, while live socket access is exposed through `Frontend/src/context/SocketContext.jsx`.

#### HTTP API and Domain Boundary
The Express backend is the system-of-record API and mounts domain route modules from `Backend/app.js`. Routes separate HTTP contracts from controller orchestration; representative boundaries include `Backend/Routes/applicationRoute.js`, `Backend/Routes/jobRoute.js`, and `Backend/Routes/interviewRoute.js`.

Controllers implement workflows for identity, job lifecycle, applications, assessments, chat, notifications, and administration, e.g. `Backend/controller/applicationController.js`, `Backend/controller/assessmentController.js`, and `Backend/controller/chatController.js`. Request validation is a dedicated boundary under `Backend/controller/validation/`.

#### Identity, Roles, and Profiles
Authentication and authorization are mediated by `Backend/controller/authController.js` and `Backend/middleware/authMiddleware.js`. The user model anchors accounts and role access in `Backend/models/User.js`; candidate and company-specific profiles are represented separately by `Backend/models/candidate.js` and `Backend/models/company.js`.

The frontend protects restricted views through `Frontend/src/components/protectedRoute.jsx`, with distinct dashboard surfaces under `Frontend/src/pages/candidate`, `Frontend/src/pages/company`, and `Frontend/src/pages/admin`.

#### Recruitment Workflow and Persistence
Core persisted workflow entities are jobs, applications, interviews, and assessments: `Backend/models/jobs.js`, `Backend/models/application.js`, `Backend/models/interview.js`, and `Backend/models/assessment.js`. Company ATS views (`Frontend/src/pages/company/ATSBoard.jsx`) consume this workflow to move applicants through hiring stages.

Application processing is augmented asynchronously by `Backend/services/applicationAiWorker.js`; assessment state is monitored by `Backend/services/assessmentPoller.js`. The requeue script at `Backend/scripts/requeueVersionMismatch.js` indicates durable or recoverable AI-processing work.

#### AI Resume Matching Service
The Python service exposes AI capabilities from `ai-service/app.py`, with request/response contracts in `ai-service/schemas.py`. Its scoring pipeline combines extracted skills, experience interpretation, requirement matching, and similarity scoring via `ai-service/services/skills.py`, `ai-service/services/experience.py`, and `ai-service/services/scoring.py`.

The Node backend integrates this service through `Backend/services/aiService.js` and also contains resume/file parsing adapters in `Backend/services/resumeParser.js` and `Backend/services/fileParser.js`. Skill normalization depends on versioned taxonomy data under `ai-service/data/taxonomy`.

#### Realtime, Files, and External Boundaries
Realtime chat and notifications use the backend socket layer at `Backend/socket.js`, backed by conversation, message, and notification models: `Backend/models/conversation.js`, `Backend/models/message.js`, and `Backend/models/notification.js`.

Uploaded CVs and avatars cross multer middleware boundaries in `Backend/middleware/uploadMulter.js` and `Backend/middleware/uploadAvatar.js`, with local storage roots at `Backend/uploads/cvs` and `Backend/uploads/avatars`. The system therefore requires Node.js, Python, a database implied by the model layer, local/upload storage, and network connectivity between the backend and AI service.

Main entry points: [`Backend/controller/applicationController.js`](https://github.com/mernamohamed09/hirehub/blob/main/Backend/controller/applicationController.js) (Workflow controllers), [`Frontend/src/App.jsx`](https://github.com/mernamohamed09/hirehub/blob/main/Frontend/src/App.jsx) (App routing & layouts), [`Frontend/src/pages/candidate`](https://github.com/mernamohamed09/hirehub/tree/main/Frontend/src/pages/candidate) (Role workspaces), [`Backend/Routes/applicationRoute.js`](https://github.com/mernamohamed09/hirehub/blob/main/Backend/Routes/applicationRoute.js) (Domain routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React SPA"]
  node_spa_entry["SPA entry<br/>Vite/React entry<br/>[main.jsx]"]
  node_app_router["App routing &amp; layouts<br/>React composition<br/>[App.jsx]"]
  node_role_workspaces["Role workspaces<br/>candidate/company/admin UI"]
  node_protected_routes["Protected routes<br/>route authorization<br/>[protectedRoute.jsx]"]
  node_api_client["API client<br/>Axios services<br/>[axiosConfig.js]"]
  node_auth_state["Auth state<br/>Redux slice<br/>[authSlice.js]"]
  node_socket_client["Socket context<br/>realtime client<br/>[SocketContext.jsx]"]
end

subgraph group_backend["Node API"]
  node_api_entry["Express API<br/>Node runtime<br/>[app.js]"]
  node_routes["Domain routes<br/>HTTP contracts"]
  node_controllers["Workflow controllers<br/>domain orchestration"]
  node_authz["Authentication &amp; roles<br/>auth middleware<br/>[authMiddleware.js]"]
  node_async_workers["AI &amp; assessment workers<br/>background processing"]
  node_ai_adapter["AI integration &amp; parsing<br/>service adapters<br/>[aiService.js]"]
  node_socket_server["Socket layer<br/>realtime gateway<br/>[socket.js]"]
  node_upload_middleware["Upload boundary<br/>Multer middleware<br/>[uploadMulter.js]"]
end

subgraph group_ai["AI Scoring Service"]
  node_ai_api["AI API<br/>Python runtime<br/>[app.py]"]
  node_scoring_pipeline["Scoring pipeline<br/>skills/experience matching<br/>[scoring.py]"]
end

subgraph group_data["Persistence &amp; Storage"]
  node_models_db[("Recruitment data<br/>model-backed database<br/>[User.js]")]
  node_file_storage[("CV &amp; avatar storage<br/>local uploads")]
end

node_spa_entry -->|"starts"| node_app_router
node_app_router -->|"renders"| node_role_workspaces
node_app_router -->|"guards views with"| node_protected_routes
node_protected_routes -->|"reads session"| node_auth_state
node_role_workspaces -->|"uses"| node_api_client
node_role_workspaces -->|"subscribes through"| node_socket_client
node_api_client -->|"HTTP requests"| node_api_entry
node_socket_client -->|"realtime connection"| node_socket_server
node_api_entry -->|"mounts"| node_routes
node_routes -->|"applies"| node_authz
node_routes -->|"dispatches"| node_controllers
node_controllers -->|"reads and writes"| node_models_db
node_controllers -.->|"queues processing"| node_async_workers
node_async_workers -->|"requests scoring"| node_ai_adapter
node_ai_adapter -->|"network call"| node_ai_api
node_ai_api -->|"runs"| node_scoring_pipeline
node_async_workers -->|"persists results"| node_models_db
node_socket_server -->|"uses conversations and notifications"| node_models_db
node_upload_middleware -->|"stores files"| node_file_storage
node_controllers -->|"handles uploads through"| node_upload_middleware

click node_spa_entry "https://github.com/mernamohamed09/hirehub/blob/main/Frontend/src/main.jsx"
click node_app_router "https://github.com/mernamohamed09/hirehub/blob/main/Frontend/src/App.jsx"
click node_role_workspaces "https://github.com/mernamohamed09/hirehub/tree/main/Frontend/src/pages/candidate"
click node_protected_routes "https://github.com/mernamohamed09/hirehub/blob/main/Frontend/src/components/protectedRoute.jsx"
click node_api_client "https://github.com/mernamohamed09/hirehub/blob/main/Frontend/src/api/axiosConfig.js"
click node_auth_state "https://github.com/mernamohamed09/hirehub/blob/main/Frontend/src/store/slices/authSlice.js"
click node_socket_client "https://github.com/mernamohamed09/hirehub/blob/main/Frontend/src/context/SocketContext.jsx"
click node_api_entry "https://github.com/mernamohamed09/hirehub/blob/main/Backend/app.js"
click node_routes "https://github.com/mernamohamed09/hirehub/blob/main/Backend/Routes/applicationRoute.js"
click node_controllers "https://github.com/mernamohamed09/hirehub/blob/main/Backend/controller/applicationController.js"
click node_authz "https://github.com/mernamohamed09/hirehub/blob/main/Backend/middleware/authMiddleware.js"
click node_async_workers "https://github.com/mernamohamed09/hirehub/blob/main/Backend/services/applicationAiWorker.js"
click node_ai_adapter "https://github.com/mernamohamed09/hirehub/blob/main/Backend/services/aiService.js"
click node_socket_server "https://github.com/mernamohamed09/hirehub/blob/main/Backend/socket.js"
click node_upload_middleware "https://github.com/mernamohamed09/hirehub/blob/main/Backend/middleware/uploadMulter.js"
click node_ai_api "https://github.com/mernamohamed09/hirehub/blob/main/ai-service/app.py"
click node_scoring_pipeline "https://github.com/mernamohamed09/hirehub/blob/main/ai-service/services/scoring.py"
click node_models_db "https://github.com/mernamohamed09/hirehub/blob/main/Backend/models/User.js"
click node_file_storage "https://github.com/mernamohamed09/hirehub/tree/main/Backend/uploads/cvs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_spa_entry,node_app_router,node_role_workspaces,node_protected_routes,node_api_client,node_auth_state,node_socket_client toneBlue
class node_api_entry,node_routes,node_controllers,node_authz,node_async_workers,node_ai_adapter,node_socket_server,node_upload_middleware toneAmber
class node_ai_api,node_scoring_pipeline toneMint
class node_models_db,node_file_storage toneRose
```

## Components

### React SPA

- [SPA entry](https://github.com/mernamohamed09/hirehub/blob/main/Frontend/src/main.jsx): Vite/React entry · `Frontend/src/main.jsx`
- [App routing & layouts](https://github.com/mernamohamed09/hirehub/blob/main/Frontend/src/App.jsx): React composition · Composes public and dashboard application surfaces. · `Frontend/src/App.jsx`
- [Role workspaces](https://github.com/mernamohamed09/hirehub/tree/main/Frontend/src/pages/candidate): candidate/company/admin UI · `Frontend/src/pages/candidate`
- [Protected routes](https://github.com/mernamohamed09/hirehub/blob/main/Frontend/src/components/protectedRoute.jsx): route authorization · `Frontend/src/components/protectedRoute.jsx`
- [API client](https://github.com/mernamohamed09/hirehub/blob/main/Frontend/src/api/axiosConfig.js): Axios services · `Frontend/src/api/axiosConfig.js`
- [Auth state](https://github.com/mernamohamed09/hirehub/blob/main/Frontend/src/store/slices/authSlice.js): Redux slice · `Frontend/src/store/slices/authSlice.js`
- [Socket context](https://github.com/mernamohamed09/hirehub/blob/main/Frontend/src/context/SocketContext.jsx): realtime client · `Frontend/src/context/SocketContext.jsx`

### Node API

- [Express API](https://github.com/mernamohamed09/hirehub/blob/main/Backend/app.js): Node runtime · System-of-record HTTP API and route mount point. · `Backend/app.js`
- [Domain routes](https://github.com/mernamohamed09/hirehub/blob/main/Backend/Routes/applicationRoute.js): HTTP contracts · Application, job, and interview route boundaries. · `Backend/Routes/applicationRoute.js`
- [Workflow controllers](https://github.com/mernamohamed09/hirehub/blob/main/Backend/controller/applicationController.js): domain orchestration · Runs application, assessment, chat, identity, and administration workflows. · `Backend/controller/applicationController.js`
- [Authentication & roles](https://github.com/mernamohamed09/hirehub/blob/main/Backend/middleware/authMiddleware.js): auth middleware · `Backend/middleware/authMiddleware.js`
- [AI & assessment workers](https://github.com/mernamohamed09/hirehub/blob/main/Backend/services/applicationAiWorker.js): background processing · Processes application scoring and monitors assessments. · `Backend/services/applicationAiWorker.js`
- [AI integration & parsing](https://github.com/mernamohamed09/hirehub/blob/main/Backend/services/aiService.js): service adapters · Calls AI scoring and parses uploaded resumes. · `Backend/services/aiService.js`
- [Socket layer](https://github.com/mernamohamed09/hirehub/blob/main/Backend/socket.js): realtime gateway · Delivers chat and notification events. · `Backend/socket.js`
- [Upload boundary](https://github.com/mernamohamed09/hirehub/blob/main/Backend/middleware/uploadMulter.js): Multer middleware · Accepts CV and avatar uploads. · `Backend/middleware/uploadMulter.js`

### AI Scoring Service

- [AI API](https://github.com/mernamohamed09/hirehub/blob/main/ai-service/app.py): Python runtime · Exposes resume matching request/response contracts. · `ai-service/app.py`
- [Scoring pipeline](https://github.com/mernamohamed09/hirehub/blob/main/ai-service/services/scoring.py): skills/experience matching · Combines taxonomy-normalized skills, experience, requirements, and similarity. · `ai-service/services/scoring.py`

### Persistence & Storage

- [Recruitment data](https://github.com/mernamohamed09/hirehub/blob/main/Backend/models/User.js): model-backed database · Stores users, profiles, jobs, applications, interviews, assessments, and messaging. · `Backend/models/User.js`
- [CV & avatar storage](https://github.com/mernamohamed09/hirehub/tree/main/Backend/uploads/cvs): local uploads · `Backend/uploads/cvs`

## Connections

- SPA entry → App routing & layouts: starts
- App routing & layouts → Role workspaces: renders
- App routing & layouts → Protected routes: guards views with
- Protected routes → Auth state: reads session
- Role workspaces → API client: uses
- Role workspaces → Socket context: subscribes through
- API client → Express API: HTTP requests
- Socket context → Socket layer: realtime connection
- Express API → Domain routes: mounts
- Domain routes → Authentication & roles: applies
- Domain routes → Workflow controllers: dispatches
- Workflow controllers → Recruitment data: reads and writes
- Workflow controllers → AI & assessment workers: queues processing
- AI & assessment workers → AI integration & parsing: requests scoring
- AI integration & parsing → AI API: network call
- AI API → Scoring pipeline: runs
- AI & assessment workers → Recruitment data: persists results
- Socket layer → Recruitment data: uses conversations and notifications
- Upload boundary → CV & avatar storage: stores files
- Workflow controllers → Upload boundary: handles uploads through
