Build an AI-Powered Digital Bank with RAG: the explanation
Eighteen illustrated modules that take a working system apart. The system is in ../source-code/: a digital bank whose AI assistant answers customers from the bank's own documents and the customer's own data, and moves money only after the customer approves. Admins upload the documents and watch quality.
Who it is for: anyone who knows a little Python and wants to understand, rebuild or extend a production-style AI application, from beginners to working engineers. Each module says what to read first.
How each module is laid out
Every module explains one part of the system in the same order, so you always know where to look.
| Section | Answers |
|---|---|
| Where this fits | the same architecture map in every module, with this module's parts highlighted |
| What it does | the idea in one picture |
| How it works | the mechanism step by step, one figure per step, with real data |
| Code tour | the real files, short excerpts, every line explained in plain words |
| Design decisions | what was chosen, the alternatives, and why, with measured numbers |
| What can go wrong | failures and attacks, how the code handles each, and the test that proves it |
| Try it yourself | exact commands and what you should see |
| When to choose differently | (inside Design decisions) the scenarios where another technique wins, and whether this project already has a setting for it |
| Check yourself, Key terms | a short quiz and a glossary |
Figures use one colour language: blue is our system, amber is the model or anything uncertain, green is correct or safe, red is failure or attack, grey is background.
Modules
| # | Module | Main code |
|---|---|---|
| 0 | Project overview: a guided tour of the running app | screenshots of the real app, no code |
| 1 | The problem a bank assistant solves | scripts/plain_vs_grounded.py, core/rbac.py, evals/datasets |
| 2 | The solution: retrieval, tools and approval | agent/graph.py, agent/tools.py |
| 3 | Infrastructure decisions | pyproject.toml, docker-compose.yml, core/config.py |
| 4 | High-level design | main.py, services/assistant_service.py |
| 5 | Low-level design | models/, alembic/, schemas/ |
| 6 | Authentication and RBAC | core/security.py, core/rbac.py, services/auth_service.py |
| 7 | Core banking and synthetic customers | services/banking_service.py, services/seed.py |
| 8 | Document ingestion | rag/parsing.py, rag/chunking.py, rag/ingest.py |
| 9 | Hybrid retrieval | rag/retriever.py |
| 10 | The agent | agent/graph.py, agent/tools.py |
| 11 | Model routing: two models | agent/router.py, agent/llm.py, observability/costs.py |
| 12 | Guardrails and PII masking | agent/guardrails.py, core/pii.py |
| 13 | Prompt versioning | services/prompt_service.py, models/prompt.py |
| 14 | Evaluation | evals/ |
| 15 | Observability | observability/, core/logging.py |
| 16 | The frontend and running it locally | frontend/src, Makefile, tests/ |
| 17 | Containers: the Dockerfiles and the local stack | backend/Dockerfile, frontend/Dockerfile, frontend/nginx.conf.template, docker-compose.yml |
| 18 | Deploying to Google Cloud step by step, with CI/CD | deploy/gcp/, .github/workflows/ci.yml, .github/workflows/deploy.yml |