ProjectBuild an AI-Powered Digital Bank with RAG: the explanation · Module 6: Authentication and role-based access control · part 8 of 20
Part 8 · Module 6: Authentication and role-based access control

Module 6: Authentication and role-based access control

24 min read·
About 40 minutes · Needs: Module 1 (the two roles) · Code: backend/app/core/security.py, backend/app/services/auth_service.py, backend/app/api/deps.py, backend/app/core/rbac.py, frontend/src/lib/api.ts

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
Auth and RBAC (blue) sit at the front door of the API: every customer and admin request passes them, with users and tokens in Postgres and rate limits in Redis.

Every request passes through this part first. If it gets something wrong, nothing behind it can be trusted. This module opens the "Auth + RBAC" box, with its tables in Postgres and its counters in Redis.

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