# yuvraj-bansal/fake-job-postings architecture

> Architecture diagram of the GitHub repository yuvraj-bansal/fake-job-postings, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yuvraj-bansal/fake-job-postings
- Repository: https://github.com/yuvraj-bansal/fake-job-postings

## Overview

This is a Streamlit fake-job-posting detector. Users enter a posting manually or provide a URL for scraping, then compare baseline and DistilBERT fake-probability predictions and receive risk guidance and suspicious-phrase explanations. The README documents both model paths; sampled code confirms the scraper, inference helpers, and explanation utilities. Some app sections and subsystem internals were not sampled, so their documented relationships are cited to the README rather than inferred from imports.

Main entry points: [`app.py`](https://github.com/yuvraj-bansal/fake-job-postings/blob/main/app.py) (Streamlit interface), [`src/scraper.py`](https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/scraper.py) (Posting scraper), [`src/model.py`](https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/model.py) (TF-IDF baseline), [`src/explainer.py`](https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/explainer.py) (Red-flag explanations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Posting intake"]
  node_streamlit["Streamlit interface<br/>[app.py]"]
  node_scraper["Posting scraper<br/>[scraper.py]"]
end

subgraph group_analysis["Detection models"]
  node_preprocess["Text cleaning<br/>[preprocess.py]"]
  node_features["Structured features<br/>[features.py]"]
  node_baseline["TF-IDF baseline<br/>[model.py]"]
  node_baseline_artifacts[("Baseline artifacts<br/>[lr_model.pkl]")]
  node_bert_format["DistilBERT text format<br/>[model.py]"]
  node_bert_model["DistilBERT inference<br/>[model.py]"]
  node_probabilities["Fake probabilities<br/>[model.py]"]
end

subgraph group_interpretation["Risk interpretation"]
  node_explainer["Red-flag explanations<br/>[explainer.py]"]
  node_risk["Risk assessment<br/>[explainer.py]"]
  node_guidance["Safety tips and highlights<br/>[app.py]"]
end

node_user(("Job seeker"))
node_jobboards["Job-board pages"]
node_hub["Hugging Face Hub"]

node_user -->|"enters posting"| node_streamlit
node_streamlit -->|"requests scrape"| node_scraper
node_scraper -->|"fetches pages"| node_jobboards
node_scraper -->|"returns fields"| node_streamlit
node_streamlit -->|"cleans text"| node_preprocess
node_streamlit -->|"extracts features"| node_features
node_streamlit -->|"runs prediction"| node_baseline
node_baseline -->|"loads artifacts"| node_baseline_artifacts
node_streamlit -->|"builds model text"| node_bert_format
node_streamlit -->|"runs prediction"| node_bert_model
node_bert_model -->|"loads model"| node_hub
node_baseline -->|"returns probability"| node_probabilities
node_bert_model -->|"returns probability"| node_probabilities
node_streamlit -->|"finds red flags"| node_explainer
node_streamlit -->|"maps probability"| node_risk
node_explainer -->|"uses keyword lists"| node_features
node_streamlit -->|"renders advice"| node_guidance
node_streamlit -->|"displays comparison"| node_probabilities
node_risk -->|"informs guidance"| node_guidance

click node_streamlit "https://github.com/yuvraj-bansal/fake-job-postings/blob/main/app.py"
click node_scraper "https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/scraper.py"
click node_preprocess "https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/preprocess.py"
click node_features "https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/features.py"
click node_baseline "https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/model.py"
click node_baseline_artifacts "https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/lr_model.pkl"
click node_bert_format "https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/model.py"
click node_bert_model "https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/model.py"
click node_probabilities "https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/model.py"
click node_explainer "https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/explainer.py"
click node_risk "https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/explainer.py"
click node_guidance "https://github.com/yuvraj-bansal/fake-job-postings/blob/main/app.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_streamlit,node_scraper toneBlue
class node_preprocess,node_features,node_baseline,node_baseline_artifacts,node_bert_format,node_bert_model,node_probabilities toneAmber
class node_explainer,node_risk,node_guidance toneMint
class node_user,node_jobboards,node_hub toneIndigo
```

## Components

### Posting intake

- [Streamlit interface](https://github.com/yuvraj-bansal/fake-job-postings/blob/main/app.py): `app.py`
- [Posting scraper](https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/scraper.py): `src/scraper.py`

### Detection models

- [Text cleaning](https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/preprocess.py): `src/preprocess.py`
- [Structured features](https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/features.py): `src/features.py`
- [TF-IDF baseline](https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/model.py): `src/model.py`
- [Baseline artifacts](https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/lr_model.pkl): `src/lr_model.pkl`
- [DistilBERT text format](https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/model.py): `src/model.py`
- [DistilBERT inference](https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/model.py): `src/model.py`
- [Fake probabilities](https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/model.py): `src/model.py`

### Risk interpretation

- [Red-flag explanations](https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/explainer.py): `src/explainer.py`
- [Risk assessment](https://github.com/yuvraj-bansal/fake-job-postings/blob/main/src/explainer.py): `src/explainer.py`
- [Safety tips and highlights](https://github.com/yuvraj-bansal/fake-job-postings/blob/main/app.py): `app.py`

### Other components

- **Job seeker**
- **Job-board pages**
- **Hugging Face Hub**

## Connections

- Job seeker → Streamlit interface: enters posting (evidence: `README.md`)
- Streamlit interface → Posting scraper: requests scrape (evidence: `app.py`)
- Posting scraper → Job-board pages: fetches pages (evidence: `src/scraper.py`)
- Posting scraper → Streamlit interface: returns fields (evidence: `README.md`)
- Streamlit interface → Text cleaning: cleans text (evidence: `README.md`)
- Streamlit interface → Structured features: extracts features (evidence: `README.md`)
- Streamlit interface → TF-IDF baseline: runs prediction (evidence: `README.md`)
- TF-IDF baseline → Baseline artifacts: loads artifacts (evidence: `src/model.py`)
- Streamlit interface → DistilBERT text format: builds model text (evidence: `README.md`)
- Streamlit interface → DistilBERT inference: runs prediction (evidence: `app.py`)
- DistilBERT inference → Hugging Face Hub: loads model (evidence: `src/model.py`)
- TF-IDF baseline → Fake probabilities: returns probability (evidence: `src/model.py`)
- DistilBERT inference → Fake probabilities: returns probability (evidence: `src/model.py`)
- Streamlit interface → Red-flag explanations: finds red flags (evidence: `app.py`)
- Streamlit interface → Risk assessment: maps probability (evidence: `app.py`)
- Red-flag explanations → Structured features: uses keyword lists (evidence: `src/explainer.py`)
- Streamlit interface → Safety tips and highlights: renders advice (evidence: `app.py`)
- Streamlit interface → Fake probabilities: displays comparison (evidence: `README.md`)
- Risk assessment → Safety tips and highlights: informs guidance (evidence: `app.py`)
