# shashi-17-afk/hiresight architecture

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

- Interactive diagram: https://gitdiagram.com/shashi-17-afk/hiresight
- Repository: https://github.com/shashi-17-afk/hiresight

## Overview

HireSight serves recruiters and candidates through separate portals. Recruiters create postings, review AI-scored and ranked applications, and manage status; candidates discover or follow job links, submit resumes, and track applications. The worker API coordinates authentication, recruitment workflows, AI scoring, and real-time updates, backed by Cloudflare state and external email/payment services. README documents client-side PDF extraction and vector search, but those implementations are not present in the sampled source; their links are shown only where documented.

Main entry points: [`src/worker/index.ts`](https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/index.ts) (HTTP API router), [`src/react-app/App.tsx`](https://github.com/shashi-17-afk/hiresight/blob/main/src/react-app/App.tsx) (SPA routing), [`src/worker/routes/candidates.ts`](https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/routes/candidates.ts) (Candidate submissions), [`src/worker/routes/applications.ts`](https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/routes/applications.ts) (Application pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web portals"]
  node_app["SPA routing<br/>[App.tsx]"]
  node_authui["Sign-in and registration<br/>[AuthPage.tsx]"]
  node_jobpages["Job discovery and posting<br/>[JobsBoard.tsx]"]
  node_apply["Resume application<br/>[ApplyJob.tsx]"]
  node_hrportal["Recruiter workspace<br/>[HRDashboard.tsx]"]
  node_candidateportal["Candidate tracking"]
  node_helpui["Help chat<br/>[HelpChat.tsx]"]
end

subgraph group_api["Worker API"]
  node_router["HTTP API router<br/>[index.ts]"]
  node_authroutes["Authentication and OTP<br/>[auth.ts]"]
  node_jobroutes["Job routes<br/>[jobs.ts]"]
  node_candidates["Candidate submissions<br/>[candidates.ts]"]
  node_applications["Application pipeline<br/>[applications.ts]"]
  node_profiles["Candidate profiles<br/>[profile.ts]"]
  node_payments["Subscriptions and payments<br/>[payments.ts]"]
  node_helpapi["Help endpoint<br/>[help.ts]"]
end

subgraph group_domain["Recruitment services"]
  node_security["Auth and rate limits<br/>[auth.ts]"]
  node_scoring["Resume scoring<br/>[scoring.ts]"]
  node_email["Email dispatch<br/>[email.ts]"]
  node_templates["Email templates<br/>[email-templates.ts]"]
  node_ats["ATS data model<br/>[ats.ts]"]
end

subgraph group_state["Cloudflare state"]
  node_d1[("Recruitment records")]
  node_kv[("Rate-limit and OTP state")]
  node_leaderboard["Live job rankings<br/>[leaderboard-do.ts]"]
  node_statusdo["Live candidate status"]
end

subgraph group_integrations["External services"]
  node_ai["Workers AI"]
  node_vectorize[("Vector search")]
  node_emailprovider["Brevo or Resend"]
  node_razorpay["Razorpay"]
  node_pdf["Browser PDF parsing"]
end

node_hr(("HR recruiter"))
node_candidate(("Job candidate"))

node_hr -->|"uses portal"| node_app
node_candidate -->|"uses portal"| node_app
node_app -->|"routes to"| node_authui
node_app -->|"routes to"| node_jobpages
node_app -->|"routes to"| node_apply
node_app -->|"routes to"| node_hrportal
node_app -->|"routes to"| node_candidateportal
node_authui -->|"submits credentials"| node_authroutes
node_jobpages -.->|"requests jobs"| node_jobroutes
node_apply -.->|"parses resume"| node_pdf
node_apply -.->|"submits resume"| node_candidates
node_hrportal -.->|"manages pipeline"| node_applications
node_candidateportal -.->|"manages profile"| node_profiles
node_candidateportal -.->|"tracks status"| node_router
node_helpui -.->|"sends questions"| node_helpapi
node_router -->|"routes requests"| node_authroutes
node_router -->|"routes requests"| node_jobroutes
node_router -->|"routes requests"| node_candidates
node_router -->|"routes requests"| node_applications
node_router -->|"routes requests"| node_profiles
node_router -->|"routes requests"| node_payments
node_router -->|"routes requests"| node_helpapi
node_authroutes -->|"hashes credentials"| node_security
node_authroutes -->|"dispatches OTP email"| node_email
node_authroutes -->|"renders email"| node_templates
node_authroutes -->|"stores OTP state"| node_kv
node_jobroutes -->|"checks access"| node_security
node_jobroutes -->|"reads and writes jobs"| node_d1
node_jobroutes -.->|"embeds job descriptions"| node_ai
node_jobroutes -.->|"stores job vectors"| node_vectorize
node_candidates -->|"checks access"| node_security
node_candidates -->|"stores submissions"| node_d1
node_candidates -->|"scores resumes"| node_scoring
node_candidates -->|"sends notifications"| node_email
node_candidates -.->|"searches vectors"| node_vectorize
node_scoring -.->|"requests fit score"| node_ai
node_applications -->|"checks access"| node_security
node_applications -->|"reads applications"| node_d1
node_applications -->|"rescores candidate"| node_scoring
node_applications -->|"sends status update"| node_email
node_applications -->|"renders status email"| node_templates
node_profiles -->|"reads and writes profiles"| node_d1
node_payments -.->|"records payments"| node_d1
node_payments -.->|"creates and verifies orders"| node_razorpay
node_payments -->|"sends receipts"| node_email
node_helpapi -.->|"requests assistance"| node_ai
node_helpapi -->|"limits requests"| node_kv
node_email -->|"dispatches messages"| node_emailprovider

click node_app "https://github.com/shashi-17-afk/hiresight/blob/main/src/react-app/App.tsx"
click node_authui "https://github.com/shashi-17-afk/hiresight/blob/main/src/react-app/pages/AuthPage.tsx"
click node_jobpages "https://github.com/shashi-17-afk/hiresight/blob/main/src/react-app/pages/JobsBoard.tsx"
click node_apply "https://github.com/shashi-17-afk/hiresight/blob/main/src/react-app/pages/ApplyJob.tsx"
click node_hrportal "https://github.com/shashi-17-afk/hiresight/blob/main/src/react-app/pages/HRDashboard.tsx"
click node_candidateportal "https://github.com/shashi-17-afk/hiresight/blob/main/src/react-app/pages/CandidateDashboard.tsx"
click node_helpui "https://github.com/shashi-17-afk/hiresight/blob/main/src/react-app/components/HelpChat.tsx"
click node_router "https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/index.ts"
click node_authroutes "https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/routes/auth.ts"
click node_jobroutes "https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/routes/jobs.ts"
click node_candidates "https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/routes/candidates.ts"
click node_applications "https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/routes/applications.ts"
click node_profiles "https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/routes/profile.ts"
click node_payments "https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/routes/payments.ts"
click node_helpapi "https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/routes/help.ts"
click node_security "https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/lib/auth.ts"
click node_scoring "https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/lib/scoring.ts"
click node_email "https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/lib/email.ts"
click node_templates "https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/lib/email-templates.ts"
click node_ats "https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/types/ats.ts"
click node_leaderboard "https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/leaderboard-do.ts"
click node_statusdo "https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/candidate-status-do.ts"

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_authui,node_jobpages,node_apply,node_hrportal,node_candidateportal,node_helpui toneBlue
class node_router,node_authroutes,node_jobroutes,node_candidates,node_applications,node_profiles,node_payments,node_helpapi toneAmber
class node_security,node_scoring,node_email,node_templates,node_ats toneMint
class node_d1,node_kv,node_leaderboard,node_statusdo toneRose
class node_ai,node_vectorize,node_emailprovider,node_razorpay,node_pdf,node_hr,node_candidate toneIndigo
```

## Components

### Web portals

- [SPA routing](https://github.com/shashi-17-afk/hiresight/blob/main/src/react-app/App.tsx): `src/react-app/App.tsx`
- [Sign-in and registration](https://github.com/shashi-17-afk/hiresight/blob/main/src/react-app/pages/AuthPage.tsx): `src/react-app/pages/AuthPage.tsx`
- [Job discovery and posting](https://github.com/shashi-17-afk/hiresight/blob/main/src/react-app/pages/JobsBoard.tsx): `src/react-app/pages/JobsBoard.tsx`
- [Resume application](https://github.com/shashi-17-afk/hiresight/blob/main/src/react-app/pages/ApplyJob.tsx): `src/react-app/pages/ApplyJob.tsx`
- [Recruiter workspace](https://github.com/shashi-17-afk/hiresight/blob/main/src/react-app/pages/HRDashboard.tsx): `src/react-app/pages/HRDashboard.tsx`
- [Candidate tracking](https://github.com/shashi-17-afk/hiresight/blob/main/src/react-app/pages/CandidateDashboard.tsx): `src/react-app/pages/CandidateDashboard.tsx`
- [Help chat](https://github.com/shashi-17-afk/hiresight/blob/main/src/react-app/components/HelpChat.tsx): `src/react-app/components/HelpChat.tsx`

### Worker API

- [HTTP API router](https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/index.ts): `src/worker/index.ts`
- [Authentication and OTP](https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/routes/auth.ts): `src/worker/routes/auth.ts`
- [Job routes](https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/routes/jobs.ts): `src/worker/routes/jobs.ts`
- [Candidate submissions](https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/routes/candidates.ts): `src/worker/routes/candidates.ts`
- [Application pipeline](https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/routes/applications.ts): `src/worker/routes/applications.ts`
- [Candidate profiles](https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/routes/profile.ts): `src/worker/routes/profile.ts`
- [Subscriptions and payments](https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/routes/payments.ts): `src/worker/routes/payments.ts`
- [Help endpoint](https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/routes/help.ts): `src/worker/routes/help.ts`

### Recruitment services

- [Auth and rate limits](https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/lib/auth.ts): `src/worker/lib/auth.ts`
- [Resume scoring](https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/lib/scoring.ts): `src/worker/lib/scoring.ts`
- [Email dispatch](https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/lib/email.ts): `src/worker/lib/email.ts`
- [Email templates](https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/lib/email-templates.ts): `src/worker/lib/email-templates.ts`
- [ATS data model](https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/types/ats.ts): `src/worker/types/ats.ts`

### Cloudflare state

- **Recruitment records**
- **Rate-limit and OTP state**
- [Live job rankings](https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/leaderboard-do.ts): `src/worker/leaderboard-do.ts`
- [Live candidate status](https://github.com/shashi-17-afk/hiresight/blob/main/src/worker/candidate-status-do.ts): `src/worker/candidate-status-do.ts`

### External services

- **Workers AI**
- **Vector search**
- **Brevo or Resend**
- **Razorpay**
- **Browser PDF parsing**

### Other components

- **HR recruiter**
- **Job candidate**

## Connections

- HR recruiter → SPA routing: uses portal (evidence: `src/react-app/App.tsx`)
- Job candidate → SPA routing: uses portal (evidence: `src/react-app/App.tsx`)
- SPA routing → Sign-in and registration: routes to (evidence: `src/react-app/App.tsx`)
- SPA routing → Job discovery and posting: routes to (evidence: `src/react-app/App.tsx`)
- SPA routing → Resume application: routes to (evidence: `src/react-app/App.tsx`)
- SPA routing → Recruiter workspace: routes to (evidence: `src/react-app/App.tsx`)
- SPA routing → Candidate tracking: routes to (evidence: `src/react-app/App.tsx`)
- Sign-in and registration → Authentication and OTP: submits credentials (evidence: `src/react-app/pages/AuthPage.tsx`)
- Job discovery and posting → Job routes: requests jobs
- Resume application → Browser PDF parsing: parses resume
- Resume application → Candidate submissions: submits resume
- Recruiter workspace → Application pipeline: manages pipeline
- Candidate tracking → Candidate profiles: manages profile
- Candidate tracking → HTTP API router: tracks status
- Help chat → Help endpoint: sends questions
- HTTP API router → Authentication and OTP: routes requests (evidence: `src/worker/index.ts`)
- HTTP API router → Job routes: routes requests (evidence: `src/worker/index.ts`)
- HTTP API router → Candidate submissions: routes requests (evidence: `src/worker/index.ts`)
- HTTP API router → Application pipeline: routes requests (evidence: `src/worker/index.ts`)
- HTTP API router → Candidate profiles: routes requests (evidence: `src/worker/index.ts`)
- HTTP API router → Subscriptions and payments: routes requests (evidence: `src/worker/index.ts`)
- HTTP API router → Help endpoint: routes requests (evidence: `src/worker/index.ts`)
- Authentication and OTP → Auth and rate limits: hashes credentials (evidence: `src/worker/routes/auth.ts`)
- Authentication and OTP → Email dispatch: dispatches OTP email (evidence: `src/worker/routes/auth.ts`)
- Authentication and OTP → Email templates: renders email (evidence: `src/worker/routes/auth.ts`)
- Authentication and OTP → Rate-limit and OTP state: stores OTP state
- Job routes → Auth and rate limits: checks access (evidence: `src/worker/routes/jobs.ts`)
- Job routes → Recruitment records: reads and writes jobs
- Job routes → Workers AI: embeds job descriptions
- Job routes → Vector search: stores job vectors
- Candidate submissions → Auth and rate limits: checks access (evidence: `src/worker/routes/candidates.ts`)
- Candidate submissions → Recruitment records: stores submissions
- Candidate submissions → Resume scoring: scores resumes (evidence: `src/worker/routes/candidates.ts`)
- Candidate submissions → Email dispatch: sends notifications (evidence: `src/worker/routes/candidates.ts`)
- Candidate submissions → Vector search: searches vectors
- Resume scoring → Workers AI: requests fit score
- Application pipeline → Auth and rate limits: checks access (evidence: `src/worker/routes/applications.ts`)
- Application pipeline → Recruitment records: reads applications (evidence: `src/worker/routes/applications.ts`)
- Application pipeline → Resume scoring: rescores candidate (evidence: `src/worker/routes/applications.ts`)
- Application pipeline → Email dispatch: sends status update (evidence: `src/worker/routes/applications.ts`)
- Application pipeline → Email templates: renders status email (evidence: `src/worker/routes/applications.ts`)
- Candidate profiles → Recruitment records: reads and writes profiles
- Subscriptions and payments → Recruitment records: records payments
- Subscriptions and payments → Razorpay: creates and verifies orders
- Subscriptions and payments → Email dispatch: sends receipts (evidence: `src/worker/routes/payments.ts`)
- Help endpoint → Workers AI: requests assistance
- Help endpoint → Rate-limit and OTP state: limits requests (evidence: `src/worker/routes/help.ts`)
- Email dispatch → Brevo or Resend: dispatches messages (evidence: `src/worker/lib/email.ts`)
