# filmozolevskiy/justapply architecture

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

- Interactive diagram: https://gitdiagram.com/filmozolevskiy/justapply
- Repository: https://github.com/filmozolevskiy/justapply

## Overview

#### Purpose and Entry Points
JustApply is a local, AI-assisted job-search system: scrape roles, persist and evaluate them against resume profiles, enrich viable leads with contacts, and manage applications on a Kanban dashboard. Primary entry points are the CLI (`src/cli/__main__.py`, `src/cli/cli.py`), FastAPI dashboard backend (`src/web/run_dashboard.py`, `src/web/server.py`), and orchestration layer (`src/pipelines.py`, `src/service/just_apply.py`).

#### Persistence and Safety Boundary
SQLite is the system of record, normally at `data/just_apply.db`. Database access, job lifecycle operations, migrations, caches, batch records, and user settings are separated under `src/db/connection.py`, `src/db/jobs.py`, `src/db/job_model.py`, and `src/db/migrations.py`. Destructive database operations pass through a safety gate and snapshots in `src/safety/gate.py` and `src/safety/snapshot.py`; this is an explicit protection boundary rather than a UI-only confirmation.

#### Search and Collection Pipeline
Search orchestration coordinates query/profile inputs, scraping, normalization, deduplication, storage, and later evaluation through `src/pipelines.py` and `src/service/just_apply.py`. Standard job acquisition uses Bright Data via `src/core/scraper.py`; LinkedIn/Apify-oriented source handling is represented by `src/core/apify_linkedin_scraper.py` and `src/core/source_platform.py`. Region and source-platform rules constrain collection through `src/core/regions.py`.

#### AI Evaluation and Admission Gates
Gemini evaluates job descriptions against resume data, producing match scores and summaries. Interactive matching is centered in `src/core/matcher.py` and `src/core/gemini_client.py`; bulk rounds submit and reconcile Gemini Batch API work via `src/core/batch_evaluation.py`, `src/core/batch_poller.py`, and persistent batch state in `src/db/batch_jobs.py`. `src/core/evaluation_lock.py` prevents overlapping evaluation rounds. Before jobs advance, deterministic and LLM-derived filters enforce attributes such as remote type, employment type, and annual salary through `src/core/pre_evaluation/remote_type.py`, `src/core/attribute_gating.py`, and `src/core/annual_posted_salary.py`.

#### Contact Enrichment and Outreach
Accepted or targeted jobs enter an enrichment workflow coordinated by `src/core/enrichment/coordinator.py`. It obtains and caches contact samples, classifies people (such as recruiter versus hiring contact), and generates connection/outreach material through `src/core/enrichment/contact_sample.py`, `src/core/enrichment/classifier.py`, and `src/core/enrichment/connection_note.py`. Apify is the paid external contact-discovery service; cost/spend confirmation and cached contacts limit unnecessary calls. Company research is a parallel enrichment capability, including Glassdoor intelligence, in `src/core/company_research/preflight.py` and `src/core/company_research/glassdoor_intel.py`.

#### Dashboard and User-Controlled Workflow
FastAPI exposes the local API and serves the single-page dashboard from `src/web/server.py` and `src/web/dashboard.html`. Browser-side modules maintain job state, render and manipulate Kanban lanes, and drive drawer/search/spend-confirmation interactions in `src/web/static/js/jobStore.js`, `src/web/static/js/boardRenderer.js`, and `src/web/static/js/dashboardApp.js`. The dashboard is a control surface over persisted jobs and pipeline actions, including archives, status movement, evaluation visibility, enrichment, and task-log refreshes.

#### Runtime and External Dependencies
The application runs locally as Python/FastAPI plus browser JavaScript, with SQLite for persistence. Material external boundaries are Gemini (matching, classification, batch evaluation, outreach text), Bright Data (job scraping), Apify (contact enrichment), and Glassdoor-oriented company research. Configuration comes from environment variables documented by `.env.example`; API credentials should remain outside the database and source tree.

