Copy of README.md from smart_apply_backend
Generated from smart_apply_backend/README.md at commit e15126d9. Edit the source file, not this copy.
Smart Apply Backend¶
FastAPI backend service for job application tracking, using MongoDB as the data store and JWT-based authentication.
Tech stack¶
- FastAPI
- MongoDB (Motor async driver)
- JWT auth with
python-jose
Running locally¶
- Install uv, then install dependencies for your platform.
uv synccreates.venv(Python from.python-version) and installs the locked versions fromuv.lock, including thedevgroup (pytest).
Intel Mac (local dev, no ML):
uv sync
Set RESUME_MATCHING_ENABLED=false in .env. Resume selection falls back to preferred title or the first resume.
Apple Silicon Mac, or Linux with NVIDIA GPU (production / CUDA):
uv sync --extra ml
The ml extra adds PyTorch and the embedding libraries (CUDA build on Linux, CPU/MPS on Apple Silicon).
-
Run commands inside the venv with
uv run ..., orsource .venv/bin/activate. To add or upgrade a dependency, useuv add <pkg>/uv lock --upgrade-package <pkg>and commit bothpyproject.tomlanduv.lock. -
Download the MiniLM model (skip if
RESUME_MATCHING_ENABLED=false; the spaCyen_core_web_lgmodel is already installed byuv sync):
uv run hf download sentence-transformers/all-MiniLM-L6-v2 --local-dir app/models/all-MiniLM-L6-v2
-
Export environment variables (or create a
.envfile inbackend): -
MONGODB_URI(optional, defaults tomongodb://localhost:27017) MONGODB_DB(optional, defaults tosmart_apply)JWT_SECRET_KEY(required, any strong random string)JWT_ALGORITHM(optional, defaults toHS256)ACCESS_TOKEN_EXPIRE_MINUTES(optional, defaults to60)-
RESUME_MATCHING_ENABLED(optional, defaults totrue; set tofalseon Intel Mac local dev) -
Start the API server from the project root:
uv run uvicorn app.main:app --reload --host 0.0.0.0
The API will be available at http://localhost:8000. Interactive docs are at http://localhost:8000/docs.
MONGODB_URI=
MONGODB_DB=
JWT_SECRET_KEY=
JWT_ALGORITHM=
ACCESS_TOKEN_EXPIRE_MINUTES=
OPENAI_API_KEY=
# TIGRIS Credentials (for S3)
TIGRIS_ACCESS_KEY_ID=
TIGRIS_SECRET_ACCESS_KEY=
TIGRIS_DEFAULT_REGION=
TIGRIS_S3_BUCKET_NAME=
TIGRIS_S3_ENDPOINT_URL=
Running tests¶
Unit tests live in tests/ and run with pytest. They never touch a real MongoDB, OpenAI or Tigris: tests/conftest.py sets safe environment variables before the app is imported, and the database is replaced by a fake.
uv sync
uv run pytest # run the suite
uv run pytest --cov=app # with coverage
CI¶
.github/workflows/ci.yml runs on every push to master / feature/** and on pull requests to master. It installs the locked dependencies with uv (skipping the large spaCy model, which the tests don't need), checks that app.main imports, and runs the test suite with coverage on Python 3.11 and 3.12. JUnit and coverage XML reports are uploaded as build artifacts.