smart_apply_backend¶
Role. The backend API and system of record. It holds jobs, accounts, pay, AI generation and the Auto Apply orchestration. Both the dashboard and the extension call it.
Stack. Python 3.11+, FastAPI, Motor (MongoDB), Pydantic v2, APScheduler, OpenAI, reportlab (PDFs), boto3 (Tigris object storage). Resume matching uses spaCy and an optional embedding model. Dependencies are managed with uv (pyproject.toml, uv.lock).
Entry points¶
app/main.pycreates the app. On startup it ensures database indexes, backfills the work ledger and starts the scheduler.GET /healthreports status.start.shis the production command. It runs one uvicorn worker.- Development:
uv run uvicorn app.main:app --reload.
Layout¶
The code is a flat app/ package. Routers are grouped by area.
| Area | Files |
|---|---|
| Routers | auth.py, routers_jobs*.py, routers_app.py, routers_admin.py, routers_manager.py, routers_payments.py, routers_profile.py, routers_qa.py, routers_retention.py, routers_auto_apply.py |
| Core | models.py, database.py, config.py, authz.py, jobs_common.py, validation.py |
| Business logic | work_ledger.py, retention.py, cron.py, bidder_merge.py, applied_companies.py |
| Auto Apply | auto_apply_*.py |
| AI and files | util.py, form_answers.py, tigris.py, resumeSelector/ |
| Company matching | company_dedup/ |
Scripts in scripts/ are one-off database migrations and seed tools. Tests are in tests/.
Interfaces¶
- HTTP API: API catalog (about 100 routes).
- Environment variables: environment variables.
- Feature pages: job pool, assignment, pay, Auto Apply, retention.
Documentation and CI¶
CLAUDE.mdholds the detailed architecture notes and the rules that must be followed (for example, every assignment path must call a ledgerrecord_*helper).- CI (
.github/workflows/ci.yml) runs on pushes tomasterandfeature/**: a Python 3.11/3.12 matrix with tests and coverage. - Deploy (
deploy.yml) is manual and deploys to Railway.
Known issues¶
- CORS allows any origin without credentials. Tighten it for production.
- Single-worker design: the in-memory caches and scheduler assume one process.