Skip to main content

Dependency Management

Principles

  1. Prefer standard library when possible
  2. Minimal dependencies — justify every external package
  3. Pin versions — use requirements.txt with pinned versions for backend; package-lock.json for frontend
  4. Audit regularly — check for vulnerabilities before major releases

Backend (Python) — Core Dependencies

These are in use. Do not replace without a strong reason.

PackageVersionPurpose
fastapilatest stableWeb framework + OpenAPI docs
uvicorn[standard]latest stableASGI server
sqlalchemy[asyncio]2.xORM with async support
asyncpglatest stablePostgreSQL async driver
alembiclatest stableDatabase migrations
pydanticv2.xData validation, settings
pydantic-settingslatest stableConfig from env vars
python-jose[cryptography]latest stableJWT creation and validation
passlib[bcrypt]latest stablePassword hashing
python-multipartlatest stableForm data (login endpoint)
httpxlatest stableAsync HTTP client (lessons service)
aiofileslatest stableAsync file I/O
pylxdlatest stableLXD API client
paramikolatest stableSSH for container verification
redislatest stableRedis client (session/cache)

Backend (Python) — Dev Dependencies

PackagePurpose
pytestTest runner
pytest-asyncioAsync test support
httpxTest client for FastAPI (also used in app)

Frontend (JavaScript) — Core Dependencies

PackagePurpose
vue^3.x — UI framework
vue-router^4.x — SPA routing
axiosHTTP client — all API calls via services/api.js
markedMarkdown → HTML parsing (lesson content)
dompurifyHTML sanitization (required before v-html)
xtermTerminal emulator (WebSocket terminal component)
@xterm/addon-fitXTerm resize addon
chart.jsAnalytics/progress charts

Frontend — Dev Dependencies

PackagePurpose
viteBuild tool + dev server
@vitejs/plugin-vueVue SFC support for Vite
vitestTest runner (not yet configured)
@vue/test-utilsVue component testing (not yet configured)

Adding New Dependencies

Backend

  1. Check if stdlib or an approved package already does it
  2. Evaluate: maintained? stable API? minimal transitive deps?
  3. Add to requirements.txt with pinned version
  4. Document the reason in the PR description

Frontend

  1. Check if an existing package (axios, marked) already covers it
  2. Prefer packages with ESM support (works with Vite)
  3. Add to package.json, commit package-lock.json

Updating Dependencies

  • Security patches: update immediately
  • Minor/patch updates: batch monthly in a dedicated branch
  • Major updates: plan separately, review breaking changes, test thoroughly
  • Run pip list --outdated and npm outdated to check for updates

CI Checks

# Backend
pip install -r requirements.txt
# (no automated audit tool yet — check manually with: pip-audit)

# Frontend
npm ci # Reproducible install from lockfile
npm audit # Check for vulnerabilities