# wafyimady/jobsync architecture

> Architecture diagram of the GitHub repository wafyimady/jobsync, 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/wafyimady/jobsync
- Repository: https://github.com/wafyimady/jobsync

## Overview

JobSync is a reverse ATS: a scheduled worker turns job-related inbox messages into application records, which an authenticated dashboard displays and lets the user update. The worker fetches and decodes email, asks Gemini to extract and classify job details, and stores results in PostgreSQL; the frontend protects access, reads those records, and supports search, metrics, and drag-and-drop status updates. The README documents the overall pipeline; source excerpts confirm the worker’s processing and the frontend’s query, authentication, and update calls. Some worker internals are grouped because they share one source file.

Main entry points: [`worker.py`](https://github.com/wafyimady/jobsync/blob/main/worker.py) (Email worker), [`frontend/app/page.tsx`](https://github.com/wafyimady/jobsync/blob/main/frontend/app/page.tsx) (Protected dashboard), [`frontend/app/actions.ts`](https://github.com/wafyimady/jobsync/blob/main/frontend/app/actions.ts) (Status update action), [`frontend/lib/db.ts`](https://github.com/wafyimady/jobsync/blob/main/frontend/lib/db.ts) (Postgres pool)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pipeline["Email processing"]
  node_worker["Email worker<br/>[worker.py]"]
  node_body["Body decoding<br/>[worker.py]"]
  node_extract["AI extraction<br/>[worker.py]"]
end

subgraph group_storage["Application data"]
  node_application_store[("Applications")]
  node_processed_store[("Processed messages")]
  node_db_pool["Postgres pool<br/>[db.ts]"]
end

subgraph group_frontend["Dashboard"]
  node_dashboard["Protected dashboard<br/>[page.tsx]"]
  node_board["Kanban and metrics<br/>[KanbanBoard.tsx]"]
  node_status_action["Status update action<br/>[actions.ts]"]
end

subgraph group_access["Admin access"]
  node_login["Login page<br/>[page.tsx]"]
  node_auth["Session auth<br/>[auth.ts]"]
end

node_scheduler(("Scheduled trigger"))
node_gmail["Gmail inbox"]
node_gemini["Gemini API"]
node_admin(("Admin user"))

node_scheduler -->|"runs"| node_worker
node_worker -->|"fetches messages"| node_gmail
node_worker -->|"decodes bodies"| node_body
node_worker -->|"processes content"| node_extract
node_extract -->|"requests extraction"| node_gemini
node_worker -->|"upserts records"| node_application_store
node_worker -->|"tracks message IDs"| node_processed_store
node_admin -->|"submits credentials"| node_login
node_login -->|"authenticates"| node_auth
node_dashboard -->|"requires access"| node_auth
node_dashboard -->|"queries applications"| node_db_pool
node_db_pool -->|"reads and writes"| node_application_store
node_dashboard -->|"renders records"| node_board
node_board -->|"submits status"| node_status_action
node_status_action -->|"checks session"| node_auth
node_status_action -->|"updates status"| node_db_pool

click node_worker "https://github.com/wafyimady/jobsync/blob/main/worker.py"
click node_body "https://github.com/wafyimady/jobsync/blob/main/worker.py"
click node_extract "https://github.com/wafyimady/jobsync/blob/main/worker.py"
click node_login "https://github.com/wafyimady/jobsync/blob/main/frontend/app/login/page.tsx"
click node_auth "https://github.com/wafyimady/jobsync/blob/main/frontend/lib/auth.ts"
click node_dashboard "https://github.com/wafyimady/jobsync/blob/main/frontend/app/page.tsx"
click node_db_pool "https://github.com/wafyimady/jobsync/blob/main/frontend/lib/db.ts"
click node_board "https://github.com/wafyimady/jobsync/blob/main/frontend/components/KanbanBoard.tsx"
click node_status_action "https://github.com/wafyimady/jobsync/blob/main/frontend/app/actions.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_worker,node_body,node_extract,node_admin toneBlue
class node_application_store,node_processed_store,node_db_pool toneAmber
class node_dashboard,node_board,node_status_action,node_gemini toneMint
class node_login,node_auth toneRose
class node_scheduler,node_gmail toneIndigo
```

## Components

### Email processing

- [Email worker](https://github.com/wafyimady/jobsync/blob/main/worker.py): `worker.py`
- [Body decoding](https://github.com/wafyimady/jobsync/blob/main/worker.py): `worker.py`
- [AI extraction](https://github.com/wafyimady/jobsync/blob/main/worker.py): `worker.py`

### Application data

- **Applications**
- **Processed messages**
- [Postgres pool](https://github.com/wafyimady/jobsync/blob/main/frontend/lib/db.ts): `frontend/lib/db.ts`

### Dashboard

- [Protected dashboard](https://github.com/wafyimady/jobsync/blob/main/frontend/app/page.tsx): `frontend/app/page.tsx`
- [Kanban and metrics](https://github.com/wafyimady/jobsync/blob/main/frontend/components/KanbanBoard.tsx): `frontend/components/KanbanBoard.tsx`
- [Status update action](https://github.com/wafyimady/jobsync/blob/main/frontend/app/actions.ts): `frontend/app/actions.ts`

### Admin access

- [Login page](https://github.com/wafyimady/jobsync/blob/main/frontend/app/login/page.tsx): `frontend/app/login/page.tsx`
- [Session auth](https://github.com/wafyimady/jobsync/blob/main/frontend/lib/auth.ts): `frontend/lib/auth.ts`

### Other components

- **Scheduled trigger**
- **Gmail inbox**
- **Gemini API**
- **Admin user**

## Connections

- Scheduled trigger → Email worker: runs (evidence: `README.md`)
- Email worker → Gmail inbox: fetches messages (evidence: `README.md`)
- Email worker → Body decoding: decodes bodies (evidence: `worker.py`)
- Email worker → AI extraction: processes content (evidence: `worker.py`)
- AI extraction → Gemini API: requests extraction (evidence: `README.md`)
- Email worker → Applications: upserts records (evidence: `README.md`)
- Email worker → Processed messages: tracks message IDs (evidence: `worker.py`)
- Admin user → Login page: submits credentials (evidence: `frontend/app/login/page.tsx`)
- Login page → Session auth: authenticates (evidence: `frontend/app/login/page.tsx`)
- Protected dashboard → Session auth: requires access (evidence: `frontend/app/page.tsx`)
- Protected dashboard → Postgres pool: queries applications (evidence: `frontend/app/page.tsx`)
- Postgres pool → Applications: reads and writes (evidence: `README.md`)
- Protected dashboard → Kanban and metrics: renders records (evidence: `frontend/app/page.tsx`)
- Kanban and metrics → Status update action: submits status (evidence: `frontend/components/KanbanBoard.tsx`)
- Status update action → Session auth: checks session (evidence: `frontend/app/actions.ts`)
- Status update action → Postgres pool: updates status (evidence: `frontend/app/actions.ts`)
