System context#
The qfa-backend runs as a single FastAPI service. This page shows what surrounds it.
Diagram#
flowchart LR
crm["EspoCRM<br/>(scripts/espo_crm/)"]
subgraph appsvc["Azure App Service"]
app["qfa-backend<br/>FastAPI + uvicorn"]
presidio["Presidio + spaCy<br/>(in-process)"]
app --- presidio
end
kv["Azure Key Vault<br/>(llm-api-key, auth-api-keys, …)"]
pg[("PostgreSQL<br/>(usage tracking)")]
litellm["LiteLLM"]
azureoai["Azure OpenAI"]
azureai["Azure AI<br/>(Mistral, etc.)"]
other["OpenAI / Anthropic / …"]
crm -->|HTTPS + Bearer auth| app
kv -.->|secret references<br/>at startup| appsvc
app -->|asyncpg + AAD token| pg
app -->|tenacity retry,<br/>anonymised input| litellm
litellm -.->|model-prefix routing| azureoai
litellm -.->|model-prefix routing| azureai
litellm -.->|model-prefix routing| other
External neighbours#
System |
Direction |
Notes |
|---|---|---|
EspoCRM |
inbound |
The primary integration. Calls the analyze/summarize/assign-codes endpoints via small server-side scripts in |
LiteLLM |
outbound |
A library that routes to the actual LLM provider based on the model string prefix ( |
PostgreSQL |
outbound |
Stores one row per LLM call for cost / token / latency reporting (table |
Presidio + spaCy |
in-process |
PII detection runs inside the app container — no network hop. |
Azure App Service |
hosting |
Runs the container. The |
Azure Key Vault |
startup-time |
Secrets ( |
Out of scope for this diagram#
GitHub Actions / Terraform. The CI/CD pipeline provisions everything above; see Infrastructure bootstrap and Set up a new environment.
Observability backends. Logs currently go to stdout / App Service log streams; no APM is wired up.