# satvik8954/job-pilot architecture

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

- Interactive diagram: https://gitdiagram.com/satvik8954/job-pilot
- Repository: https://github.com/satvik8954/job-pilot

## Overview

#### Purpose and entry points
JobPilot is a local, automated job-application pipeline: collect listings, evaluate them against a candidate resume, generate per-job application PDFs, and record/notify on strong matches. Primary execution paths are CLI stage runners, scheduled execution, FastAPI triggers, and a Streamlit dashboard: `scraper/run.py`, `run_matcher.py`, `run_tailor.py`, `scheduler/daily_runner.py`, `api/main.py`, `dashboard/app.py`.

#### 1. Job ingestion and persistence
The scraper searches LinkedIn Jobs and Wellfound using Playwright, with Firecrawl described as fallback. Listings are modeled as typed job records, deduplicated by URL hash, and persisted to PostgreSQL. The database helper is shared across pipeline stages, making Postgres the durable boundary between independently runnable stages.
Paths: `scraper/playwright_scraper.py`, `scraper/models.py`, `scraper/db.py`, `schema.sql`.

#### 2. Matching graph: resume-to-job assessment
The matcher converts the source resume into structured profile data, embeds both resume/job-description text using `all-MiniLM-L6-v2`, and applies cosine-similarity prefiltering before LLM scoring. Eligible listings are scored by Anthropic Claude with match reasons and skill-gap output; score/status results return to Postgres. LangGraph defines the stage’s stateful node flow.
Paths: `matcher/resume_parser.py`, `matcher/embedder.py`, `matcher/llm_scorer.py`, `matcher/graph.py`.

#### 3. Tailoring graph and artifact generation
The tailoring stage selects highly scored jobs, invokes Claude to rewrite resume content and create a three-paragraph cover letter, then renders HTML templates to PDFs. It has its own LangGraph workflow, supporting stage-level state/resume behavior. Generated artifacts are filesystem outputs, while the underlying application/job state remains database-backed.
Paths: `tailor/graph.py`, `tailor/resume_tailor.py`, `tailor/cover_letter.py`, `tailor/pdf_exporter.py`, `tailor/templates/resume_template.html`.

#### 4. Application tracking and notifications
After strong matches are tailored, the tracker writes application records to Google Sheets through gspread and sends Telegram notifications. These are outward-facing side effects and should occur after successful matching/tailoring persistence rather than serving as pipeline state.
Paths: `tracker/sheets_tracker.py`, `tracker/telegram_bot.py`.

#### 5. Orchestration and scheduling
Stages are intentionally runnable separately as well as in daily sequence. The scheduler uses APScheduler to execute the full scrape → match → tailor → track path daily. LangGraph governs matcher/tailor internals; the scheduler is the top-level recurring control plane.
Paths: `scheduler/daily_runner.py`, `matcher/graph.py`, `tailor/graph.py`.

#### 6. Operational interfaces
FastAPI exposes job/status retrieval plus background triggers for scrape, match, and tailor operations. Streamlit provides an operator-facing dashboard over the same persisted job state. These interfaces should orchestrate existing stage runners rather than duplicate agent logic.
Paths: `api/main.py`, `dashboard/app.py`.

#### Runtime and integration boundaries
The core runtime is Python 3.11+ with PostgreSQL, Playwright/Chromium, LangGraph, sentence-transformers, ChromaDB, Anthropic Claude, and pdfkit backed by the external `wkhtmltopdf` binary. Optional external integrations are Google Sheets/Drive service-account APIs and Telegram Bot API. Docker Compose exists for local infrastructure support.
Paths: `requirements.txt`, `docker-compose.yml`, `.env.example`.

