Skip to content

Architecture

This page describes how the systems fit together. Each claim was checked against the source at the commits listed on the repositories page.

Diagrams can be zoomed (buttons or Ctrl+scroll), panned by dragging, and opened full screen with the Full screen button.

System context

flowchart LR
  subgraph People
    SA["Superadmin, manager, admin"]
    BD["Bidder"]
  end

  SPA["smart_apply_frontend<br/>React dashboard"]
  EXT["aetherion-copilot<br/>Chrome extension"]
  API["smart_apply_backend<br/>FastAPI"]
  DB[("MongoDB<br/>smart_apply")]
  S3[("Tigris<br/>file storage")]
  OAI["OpenAI"]
  AA["aetherion-autoapply<br/>Playwright service"]
  UNI["unicorn_aggregator<br/>FastAPI + scheduler"]
  A2["aggregator-2<br/>Express + BullMQ + Selenium"]
  A2DB[("aggregator-2<br/>MongoDB")]
  GS["Google Sheets"]

  SA --> SPA
  BD --> SPA
  BD --> EXT
  SPA -- "REST + JWT" --> API
  EXT -- "REST + JWT" --> API
  API --> DB
  API --> S3
  API --> OAI
  API -- "hourly queue<br/>POST /queue" --> AA
  AA -- "answers, files, result" --> API
  UNI -- "upsert jobs" --> DB
  A2 --> A2DB
  A2 --> GS

  classDef store fill:#eef,stroke:#669;
  class DB,S3,A2DB store;

Solid lines are verified in source. The link from unicorn_aggregator to the backend is through the shared database only: both must point at the same database name, which is not guaranteed by the defaults (see data flows). aggregator-2 has no verified link to the backend, so none is drawn.

Auto Apply, step by step

sequenceDiagram
  autonumber
  participant Sync as Backend hourly sync
  participant API as smart_apply_backend
  participant AA as aetherion-autoapply
  participant Site as Employer job page

  Sync->>API: find new matching jobs, drop duplicate companies
  Sync->>API: assign to admin, record in auto_apply_jobs
  Sync->>AA: POST /queue (job ids + admin token)
  loop each queued job
    AA->>Site: open page, fill form
    AA->>API: POST /applications/answer-form
    AA->>API: POST /applications/files (resume, cover letter)
    alt auto-submit or unattended run, and nothing is blocking
      AA->>Site: submit
    else a person is needed
      AA->>AA: wait for the admin to review and press Submit
    end
    AA->>API: POST /auto-apply/jobs/{id}/result
  end

The Auto Apply service never calls the backend's apply or status endpoints directly; the result it reports is what the backend records. Whether a job is submitted without review depends on AUTO_SUBMIT and whether the run is unattended.

Repository roles

Repository Kind Talks to
smart_apply_backend FastAPI service, system of record MongoDB, Tigris, OpenAI, aetherion-autoapply
smart_apply_frontend React single-page app Backend only
aetherion-copilot Chrome MV3 extension Backend only
unicorn_aggregator FastAPI service with a scheduler Feed providers, MongoDB, Telegram
aggregator-2 Express + BullMQ + Python scraper Job boards, its own MongoDB, Redis, Google Sheets
aetherion-autoapply FastAPI + Playwright service Backend only (no database)

How the pieces are wired

One API, two clients. The dashboard and the extension both call the backend with the same login and token. A breaking change to /auth/*, /profile or the job status endpoint affects both.

The job pool is shared through the database. unicorn_aggregator writes jobs straight into MongoDB. The backend reads the same collection. There is no HTTP call between them, so the two must agree on the job shape by hand. The default database names differ (smart-apply in the aggregator, smart_apply in the backend).

Auto Apply is driven by the backend. An hourly sync in the backend picks jobs for each opted-in admin, assigns them, and posts the queue to the Auto Apply service. The service calls back to the backend for form answers, resume files and the final result.

The aggregators are independent. aggregator-2 has its own store and its own export to Google Sheets. Nothing verified connects it to the backend.

Where the business logic lives

Concern Backend module
Jobs, status, assignment routers_jobs.py, routers_jobs_assign.py, routers_jobs_bidder.py
Roles and access authz.py, auth.py
Pay and the work ledger work_ledger.py, routers_payments.py
Retention retention.py, cron.py, routers_retention.py
AI generation util.py, form_answers.py
Resume selection resumeSelector/
Auto Apply auto_apply_*.py, routers_auto_apply.py

For the full list of routes and environment variables, see the API catalog and environment variables.