GenAI app architecture: Python + FastAPI

Sefism.

A to Z

Glossary

Every concept in this sheet, plus the smaller terms it uses. Select a concept to open its card.

A
AI orchestrator
The code that turns one user message into model calls: it loads memory, rewrites the query, retrieves, builds the prompt, runs the tool loop and applies guards.
Auth and chat history in the UI
The frontend holds a session or token and loads past conversations from the backend, never from local storage alone.
Authentication and authorisation
Authentication proves who the user is; authorisation decides which chats, documents and tools they may use.
B
Business logic outside the prompt
Plans, quotas, pricing, which documents a team owns and what an action may change are decided in normal code and data, then passed to the model as facts.
C
Chat UI
Message list, input box, stop button, retry, copy, citations shown as links and a thumbs up or down on each answer.
D
Data stores in a GenAI app
Usually four: the main database (users, chats, messages), a vector index (often inside Postgres), object storage for uploads, and a cache such as Redis.
F
File uploads
The browser uploads to object storage (often with a short-lived signed URL), then tells the backend the file id so a worker can parse and index it.
M
Model client wrapper
One small module that every model call goes through.
N
No model keys in the frontend
The browser never calls the model provider directly with your API key; every call goes through your backend.
R
Rate limits and quotas
Limits per user and per IP on requests per minute, plus a daily token or cost budget per user or team.
Request flow end to end
Frontend sends the message to your backend API.
Request path vs background jobs
Chat replies run in the request.
Request validation
Check message length, file ids, conversation ownership and allowed options with a schema before doing any work.
S
Streaming to the browser
The backend sends tokens as they arrive, usually over server-sent events, and the UI appends them to the last message.
Structured logging
Every request logs a request id, user id, route, status, latency, model, tokens and cost as structured fields, not free text.
11 · Glossary, A to Z11 / 11