ADR 0002: Python, FastAPI and PostgreSQL as the core stack¶
Status: Proposed
Date: 2026-12-02
Context¶
The backend talks almost entirely to Microsoft Graph over HTTP, needs high I/O concurrency, a job queue, a searchable catalog, and should be easy for contributors and admins to read and extend.
Decision¶
Python 3.13 with
asyncio, FastAPI, Pydantic v2.PostgreSQL 17 for configuration, catalog and full-text item search.
Procrastinate (PostgreSQL-backed) for the job queue and periodic tasks, instead of adding Redis or RabbitMQ.
Own thin Graph client on
httpx+msal, instead of the generated Graph SDK.
Consequences¶
Fewer containers to operate: one image, one database.
Pydantic models double as module config schemas and as UI form definitions.
CPU-heavy work (hashing, compression, encryption) runs in native libraries (
blake3,zstandard,cryptography) so Python is not the bottleneck; throughput scales by adding worker containers.If PostgreSQL-as-queue ever becomes a bottleneck, the queue is behind an interface and can be swapped.