# sairaj4code/job-scam-detector architecture

> Architecture diagram of the GitHub repository sairaj4code/job-scam-detector, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sairaj4code/job-scam-detector
- Repository: https://github.com/sairaj4code/job-scam-detector

## Overview

Job-Scam-Detector is a web app for assessing suspicious job postings, submitting scam reports, and asking an AI assistant about job-scam risk. Users enter through the React app: they can analyze a posting or submit a report, while the analysis endpoint combines an ML probability with rule-based indicators into a risk verdict. Chat uses a separate frontend component and backend endpoint that calls Gemini. The dashboard and landing experience are additional UI capabilities. Report handling internals are not shown, so that branch is kept unexpanded.

Main entry points: [`frontend/scam-detector-ui/src/App.jsx`](https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/src/App.jsx) (React app), [`backend/routes/analyze.py`](https://github.com/sairaj4code/job-scam-detector/blob/main/backend/routes/analyze.py) (Analyze endpoint), [`frontend/scam-detector-ui/src/services/api.js`](https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/src/services/api.js) (API client), [`backend/app.py`](https://github.com/sairaj4code/job-scam-detector/blob/main/backend/app.py) (Flask app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_app["React app<br/>[App.jsx]"]
  node_navbar["Navigation<br/>[Navbar.jsx]"]
  node_landing["Landing page<br/>[LandingPage.jsx]"]
  node_prediction["Job prediction<br/>[JobPrediction.jsx]"]
  node_report_ui["Report form<br/>[ReportScam.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_sidebar["Dashboard navigation<br/>[Sidebar.jsx]"]
  node_dashboard_header["Dashboard header"]
  node_stat_card["Dashboard metrics<br/>[StatCard.jsx]"]
  node_api["API client<br/>[api.js]"]
end

subgraph group_analysis["Risk analysis"]
  node_analyze_route["Analyze endpoint<br/>[analyze.py]"]
  node_ml["ML prediction<br/>[ml_service.py]"]
  node_rules["Rule scoring<br/>[rules.py]"]
  node_scoring["Verdict scoring<br/>[scoring.py]"]
end

subgraph group_server["Backend services"]
  node_server_app["Flask app<br/>[app.py]"]
  node_report_route["Report endpoint<br/>[report.py]"]
end

subgraph group_assistant["AI assistant"]
  node_chat_ui["Chat interface<br/>[ChatBot.jsx]"]
  node_chat_route["Chat endpoint<br/>[chat.py]"]
end

node_user(("Job seeker"))
node_gemini{{"Gemini service"}}

node_user -->|"uses"| node_app
node_app -->|"renders"| node_navbar
node_app -->|"routes to"| node_landing
node_app -->|"routes to"| node_prediction
node_app -->|"routes to"| node_report_ui
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_chat_ui
node_prediction -->|"requests analysis"| node_api
node_api -->|"posts analysis"| node_analyze_route
node_analyze_route -->|"gets probability"| node_ml
node_analyze_route -->|"gets rule score"| node_rules
node_analyze_route -->|"calculates verdict"| node_scoring
node_report_ui -->|"submits report"| node_api
node_api -.->|"posts report"| node_report_route
node_chat_ui -->|"posts message"| node_chat_route
node_chat_route -->|"requests response"| node_gemini
node_server_app -->|"registers route"| node_analyze_route
node_server_app -->|"registers route"| node_report_route
node_server_app -->|"registers route"| node_chat_route

click node_app "https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/src/App.jsx"
click node_navbar "https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/src/components/Navbar.jsx"
click node_landing "https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/src/components/LandingPage.jsx"
click node_prediction "https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/src/components/JobPrediction.jsx"
click node_report_ui "https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/src/components/ReportScam.jsx"
click node_dashboard "https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/src/components/Dashboard.jsx"
click node_sidebar "https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/src/components/dashboard/Sidebar.jsx"
click node_dashboard_header "https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/src/components/dashboard/DashboardHeader.jsx"
click node_stat_card "https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/src/components/dashboard/StatCard.jsx"
click node_api "https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/src/services/api.js"
click node_chat_ui "https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/ChatBot.jsx"
click node_analyze_route "https://github.com/sairaj4code/job-scam-detector/blob/main/backend/routes/analyze.py"
click node_ml "https://github.com/sairaj4code/job-scam-detector/blob/main/backend/ML/ml_service.py"
click node_rules "https://github.com/sairaj4code/job-scam-detector/blob/main/backend/service/rules.py"
click node_scoring "https://github.com/sairaj4code/job-scam-detector/blob/main/backend/service/scoring.py"
click node_server_app "https://github.com/sairaj4code/job-scam-detector/blob/main/backend/app.py"
click node_report_route "https://github.com/sairaj4code/job-scam-detector/blob/main/backend/routes/report.py"
click node_chat_route "https://github.com/sairaj4code/job-scam-detector/blob/main/backend/routes/chat.py"

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_app,node_navbar,node_landing,node_prediction,node_report_ui,node_dashboard,node_sidebar,node_dashboard_header,node_stat_card,node_api toneBlue
class node_analyze_route,node_ml,node_rules,node_scoring toneAmber
class node_server_app,node_report_route toneMint
class node_chat_ui,node_chat_route toneRose
class node_user,node_gemini toneIndigo
```

## Components

### Web experience

- [React app](https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/src/App.jsx): `frontend/scam-detector-ui/src/App.jsx`
- [Navigation](https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/src/components/Navbar.jsx): `frontend/scam-detector-ui/src/components/Navbar.jsx`
- [Landing page](https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/src/components/LandingPage.jsx): `frontend/scam-detector-ui/src/components/LandingPage.jsx`
- [Job prediction](https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/src/components/JobPrediction.jsx): `frontend/scam-detector-ui/src/components/JobPrediction.jsx`
- [Report form](https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/src/components/ReportScam.jsx): `frontend/scam-detector-ui/src/components/ReportScam.jsx`
- [Dashboard](https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/src/components/Dashboard.jsx): `frontend/scam-detector-ui/src/components/Dashboard.jsx`
- [Dashboard navigation](https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/src/components/dashboard/Sidebar.jsx): `frontend/scam-detector-ui/src/components/dashboard/Sidebar.jsx`
- [Dashboard header](https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/src/components/dashboard/DashboardHeader.jsx): `frontend/scam-detector-ui/src/components/dashboard/DashboardHeader.jsx`
- [Dashboard metrics](https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/src/components/dashboard/StatCard.jsx): `frontend/scam-detector-ui/src/components/dashboard/StatCard.jsx`
- [API client](https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/src/services/api.js): `frontend/scam-detector-ui/src/services/api.js`

### Risk analysis

- [Analyze endpoint](https://github.com/sairaj4code/job-scam-detector/blob/main/backend/routes/analyze.py): `backend/routes/analyze.py`
- [ML prediction](https://github.com/sairaj4code/job-scam-detector/blob/main/backend/ML/ml_service.py): `backend/ML/ml_service.py`
- [Rule scoring](https://github.com/sairaj4code/job-scam-detector/blob/main/backend/service/rules.py): `backend/service/rules.py`
- [Verdict scoring](https://github.com/sairaj4code/job-scam-detector/blob/main/backend/service/scoring.py): `backend/service/scoring.py`

### Backend services

- [Flask app](https://github.com/sairaj4code/job-scam-detector/blob/main/backend/app.py): `backend/app.py`
- [Report endpoint](https://github.com/sairaj4code/job-scam-detector/blob/main/backend/routes/report.py): `backend/routes/report.py`

### AI assistant

- [Chat interface](https://github.com/sairaj4code/job-scam-detector/blob/main/frontend/scam-detector-ui/ChatBot.jsx): `frontend/scam-detector-ui/ChatBot.jsx`
- [Chat endpoint](https://github.com/sairaj4code/job-scam-detector/blob/main/backend/routes/chat.py): `backend/routes/chat.py`

### Other components

- **Job seeker**
- **Gemini service**

## Connections

- Job seeker → React app: uses (evidence: `frontend/scam-detector-ui/src/App.jsx`)
- React app → Navigation: renders (evidence: `frontend/scam-detector-ui/src/App.jsx`)
- React app → Landing page: routes to (evidence: `frontend/scam-detector-ui/src/App.jsx`)
- React app → Job prediction: routes to (evidence: `frontend/scam-detector-ui/src/App.jsx`)
- React app → Report form: routes to (evidence: `frontend/scam-detector-ui/src/App.jsx`)
- React app → Dashboard: routes to (evidence: `frontend/scam-detector-ui/src/App.jsx`)
- React app → Chat interface: routes to (evidence: `frontend/scam-detector-ui/src/App.jsx`)
- Job prediction → API client: requests analysis (evidence: `frontend/scam-detector-ui/src/services/api.js`)
- API client → Analyze endpoint: posts analysis (evidence: `frontend/scam-detector-ui/src/services/api.js`)
- Analyze endpoint → ML prediction: gets probability (evidence: `backend/routes/analyze.py`)
- Analyze endpoint → Rule scoring: gets rule score (evidence: `backend/routes/analyze.py`)
- Analyze endpoint → Verdict scoring: calculates verdict (evidence: `backend/routes/analyze.py`)
- Report form → API client: submits report (evidence: `frontend/scam-detector-ui/src/services/api.js`)
- API client → Report endpoint: posts report
- Chat interface → Chat endpoint: posts message (evidence: `frontend/scam-detector-ui/ChatBot.jsx`)
- Chat endpoint → Gemini service: requests response (evidence: `backend/routes/chat.py`)
- Flask app → Analyze endpoint: registers route (evidence: `backend/app.py`)
- Flask app → Report endpoint: registers route (evidence: `backend/app.py`)
- Flask app → Chat endpoint: registers route (evidence: `backend/app.py`)