Main entry points: [`schema.sql`](https://github.com/satvik8954/job-pilot/blob/main/schema.sql) (PostgreSQL), [`tailor/graph.py`](https://github.com/satvik8954/job-pilot/blob/main/tailor/graph.py) (Tailoring graph), [`matcher/graph.py`](https://github.com/satvik8954/job-pilot/blob/main/matcher/graph.py) (Matching graph), [`scheduler/daily_runner.py`](https://github.com/satvik8954/job-pilot/blob/main/scheduler/daily_runner.py) (Daily scheduler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Control surfaces"]
  node_scheduler{{"Daily scheduler<br/>APScheduler control plane<br/>[daily_runner.py]"}}
  node_api["FastAPI triggers<br/>API interface<br/>[main.py]"]
  node_dashboard["Streamlit dashboard<br/>operator interface<br/>[app.py]"]
end

subgraph group_ingestion["Ingestion"]
  node_scrape_runner["Scrape runner<br/>CLI stage<br/>[run.py]"]
  node_scraper["Job scraper<br/>Playwright ingestion"]
  node_job_models["Typed job records<br/>job model<br/>[models.py]"]
end

subgraph group_matching["Matching"]
  node_matcher_runner["Matcher runner<br/>CLI stage<br/>[run_matcher.py]"]
  node_resume_parser["Resume parser<br/>profile extraction<br/>[resume_parser.py]"]
  node_embedder["Embedding prefilter<br/>sentence-transformer<br/>[embedder.py]"]
  node_chromadb[("ChromaDB<br/>vector store")]
  node_matcher_graph{{"Matching graph<br/>LangGraph workflow<br/>[graph.py]"}}
  node_claude_scorer["Claude match scorer<br/>LLM scoring<br/>[llm_scorer.py]"]
end

subgraph group_tailoring["Tailoring"]
  node_tailor_runner["Tailor runner<br/>CLI stage<br/>[run_tailor.py]"]
  node_tailor_graph{{"Tailoring graph<br/>LangGraph workflow<br/>[graph.py]"}}
  node_resume_tailor["Resume rewrite<br/>Claude generation<br/>[resume_tailor.py]"]
  node_cover_letter["Cover letter generator<br/>Claude generation<br/>[cover_letter.py]"]
  node_pdf_exporter["PDF exporter<br/>HTML to PDF<br/>[pdf_exporter.py]"]
  node_pdf_artifacts["Application PDFs<br/>filesystem artifacts"]
end

subgraph group_tracking["Tracking"]
  node_tracker["Application tracker<br/>outbound stage<br/>[sheets_tracker.py]"]
  node_google_sheets[("Google Sheets<br/>external application log")]
  node_telegram["Telegram Bot API<br/>external notification<br/>[telegram_bot.py]"]
end

node_postgres[("PostgreSQL<br/>durable pipeline state<br/>[schema.sql]")]

node_scheduler -->|"daily start"| node_scrape_runner
node_scheduler -->|"daily sequence"| node_matcher_runner
node_scheduler -->|"daily sequence"| node_tailor_runner
node_scheduler -->|"daily sequence"| node_tracker
node_api -->|"trigger"| node_scrape_runner
node_api -->|"trigger"| node_matcher_runner
node_api -->|"trigger"| node_tailor_runner
node_dashboard -->|"job state"| node_postgres
node_scrape_runner -->|"runs"| node_scraper
node_scraper -->|"listings"| node_job_models
node_job_models -->|"deduplicated jobs"| node_postgres
node_matcher_runner -->|"runs"| node_matcher_graph
node_postgres -->|"jobs and status"| node_matcher_graph
node_resume_parser -->|"candidate profile"| node_matcher_graph
node_embedder -->|"eligible matches"| node_matcher_graph
node_embedder -->|"vectors"| node_chromadb
node_matcher_graph -->|"score eligible jobs"| node_claude_scorer
node_claude_scorer -->|"scores and gaps"| node_postgres
node_tailor_runner -->|"runs"| node_tailor_graph
node_postgres -->|"high-scoring jobs"| node_tailor_graph
node_tailor_graph -->|"tailored resume"| node_resume_tailor
node_tailor_graph -->|"cover letter"| node_cover_letter
node_resume_tailor -->|"resume HTML"| node_pdf_exporter
node_cover_letter -->|"letter HTML"| node_pdf_exporter
node_pdf_exporter -->|"PDF files"| node_pdf_artifacts
node_tailor_graph -->|"application state"| node_postgres
node_postgres -->|"tailored applications"| node_tracker
node_tracker -->|"application records"| node_google_sheets
node_tracker -->|"strong-match alerts"| node_telegram

click node_scheduler "https://github.com/satvik8954/job-pilot/blob/main/scheduler/daily_runner.py"
click node_api "https://github.com/satvik8954/job-pilot/blob/main/api/main.py"
click node_dashboard "https://github.com/satvik8954/job-pilot/blob/main/dashboard/app.py"
click node_scrape_runner "https://github.com/satvik8954/job-pilot/blob/main/scraper/run.py"
click node_scraper "https://github.com/satvik8954/job-pilot/blob/main/scraper/playwright_scraper.py"
click node_job_models "https://github.com/satvik8954/job-pilot/blob/main/scraper/models.py"
click node_postgres "https://github.com/satvik8954/job-pilot/blob/main/schema.sql"
click node_matcher_runner "https://github.com/satvik8954/job-pilot/blob/main/run_matcher.py"
click node_resume_parser "https://github.com/satvik8954/job-pilot/blob/main/matcher/resume_parser.py"
click node_embedder "https://github.com/satvik8954/job-pilot/blob/main/matcher/embedder.py"
click node_matcher_graph "https://github.com/satvik8954/job-pilot/blob/main/matcher/graph.py"
click node_claude_scorer "https://github.com/satvik8954/job-pilot/blob/main/matcher/llm_scorer.py"
click node_tailor_runner "https://github.com/satvik8954/job-pilot/blob/main/run_tailor.py"
click node_tailor_graph "https://github.com/satvik8954/job-pilot/blob/main/tailor/graph.py"
click node_resume_tailor "https://github.com/satvik8954/job-pilot/blob/main/tailor/resume_tailor.py"
click node_cover_letter "https://github.com/satvik8954/job-pilot/blob/main/tailor/cover_letter.py"
click node_pdf_exporter "https://github.com/satvik8954/job-pilot/blob/main/tailor/pdf_exporter.py"
click node_tracker "https://github.com/satvik8954/job-pilot/blob/main/tracker/sheets_tracker.py"
click node_telegram "https://github.com/satvik8954/job-pilot/blob/main/tracker/telegram_bot.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_scheduler,node_api,node_dashboard toneBlue
class node_scrape_runner,node_scraper,node_job_models toneAmber
class node_matcher_runner,node_resume_parser,node_embedder,node_chromadb,node_matcher_graph,node_claude_scorer toneMint
class node_tailor_runner,node_tailor_graph,node_resume_tailor,node_cover_letter,node_pdf_exporter,node_pdf_artifacts toneRose
class node_tracker,node_google_sheets,node_telegram toneIndigo
class node_postgres toneNeutral
```

## Components

### Control surfaces

- [Daily scheduler](https://github.com/satvik8954/job-pilot/blob/main/scheduler/daily_runner.py): APScheduler control plane · Runs the full daily pipeline. · `scheduler/daily_runner.py`
- [FastAPI triggers](https://github.com/satvik8954/job-pilot/blob/main/api/main.py): API interface · Starts stages in background and exposes job status. · `api/main.py`
- [Streamlit dashboard](https://github.com/satvik8954/job-pilot/blob/main/dashboard/app.py): operator interface · `dashboard/app.py`

### Ingestion

- [Scrape runner](https://github.com/satvik8954/job-pilot/blob/main/scraper/run.py): CLI stage · `scraper/run.py`
- [Job scraper](https://github.com/satvik8954/job-pilot/blob/main/scraper/playwright_scraper.py): Playwright ingestion · Searches LinkedIn Jobs and Wellfound, with Firecrawl fallback. · `scraper/playwright_scraper.py`
- [Typed job records](https://github.com/satvik8954/job-pilot/blob/main/scraper/models.py): job model · Deduplicates listings by URL hash. · `scraper/models.py`

### Matching

- [Matcher runner](https://github.com/satvik8954/job-pilot/blob/main/run_matcher.py): CLI stage · `run_matcher.py`
- [Resume parser](https://github.com/satvik8954/job-pilot/blob/main/matcher/resume_parser.py): profile extraction · Converts the source resume into structured candidate data. · `matcher/resume_parser.py`
- [Embedding prefilter](https://github.com/satvik8954/job-pilot/blob/main/matcher/embedder.py): sentence-transformer · Embeds resume and job text, then applies cosine similarity. · `matcher/embedder.py`
- **ChromaDB**: vector store
- [Matching graph](https://github.com/satvik8954/job-pilot/blob/main/matcher/graph.py): LangGraph workflow · Coordinates stateful assessment nodes. · `matcher/graph.py`
- [Claude match scorer](https://github.com/satvik8954/job-pilot/blob/main/matcher/llm_scorer.py): LLM scoring · Produces match score, reasons, and skill gaps. · `matcher/llm_scorer.py`

### Tailoring

- [Tailor runner](https://github.com/satvik8954/job-pilot/blob/main/run_tailor.py): CLI stage · `run_tailor.py`
- [Tailoring graph](https://github.com/satvik8954/job-pilot/blob/main/tailor/graph.py): LangGraph workflow · Selects high-scoring jobs and supports resumable stage state. · `tailor/graph.py`
- [Resume rewrite](https://github.com/satvik8954/job-pilot/blob/main/tailor/resume_tailor.py): Claude generation · `tailor/resume_tailor.py`
- [Cover letter generator](https://github.com/satvik8954/job-pilot/blob/main/tailor/cover_letter.py): Claude generation · Creates a three-paragraph cover letter. · `tailor/cover_letter.py`
- [PDF exporter](https://github.com/satvik8954/job-pilot/blob/main/tailor/pdf_exporter.py): HTML to PDF · Renders templates through pdfkit and wkhtmltopdf. · `tailor/pdf_exporter.py`
- **Application PDFs**: filesystem artifacts

### Tracking

- [Application tracker](https://github.com/satvik8954/job-pilot/blob/main/tracker/sheets_tracker.py): outbound stage · Runs after tailored application state is persisted. · `tracker/sheets_tracker.py`
- **Google Sheets**: external application log
- [Telegram Bot API](https://github.com/satvik8954/job-pilot/blob/main/tracker/telegram_bot.py): external notification · `tracker/telegram_bot.py`

### Other components

- [PostgreSQL](https://github.com/satvik8954/job-pilot/blob/main/schema.sql): durable pipeline state · Shared boundary between independently runnable stages. · `schema.sql`

## Connections

- Daily scheduler → Scrape runner: daily start
- Daily scheduler → Matcher runner: daily sequence
- Daily scheduler → Tailor runner: daily sequence
- Daily scheduler → Application tracker: daily sequence
- FastAPI triggers → Scrape runner: trigger
- FastAPI triggers → Matcher runner: trigger
- FastAPI triggers → Tailor runner: trigger
- Streamlit dashboard → PostgreSQL: job state
- Scrape runner → Job scraper: runs
- Job scraper → Typed job records: listings
- Typed job records → PostgreSQL: deduplicated jobs
- Matcher runner → Matching graph: runs
- PostgreSQL → Matching graph: jobs and status
- Resume parser → Matching graph: candidate profile
- Embedding prefilter → Matching graph: eligible matches
- Embedding prefilter → ChromaDB: vectors
- Matching graph → Claude match scorer: score eligible jobs
- Claude match scorer → PostgreSQL: scores and gaps
- Tailor runner → Tailoring graph: runs
- PostgreSQL → Tailoring graph: high-scoring jobs
- Tailoring graph → Resume rewrite: tailored resume
- Tailoring graph → Cover letter generator: cover letter
- Resume rewrite → PDF exporter: resume HTML
- Cover letter generator → PDF exporter: letter HTML
- PDF exporter → Application PDFs: PDF files
- Tailoring graph → PostgreSQL: application state
- PostgreSQL → Application tracker: tailored applications
- Application tracker → Google Sheets: application records
- Application tracker → Telegram Bot API: strong-match alerts
