fastapi

  • Database-Driven RBAC with FastAPI and Azure Entra ID

    This came out of a coaching project: a FastAPI service backing a geotechnical database. We use Azure Entra ID for authentication, but we needed role-based access control (RBAC) granularly per endpoint and across different user roles. It turned into an interesting sprint where we designed it so that role changes did not require code changes.

  • One Core, Two Interfaces, No Rewrites

    When building applications, I always build the core first, then the interfaces. It was no different with Ask the Canon: a uv run main.py ask "..." CLI for quick iteration and validation, then the web app for MVP. Search, ranking, citations, all using the same engine.

  • Two Python Scoping Bugs: A Lesson in Object Lifetimes

    Your app works fine with one user. You open a second browser tab and the data is wrong. Your tests pass individually but fail when run together. The culprit: a global object created at module scope.

  • The Repository Pattern: Swap Data Sources in One Line

    Your live data source just broke. The API provider changed their auth overnight, no warning, no migration path. Now your entire app is blocked.