Main entry points: [`src/pipelines.py`](https://github.com/filmozolevskiy/justapply/blob/main/src/pipelines.py) (Workflow orchestration), [`src/core/scraper.py`](https://github.com/filmozolevskiy/justapply/blob/main/src/core/scraper.py) (Job collection), [`src/db/connection.py`](https://github.com/filmozolevskiy/justapply/blob/main/src/db/connection.py) (SQLite system of record), [`src/web/server.py`](https://github.com/filmozolevskiy/justapply/blob/main/src/web/server.py) (Dashboard API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Local entry points"]
  node_cli["CLI<br/>[cli.py]"]
  node_web_api["Dashboard API<br/>FastAPI<br/>[server.py]"]
  node_dashboard["Kanban dashboard<br/>Browser SPA<br/>[dashboardApp.js]"]
end

subgraph group_pipeline["Search and evaluation"]
  node_orchestrator["Workflow orchestration<br/>service layer<br/>[pipelines.py]"]
  node_collection["Job collection<br/>scraper adapters<br/>[scraper.py]"]
  node_admission["Admission gates<br/>filter layer"]
  node_interactive_eval["Interactive matching<br/>AI evaluator<br/>[matcher.py]"]
  node_batch_eval["Batch evaluation<br/>batch workflow"]
  node_evaluation_lock{{"Evaluation lock<br/>concurrency guard<br/>[evaluation_lock.py]"}}
end

subgraph group_data["Persistence and safety"]
  node_database[("SQLite system of record<br/>[connection.py]")]
  node_job_lifecycle["Job lifecycle repository<br/>data access<br/>[jobs.py]"]
  node_migrations["Migrations<br/>schema management<br/>[migrations.py]"]
  node_safety_gate{{"Destructive-operation safety<br/>protection boundary<br/>[gate.py]"}}
end

subgraph group_enrichment["Enrichment"]
  node_contact_enrichment["Contact enrichment<br/>enrichment workflow<br/>[coordinator.py]"]
  node_company_research["Company research<br/>enrichment workflow<br/>[preflight.py]"]
end

subgraph group_external["External services"]
  node_gemini(("Gemini<br/>AI API<br/>[gemini_client.py]"))
  node_bright_data(("Bright Data<br/>scraping API"))
  node_apify(("Apify<br/>contact-discovery API"))
  node_glassdoor(("Glassdoor intelligence<br/>research source<br/>[glassdoor_intel.py]"))
end

node_cli -->|"runs workflows"| node_orchestrator
node_web_api -->|"triggers actions"| node_orchestrator
node_dashboard -->|"local API"| node_web_api
node_orchestrator -->|"searches"| node_collection
node_collection -->|"scrapes roles"| node_bright_data
node_collection -->|"LinkedIn source"| node_apify
node_collection -->|"normalizes and stores"| node_job_lifecycle
node_job_lifecycle -->|"reads and writes"| node_database
node_migrations -->|"updates schema"| node_database
node_orchestrator -->|"filters candidates"| node_admission
node_admission -->|"admits jobs"| node_interactive_eval
node_orchestrator -->|"acquires round lock"| node_evaluation_lock
node_evaluation_lock -->|"permits bulk round"| node_batch_eval
node_batch_eval -->|"persists batch state"| node_database
node_interactive_eval -->|"evaluates jobs"| node_gemini
node_batch_eval -->|"submits and polls batches"| node_gemini
node_orchestrator -->|"enriches targeted jobs"| node_contact_enrichment
node_contact_enrichment -->|"discovers contacts"| node_apify
node_contact_enrichment -->|"classifies and drafts"| node_gemini
node_orchestrator -->|"researches companies"| node_company_research
node_company_research -->|"gathers intelligence"| node_glassdoor
node_safety_gate -->|"protects destructive actions"| node_database
node_web_api -->|"routes destructive operations"| node_safety_gate

click node_cli "https://github.com/filmozolevskiy/justapply/blob/main/src/cli/cli.py"
click node_web_api "https://github.com/filmozolevskiy/justapply/blob/main/src/web/server.py"
click node_dashboard "https://github.com/filmozolevskiy/justapply/blob/main/src/web/static/js/dashboardApp.js"
click node_orchestrator "https://github.com/filmozolevskiy/justapply/blob/main/src/pipelines.py"
click node_collection "https://github.com/filmozolevskiy/justapply/blob/main/src/core/scraper.py"
click node_admission "https://github.com/filmozolevskiy/justapply/blob/main/src/core/attribute_gating.py"
click node_interactive_eval "https://github.com/filmozolevskiy/justapply/blob/main/src/core/matcher.py"
click node_batch_eval "https://github.com/filmozolevskiy/justapply/blob/main/src/core/batch_evaluation.py"
click node_evaluation_lock "https://github.com/filmozolevskiy/justapply/blob/main/src/core/evaluation_lock.py"
click node_database "https://github.com/filmozolevskiy/justapply/blob/main/src/db/connection.py"
click node_job_lifecycle "https://github.com/filmozolevskiy/justapply/blob/main/src/db/jobs.py"
click node_migrations "https://github.com/filmozolevskiy/justapply/blob/main/src/db/migrations.py"
click node_safety_gate "https://github.com/filmozolevskiy/justapply/blob/main/src/safety/gate.py"
click node_contact_enrichment "https://github.com/filmozolevskiy/justapply/blob/main/src/core/enrichment/coordinator.py"
click node_company_research "https://github.com/filmozolevskiy/justapply/blob/main/src/core/company_research/preflight.py"
click node_gemini "https://github.com/filmozolevskiy/justapply/blob/main/src/core/gemini_client.py"
click node_apify "https://github.com/filmozolevskiy/justapply/blob/main/src/core/apify_linkedin_scraper.py"
click node_glassdoor "https://github.com/filmozolevskiy/justapply/blob/main/src/core/company_research/glassdoor_intel.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_cli,node_web_api,node_dashboard toneBlue
class node_orchestrator,node_collection,node_admission,node_interactive_eval,node_batch_eval,node_evaluation_lock toneAmber
class node_database,node_job_lifecycle,node_migrations,node_safety_gate toneMint
class node_contact_enrichment,node_company_research toneRose
class node_gemini,node_bright_data,node_apify,node_glassdoor toneIndigo
```

## Components

### Local entry points

- [CLI](https://github.com/filmozolevskiy/justapply/blob/main/src/cli/cli.py): Python CLI · Runs local search and workflow commands. · `src/cli/cli.py`
- [Dashboard API](https://github.com/filmozolevskiy/justapply/blob/main/src/web/server.py): FastAPI · Serves the local API and dashboard. · `src/web/server.py`
- [Kanban dashboard](https://github.com/filmozolevskiy/justapply/blob/main/src/web/static/js/dashboardApp.js): Browser SPA · Controls jobs, pipeline actions, and task refreshes. · `src/web/static/js/dashboardApp.js`

### Search and evaluation

- [Workflow orchestration](https://github.com/filmozolevskiy/justapply/blob/main/src/pipelines.py): service layer · Coordinates search, storage, evaluation, and lifecycle actions. · `src/pipelines.py`
- [Job collection](https://github.com/filmozolevskiy/justapply/blob/main/src/core/scraper.py): scraper adapters · Applies region and source-platform rules before normalization. · `src/core/scraper.py`
- [Admission gates](https://github.com/filmozolevskiy/justapply/blob/main/src/core/attribute_gating.py): filter layer · Enforces remote, employment, and salary requirements. · `src/core/attribute_gating.py`
- [Interactive matching](https://github.com/filmozolevskiy/justapply/blob/main/src/core/matcher.py): AI evaluator · Scores and summarizes jobs against resume profiles. · `src/core/matcher.py`
- [Batch evaluation](https://github.com/filmozolevskiy/justapply/blob/main/src/core/batch_evaluation.py): batch workflow · Submits and reconciles bulk Gemini evaluation rounds. · `src/core/batch_evaluation.py`
- [Evaluation lock](https://github.com/filmozolevskiy/justapply/blob/main/src/core/evaluation_lock.py): concurrency guard · Prevents overlapping evaluation rounds. · `src/core/evaluation_lock.py`

### Persistence and safety

- [SQLite system of record](https://github.com/filmozolevskiy/justapply/blob/main/src/db/connection.py): SQLite · Stores jobs, lifecycle state, settings, caches, and batch records. · `src/db/connection.py`
- [Job lifecycle repository](https://github.com/filmozolevskiy/justapply/blob/main/src/db/jobs.py): data access · Persists job states and workflow operations. · `src/db/jobs.py`
- [Migrations](https://github.com/filmozolevskiy/justapply/blob/main/src/db/migrations.py): schema management · `src/db/migrations.py`
- [Destructive-operation safety](https://github.com/filmozolevskiy/justapply/blob/main/src/safety/gate.py): protection boundary · Gates destructive database actions and creates snapshots. · `src/safety/gate.py`

### Enrichment

- [Contact enrichment](https://github.com/filmozolevskiy/justapply/blob/main/src/core/enrichment/coordinator.py): enrichment workflow · Caches contacts, classifies people, and drafts outreach. · `src/core/enrichment/coordinator.py`
- [Company research](https://github.com/filmozolevskiy/justapply/blob/main/src/core/company_research/preflight.py): enrichment workflow · Runs preflight and Glassdoor-oriented intelligence. · `src/core/company_research/preflight.py`

### External services

- [Gemini](https://github.com/filmozolevskiy/justapply/blob/main/src/core/gemini_client.py): AI API · Provides matching, classification, batch evaluation, and writing. · `src/core/gemini_client.py`
- **Bright Data**: scraping API
- [Apify](https://github.com/filmozolevskiy/justapply/blob/main/src/core/apify_linkedin_scraper.py): contact-discovery API · Paid discovery is limited by spend confirmation and caches. · `src/core/apify_linkedin_scraper.py`
- [Glassdoor intelligence](https://github.com/filmozolevskiy/justapply/blob/main/src/core/company_research/glassdoor_intel.py): research source · `src/core/company_research/glassdoor_intel.py`

## Connections

- CLI → Workflow orchestration: runs workflows
- Dashboard API → Workflow orchestration: triggers actions
- Kanban dashboard → Dashboard API: local API
- Workflow orchestration → Job collection: searches
- Job collection → Bright Data: scrapes roles
- Job collection → Apify: LinkedIn source
- Job collection → Job lifecycle repository: normalizes and stores
- Job lifecycle repository → SQLite system of record: reads and writes
- Migrations → SQLite system of record: updates schema
- Workflow orchestration → Admission gates: filters candidates
- Admission gates → Interactive matching: admits jobs
- Workflow orchestration → Evaluation lock: acquires round lock
- Evaluation lock → Batch evaluation: permits bulk round
- Batch evaluation → SQLite system of record: persists batch state
- Interactive matching → Gemini: evaluates jobs
- Batch evaluation → Gemini: submits and polls batches
- Workflow orchestration → Contact enrichment: enriches targeted jobs
- Contact enrichment → Apify: discovers contacts
- Contact enrichment → Gemini: classifies and drafts
- Workflow orchestration → Company research: researches companies
- Company research → Glassdoor intelligence: gathers intelligence
- Destructive-operation safety → SQLite system of record: protects destructive actions
- Dashboard API → Destructive-operation safety: routes destructive operations
