# pandharimaske/loanagent architecture

> Architecture diagram of the GitHub repository pandharimaske/loanagent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pandharimaske/loanagent
- Repository: https://github.com/pandharimaske/loanagent

## Overview

LoanAgent is a full-stack loan-management application whose main workflow takes a customer’s chat turn through session handling, multilingual processing, LangGraph orchestration, memory retrieval and conflict-aware response generation. Its memory spans structured SQLite facts, ChromaDB conversation context and session summaries. The graph also preserves authentication, administration and the frontend’s signup, login, dashboard and loan-calculator capabilities. Edges reflect the supplied excerpts and README; some implementation details, especially unsampled agent nodes and frontend API calls, are not shown.

Main entry points: [`frontend/src/App.jsx`](https://github.com/pandharimaske/loanagent/blob/main/frontend/src/App.jsx) (React app), [`backend/main.py`](https://github.com/pandharimaske/loanagent/blob/main/backend/main.py) (FastAPI application), [`backend/agent/core_nodes.py`](https://github.com/pandharimaske/loanagent/blob/main/backend/agent/core_nodes.py) (Agent processing), [`backend/api/session_routes.py`](https://github.com/pandharimaske/loanagent/blob/main/backend/api/session_routes.py) (Session routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_frontend["React app<br/>[App.jsx]"]
  node_home["Home and calculator<br/>[Home.jsx]"]
  node_signup["Signup<br/>[signup.jsx]"]
  node_login["Login<br/>[login.jsx]"]
  node_dashboard["Customer dashboard<br/>[dashboard.jsx]"]
  node_adminpanel["Admin panel<br/>[AdminPanel.jsx]"]
end

subgraph group_api["API and sessions"]
  node_server["FastAPI application<br/>[main.py]"]
  node_sessionroutes["Session routes<br/>[session_routes.py]"]
  node_chatroutes["Chat routes<br/>[chat_routes.py]"]
end

subgraph group_agent["Agent workflow"]
  node_graph["LangGraph workflow<br/>[graph.py]"]
  node_core["Agent processing<br/>[core_nodes.py]"]
  node_handlers["Turn handlers<br/>[handlers.py]"]
  node_language["Language support<br/>[language.py]"]
  node_prompts["Agent prompts<br/>[prompts.py]"]
  node_schemas["Entity schemas<br/>[schemas.py]"]
end

subgraph group_memory["Memory and storage"]
  node_retriever["Memory context builder<br/>[retriever.py]"]
  node_structured[("Structured memory<br/>[sqlite_store.py]")]
  node_vectors[("Vector memory<br/>[vector_store.py]")]
end

subgraph group_identity["Identity and admin"]
  node_authroutes["Authentication routes<br/>[auth_routes.py]"]
  node_adminroutes["Admin routes<br/>[admin_routes.py]"]
  node_users[("User and session store<br/>[user_store.py]")]
end

node_customer(("Customer"))
node_ollama["Ollama inference"]
node_claude["Claude summarization"]

node_customer -->|"uses"| node_frontend
node_frontend -->|"routes to"| node_home
node_frontend -->|"routes to"| node_signup
node_frontend -->|"routes to"| node_login
node_frontend -->|"routes to"| node_dashboard
node_frontend -->|"routes to"| node_adminpanel
node_home -->|"offers calculator"| node_customer
node_frontend -.->|"calls API"| node_server
node_server -->|"registers"| node_authroutes
node_server -->|"registers"| node_sessionroutes
node_server -->|"registers"| node_chatroutes
node_server -->|"registers"| node_adminroutes
node_authroutes -->|"manages accounts"| node_users
node_adminroutes -->|"checks admin"| node_users
node_sessionroutes -->|"shares sessions"| node_chatroutes
node_chatroutes -->|"translates turns"| node_language
node_chatroutes -->|"invokes workflow"| node_graph
node_sessionroutes -->|"runs turns"| node_graph
node_sessionroutes -->|"persists messages"| node_users
node_graph -.->|"dispatches nodes"| node_core
node_graph -.->|"routes turns"| node_handlers
node_core -->|"loads context"| node_retriever
node_handlers -->|"reads and writes facts"| node_structured
node_handlers -->|"stores chunks"| node_vectors
node_retriever -->|"loads facts"| node_structured
node_retriever -->|"searches context"| node_vectors
node_core -->|"uses"| node_prompts
node_core -->|"validates entities"| node_schemas
node_core -.->|"runs inference"| node_ollama
node_handlers -.->|"summarizes turns"| node_claude

click node_frontend "https://github.com/pandharimaske/loanagent/blob/main/frontend/src/App.jsx"
click node_home "https://github.com/pandharimaske/loanagent/blob/main/frontend/src/component/Home.jsx"
click node_signup "https://github.com/pandharimaske/loanagent/blob/main/frontend/src/component/signup.jsx"
click node_login "https://github.com/pandharimaske/loanagent/blob/main/frontend/src/component/login.jsx"
click node_dashboard "https://github.com/pandharimaske/loanagent/blob/main/frontend/src/component/dashboard.jsx"
click node_adminpanel "https://github.com/pandharimaske/loanagent/blob/main/frontend/src/component/AdminPanel.jsx"
click node_server "https://github.com/pandharimaske/loanagent/blob/main/backend/main.py"
click node_authroutes "https://github.com/pandharimaske/loanagent/blob/main/backend/api/auth_routes.py"
click node_sessionroutes "https://github.com/pandharimaske/loanagent/blob/main/backend/api/session_routes.py"
click node_chatroutes "https://github.com/pandharimaske/loanagent/blob/main/backend/api/chat_routes.py"
click node_adminroutes "https://github.com/pandharimaske/loanagent/blob/main/backend/api/admin_routes.py"
click node_graph "https://github.com/pandharimaske/loanagent/blob/main/backend/agent/graph.py"
click node_core "https://github.com/pandharimaske/loanagent/blob/main/backend/agent/core_nodes.py"
click node_handlers "https://github.com/pandharimaske/loanagent/blob/main/backend/agent/handlers.py"
click node_language "https://github.com/pandharimaske/loanagent/blob/main/backend/agent/language.py"
click node_prompts "https://github.com/pandharimaske/loanagent/blob/main/backend/agent/prompts.py"
click node_schemas "https://github.com/pandharimaske/loanagent/blob/main/backend/agent/schemas.py"
click node_retriever "https://github.com/pandharimaske/loanagent/blob/main/backend/memory/retriever.py"
click node_structured "https://github.com/pandharimaske/loanagent/blob/main/backend/memory/sqlite_store.py"
click node_vectors "https://github.com/pandharimaske/loanagent/blob/main/backend/memory/vector_store.py"
click node_users "https://github.com/pandharimaske/loanagent/blob/main/backend/auth/user_store.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_frontend,node_home,node_signup,node_login,node_dashboard,node_adminpanel toneBlue
class node_server,node_sessionroutes,node_chatroutes toneAmber
class node_graph,node_core,node_handlers,node_language,node_prompts,node_schemas toneMint
class node_retriever,node_structured,node_vectors toneRose
class node_authroutes,node_adminroutes,node_users,node_customer,node_ollama,node_claude toneIndigo
```

## Components

### Web application

- [React app](https://github.com/pandharimaske/loanagent/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Home and calculator](https://github.com/pandharimaske/loanagent/blob/main/frontend/src/component/Home.jsx): `frontend/src/component/Home.jsx`
- [Signup](https://github.com/pandharimaske/loanagent/blob/main/frontend/src/component/signup.jsx): `frontend/src/component/signup.jsx`
- [Login](https://github.com/pandharimaske/loanagent/blob/main/frontend/src/component/login.jsx): `frontend/src/component/login.jsx`
- [Customer dashboard](https://github.com/pandharimaske/loanagent/blob/main/frontend/src/component/dashboard.jsx): `frontend/src/component/dashboard.jsx`
- [Admin panel](https://github.com/pandharimaske/loanagent/blob/main/frontend/src/component/AdminPanel.jsx): `frontend/src/component/AdminPanel.jsx`

### API and sessions

- [FastAPI application](https://github.com/pandharimaske/loanagent/blob/main/backend/main.py): `backend/main.py`
- [Session routes](https://github.com/pandharimaske/loanagent/blob/main/backend/api/session_routes.py): `backend/api/session_routes.py`
- [Chat routes](https://github.com/pandharimaske/loanagent/blob/main/backend/api/chat_routes.py): `backend/api/chat_routes.py`

### Agent workflow

- [LangGraph workflow](https://github.com/pandharimaske/loanagent/blob/main/backend/agent/graph.py): `backend/agent/graph.py`
- [Agent processing](https://github.com/pandharimaske/loanagent/blob/main/backend/agent/core_nodes.py): `backend/agent/core_nodes.py`
- [Turn handlers](https://github.com/pandharimaske/loanagent/blob/main/backend/agent/handlers.py): `backend/agent/handlers.py`
- [Language support](https://github.com/pandharimaske/loanagent/blob/main/backend/agent/language.py): `backend/agent/language.py`
- [Agent prompts](https://github.com/pandharimaske/loanagent/blob/main/backend/agent/prompts.py): `backend/agent/prompts.py`
- [Entity schemas](https://github.com/pandharimaske/loanagent/blob/main/backend/agent/schemas.py): `backend/agent/schemas.py`

### Memory and storage

- [Memory context builder](https://github.com/pandharimaske/loanagent/blob/main/backend/memory/retriever.py): `backend/memory/retriever.py`
- [Structured memory](https://github.com/pandharimaske/loanagent/blob/main/backend/memory/sqlite_store.py): `backend/memory/sqlite_store.py`
- [Vector memory](https://github.com/pandharimaske/loanagent/blob/main/backend/memory/vector_store.py): `backend/memory/vector_store.py`

### Identity and admin

- [Authentication routes](https://github.com/pandharimaske/loanagent/blob/main/backend/api/auth_routes.py): `backend/api/auth_routes.py`
- [Admin routes](https://github.com/pandharimaske/loanagent/blob/main/backend/api/admin_routes.py): `backend/api/admin_routes.py`
- [User and session store](https://github.com/pandharimaske/loanagent/blob/main/backend/auth/user_store.py): `backend/auth/user_store.py`

### Other components

- **Customer**
- **Ollama inference**
- **Claude summarization**

## Connections

- Customer → React app: uses (evidence: `README.md`)
- React app → Home and calculator: routes to (evidence: `frontend/src/App.jsx`)
- React app → Signup: routes to (evidence: `frontend/src/App.jsx`)
- React app → Login: routes to (evidence: `frontend/src/App.jsx`)
- React app → Customer dashboard: routes to (evidence: `frontend/src/App.jsx`)
- React app → Admin panel: routes to (evidence: `frontend/src/App.jsx`)
- Home and calculator → Customer: offers calculator (evidence: `README.md`)
- React app → FastAPI application: calls API
- FastAPI application → Authentication routes: registers (evidence: `backend/main.py`)
- FastAPI application → Session routes: registers (evidence: `backend/main.py`)
- FastAPI application → Chat routes: registers (evidence: `backend/main.py`)
- FastAPI application → Admin routes: registers (evidence: `backend/main.py`)
- Authentication routes → User and session store: manages accounts (evidence: `backend/api/auth_routes.py`)
- Admin routes → User and session store: checks admin (evidence: `backend/api/admin_routes.py`)
- Session routes → Chat routes: shares sessions (evidence: `backend/api/session_routes.py`)
- Chat routes → Language support: translates turns (evidence: `backend/api/chat_routes.py`)
- Chat routes → LangGraph workflow: invokes workflow (evidence: `backend/api/chat_routes.py`)
- Session routes → LangGraph workflow: runs turns (evidence: `backend/api/session_routes.py`)
- Session routes → User and session store: persists messages (evidence: `backend/api/session_routes.py`)
- LangGraph workflow → Agent processing: dispatches nodes
- LangGraph workflow → Turn handlers: routes turns (evidence: `backend/agent/graph.py`)
- Agent processing → Memory context builder: loads context (evidence: `backend/agent/core_nodes.py`)
- Turn handlers → Structured memory: reads and writes facts (evidence: `backend/agent/handlers.py`)
- Turn handlers → Vector memory: stores chunks (evidence: `backend/agent/handlers.py`)
- Memory context builder → Structured memory: loads facts (evidence: `backend/memory/retriever.py`)
- Memory context builder → Vector memory: searches context (evidence: `backend/memory/retriever.py`)
- Agent processing → Agent prompts: uses (evidence: `backend/agent/core_nodes.py`)
- Agent processing → Entity schemas: validates entities (evidence: `backend/agent/core_nodes.py`)
- Agent processing → Ollama inference: runs inference
- Turn handlers → Claude summarization: summarizes turns
