ProjectBuild an AI-Powered Digital Bank with RAG: the explanation · Module 5: Low-level design: data, API and state · part 7 of 20
Part 7 · Module 5: Low-level design: data, API and state

Module 5: Low-level design: data, API and state

22 min read·
About 40 minutes · Needs: Module 1; Module 4 (high-level design) helps · Code: backend/app/models/, backend/alembic/, backend/app/schemas/__init__.py, backend/app/agent/graph.py

Where this fits

WHERE THIS FITS The Kestrel Bank system this module CLIENT API LAYER FastAPI SAFETY AGENT LangGraph MODELS RETRIEVAL DATA AND INGESTION Postgres, Redis QUALITY Langfuse Customer app React Admin app React FastAPI REST + streaming Auth + RBAC tokens, roles Document upload admin only, checked Guardrails injection, PII Router small or large Agent LangGraph Banking tools ledger, transfers LLMs Groq, Gemini Retrieval hybrid + rerank Ingestion parse, chunk, embed PostgreSQL + pgvector ledger, chunks, state Redis limits, queue Observability Langfuse, metrics, logs Evaluation golden set, release gate
Blue: the parts whose contracts this module defines. The API, the ledger, the agent and the tables under them.

High-level design named the boxes. This module zooms into what passes between them: the tables in Postgres, the request and response shapes on the API, and the state the agent carries through a turn. Every later module builds on these three contracts.

The rest of this project is yours to keep

This project is bought on its own, once, and stays readable afterwards, including the parts added to it later.

Or open everything with a plan