# jbmedalla02/jobguard architecture

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

- Interactive diagram: https://gitdiagram.com/jbmedalla02/jobguard
- Repository: https://github.com/jbmedalla02/jobguard

## Overview

JobGuard accepts job-posting text or a URL, analyzes text and embedded links, combines those signals into a verdict and risk score, and stores each submission. Flagged postings also receive a SHA-256 evidence fingerprint in a tamper-evident local chain. Users can review results and history or verify the chain. The Next.js frontend calls the FastAPI backend server-side. Source excerpts show the analysis, persistence, and ledger interactions; some frontend and API connections are supported by the README rather than sampled implementation excerpts.

Main entry points: [`backend/routers/analyze.py`](https://github.com/jbmedalla02/jobguard/blob/master/backend/routers/analyze.py) (Analysis endpoint), [`frontend/lib/api.ts`](https://github.com/jbmedalla02/jobguard/blob/master/frontend/lib/api.ts) (Backend client), [`backend/main.py`](https://github.com/jbmedalla02/jobguard/blob/master/backend/main.py) (FastAPI app), [`backend/routers/history.py`](https://github.com/jbmedalla02/jobguard/blob/master/backend/routers/history.py) (History endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend experience"]
  node_submit_ui["Submission form<br/>[SubmitForm.tsx]"]
  node_web_actions["Server actions<br/>[actions.ts]"]
  node_api_client["Backend client<br/>[api.ts]"]
  node_result_page["Result view<br/>[page.tsx]"]
  node_history_page["History view<br/>[page.tsx]"]
  node_audit_page["Audit view<br/>[page.tsx]"]
end

subgraph group_api["API and workflows"]
  node_fastapi["FastAPI app<br/>[main.py]"]
  node_fetch_route["Fetch endpoint<br/>[fetch_url.py]"]
  node_scraper["Posting scraper<br/>[fetcher.py]"]
  node_analyze_route["Analysis endpoint<br/>[analyze.py]"]
  node_history_route["History endpoints<br/>[history.py]"]
  node_verify_route["Chain endpoints<br/>[verify.py]"]
end

subgraph group_analysis["Risk analysis"]
  node_classifier["Text classifier<br/>[classifier.py]"]
  node_url_scanner["URL scanner<br/>[scanner.py]"]
  node_aggregator["Verdict aggregator<br/>[aggregator.py]"]
end

subgraph group_records["Records and audit"]
  node_submission_store[("Submission records<br/>[models.py]")]
  node_database_access["Database sessions<br/>[database.py]"]
  node_ledger[("Evidence hash chain<br/>[ledger.py]")]
end

node_user(("Job seeker"))

node_user -->|"enters posting"| node_submit_ui
node_submit_ui -->|"submits data"| node_web_actions
node_web_actions -->|"calls API"| node_api_client
node_api_client -->|"sends requests"| node_fastapi
node_fastapi -->|"routes requests"| node_analyze_route
node_fastapi -->|"routes requests"| node_fetch_route
node_fastapi -->|"routes requests"| node_history_route
node_fastapi -->|"routes requests"| node_verify_route
node_fetch_route -->|"fetches posting"| node_scraper
node_analyze_route -->|"classifies text"| node_classifier
node_analyze_route -->|"scans links"| node_url_scanner
node_analyze_route -->|"combines signals"| node_aggregator
node_aggregator -->|"uses confidence"| node_classifier
node_aggregator -->|"uses URL scores"| node_url_scanner
node_analyze_route -->|"opens session"| node_database_access
node_analyze_route -->|"saves submission"| node_submission_store
node_analyze_route -->|"records flagged evidence"| node_ledger
node_history_route -->|"queries records"| node_database_access
node_history_route -->|"reads submissions"| node_submission_store
node_verify_route -->|"checks chain"| node_ledger
node_api_client -->|"provides result data"| node_result_page
node_api_client -->|"provides history data"| node_history_page
node_api_client -->|"provides audit data"| node_audit_page
node_result_page -->|"shows verdict"| node_user
node_history_page -->|"shows submissions"| node_user
node_audit_page -->|"shows chain status"| node_user

click node_submit_ui "https://github.com/jbmedalla02/jobguard/blob/master/frontend/components/SubmitForm.tsx"
click node_web_actions "https://github.com/jbmedalla02/jobguard/blob/master/frontend/app/actions.ts"
click node_api_client "https://github.com/jbmedalla02/jobguard/blob/master/frontend/lib/api.ts"
click node_result_page "https://github.com/jbmedalla02/jobguard/blob/master/frontend/app/result/%5Bid%5D/page.tsx"
click node_history_page "https://github.com/jbmedalla02/jobguard/blob/master/frontend/app/history/page.tsx"
click node_audit_page "https://github.com/jbmedalla02/jobguard/blob/master/frontend/app/audit/page.tsx"
click node_fastapi "https://github.com/jbmedalla02/jobguard/blob/master/backend/main.py"
click node_fetch_route "https://github.com/jbmedalla02/jobguard/blob/master/backend/routers/fetch_url.py"
click node_scraper "https://github.com/jbmedalla02/jobguard/blob/master/backend/scraping/fetcher.py"
click node_analyze_route "https://github.com/jbmedalla02/jobguard/blob/master/backend/routers/analyze.py"
click node_history_route "https://github.com/jbmedalla02/jobguard/blob/master/backend/routers/history.py"
click node_verify_route "https://github.com/jbmedalla02/jobguard/blob/master/backend/routers/verify.py"
click node_classifier "https://github.com/jbmedalla02/jobguard/blob/master/backend/ml/classifier.py"
click node_url_scanner "https://github.com/jbmedalla02/jobguard/blob/master/backend/url_analysis/scanner.py"
click node_aggregator "https://github.com/jbmedalla02/jobguard/blob/master/backend/aggregator.py"
click node_submission_store "https://github.com/jbmedalla02/jobguard/blob/master/backend/db/models.py"
click node_database_access "https://github.com/jbmedalla02/jobguard/blob/master/backend/db/database.py"
click node_ledger "https://github.com/jbmedalla02/jobguard/blob/master/backend/blockchain/ledger.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_submit_ui,node_web_actions,node_api_client,node_result_page,node_history_page,node_audit_page toneBlue
class node_fastapi,node_fetch_route,node_scraper,node_analyze_route,node_history_route,node_verify_route toneAmber
class node_classifier,node_url_scanner,node_aggregator toneMint
class node_submission_store,node_database_access,node_ledger toneRose
class node_user toneIndigo
```

## Components

### Frontend experience

- [Submission form](https://github.com/jbmedalla02/jobguard/blob/master/frontend/components/SubmitForm.tsx): `frontend/components/SubmitForm.tsx`
- [Server actions](https://github.com/jbmedalla02/jobguard/blob/master/frontend/app/actions.ts): `frontend/app/actions.ts`
- [Backend client](https://github.com/jbmedalla02/jobguard/blob/master/frontend/lib/api.ts): `frontend/lib/api.ts`
- [Result view](https://github.com/jbmedalla02/jobguard/blob/master/frontend/app/result/%5Bid%5D/page.tsx): `frontend/app/result/[id]/page.tsx`
- [History view](https://github.com/jbmedalla02/jobguard/blob/master/frontend/app/history/page.tsx): `frontend/app/history/page.tsx`
- [Audit view](https://github.com/jbmedalla02/jobguard/blob/master/frontend/app/audit/page.tsx): `frontend/app/audit/page.tsx`

### API and workflows

- [FastAPI app](https://github.com/jbmedalla02/jobguard/blob/master/backend/main.py): `backend/main.py`
- [Fetch endpoint](https://github.com/jbmedalla02/jobguard/blob/master/backend/routers/fetch_url.py): `backend/routers/fetch_url.py`
- [Posting scraper](https://github.com/jbmedalla02/jobguard/blob/master/backend/scraping/fetcher.py): `backend/scraping/fetcher.py`
- [Analysis endpoint](https://github.com/jbmedalla02/jobguard/blob/master/backend/routers/analyze.py): `backend/routers/analyze.py`
- [History endpoints](https://github.com/jbmedalla02/jobguard/blob/master/backend/routers/history.py): `backend/routers/history.py`
- [Chain endpoints](https://github.com/jbmedalla02/jobguard/blob/master/backend/routers/verify.py): `backend/routers/verify.py`

### Risk analysis

- [Text classifier](https://github.com/jbmedalla02/jobguard/blob/master/backend/ml/classifier.py): `backend/ml/classifier.py`
- [URL scanner](https://github.com/jbmedalla02/jobguard/blob/master/backend/url_analysis/scanner.py): `backend/url_analysis/scanner.py`
- [Verdict aggregator](https://github.com/jbmedalla02/jobguard/blob/master/backend/aggregator.py): `backend/aggregator.py`

### Records and audit

- [Submission records](https://github.com/jbmedalla02/jobguard/blob/master/backend/db/models.py): `backend/db/models.py`
- [Database sessions](https://github.com/jbmedalla02/jobguard/blob/master/backend/db/database.py): `backend/db/database.py`
- [Evidence hash chain](https://github.com/jbmedalla02/jobguard/blob/master/backend/blockchain/ledger.py): `backend/blockchain/ledger.py`

### Other components

- **Job seeker**

## Connections

- Job seeker → Submission form: enters posting (evidence: `README.md`)
- Submission form → Server actions: submits data (evidence: `README.md`)
- Server actions → Backend client: calls API (evidence: `README.md`)
- Backend client → FastAPI app: sends requests (evidence: `README.md`)
- FastAPI app → Analysis endpoint: routes requests (evidence: `backend/main.py`)
- FastAPI app → Fetch endpoint: routes requests (evidence: `backend/main.py`)
- FastAPI app → History endpoints: routes requests (evidence: `backend/main.py`)
- FastAPI app → Chain endpoints: routes requests (evidence: `backend/main.py`)
- Fetch endpoint → Posting scraper: fetches posting
- Analysis endpoint → Text classifier: classifies text (evidence: `backend/routers/analyze.py`)
- Analysis endpoint → URL scanner: scans links (evidence: `backend/routers/analyze.py`)
- Analysis endpoint → Verdict aggregator: combines signals (evidence: `backend/routers/analyze.py`)
- Verdict aggregator → Text classifier: uses confidence (evidence: `backend/aggregator.py`)
- Verdict aggregator → URL scanner: uses URL scores (evidence: `backend/aggregator.py`)
- Analysis endpoint → Database sessions: opens session (evidence: `backend/routers/analyze.py`)
- Analysis endpoint → Submission records: saves submission (evidence: `backend/routers/analyze.py`)
- Analysis endpoint → Evidence hash chain: records flagged evidence (evidence: `backend/routers/analyze.py`)
- History endpoints → Database sessions: queries records (evidence: `backend/routers/history.py`)
- History endpoints → Submission records: reads submissions (evidence: `backend/routers/history.py`)
- Chain endpoints → Evidence hash chain: checks chain (evidence: `backend/routers/verify.py`)
- Backend client → Result view: provides result data (evidence: `README.md`)
- Backend client → History view: provides history data (evidence: `README.md`)
- Backend client → Audit view: provides audit data (evidence: `README.md`)
- Result view → Job seeker: shows verdict (evidence: `README.md`)
- History view → Job seeker: shows submissions (evidence: `README.md`)
- Audit view → Job seeker: shows chain status (evidence: `README.md`)
