# imrohit44/project_synthesis_17 architecture

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

- Interactive diagram: https://gitdiagram.com/imrohit44/project_synthesis_17
- Repository: https://github.com/imrohit44/project_synthesis_17

## Overview

PyBank is a banking platform with a React client, a FastAPI banking service, and an event-driven fraud service. The principal workflow is authenticated account use and transfers: requests enter through the versioned API, banking logic persists financial state, and transfer events feed fraud assessment and downstream notifications. The graph also preserves the documented read-only LLM assistant and ticket-authenticated realtime delivery. Some subsystem wiring is based on README descriptions because the relevant source was not sampled; uncertain internal call edges are omitted.

Main entry points: [`frontend/src/app/App.tsx`](https://github.com/imrohit44/project_synthesis_17/blob/main/frontend/src/app/App.tsx) (React application), [`backend/app/application/banking.py`](https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/application/banking.py) (Banking application), [`backend/app/api/v1/router.py`](https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/api/v1/router.py) (Versioned API), [`backend/app/infrastructure/kafka.py`](https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/infrastructure/kafka.py) (Kafka transport)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Banking client"]
  node_webapp["React application<br/>[App.tsx]"]
  node_authui["Login and profile<br/>[AuthContext.tsx]"]
  node_bankui["Accounts and transfers<br/>[Transfer.tsx]"]
  node_assistantui["Assistant page<br/>[Assistant.tsx]"]
  node_apiclient["API and queries<br/>[api.ts]"]
  node_realtimehook["Realtime hook<br/>[useRealtime.ts]"]
end

subgraph group_banking["Banking service"]
  node_bankapi["Versioned API<br/>[router.py]"]
  node_authapi["Authentication API<br/>[auth.py]"]
  node_transferapi["Transfer API<br/>[transfers.py]"]
  node_assistantapi["Assistant API<br/>[assistant.py]"]
  node_bankinglogic["Banking application<br/>[banking.py]"]
  node_authlogic["Authentication logic<br/>[auth.py]"]
  node_transferdomain["Transfer domain<br/>[transfer.py]"]
  node_bankdb[("Banking database<br/>[database.py]")]
end

subgraph group_events["Events and risk"]
  node_eventoutbox[("Event outbox<br/>[outbox.py]")]
  node_kafka["Kafka transport<br/>[kafka.py]"]
  node_fraudconsumer["Fraud event consumer<br/>[kafka_consumer.py]"]
  node_riskengine["Risk assessment<br/>[risk.py]"]
  node_frauddb[("Fraud assessments<br/>[database.py]")]
  node_graphrisk["Graph risk signal<br/>[risk.py]"]
  node_riskoutbox[("Risk event outbox<br/>[outbox.py]")]
end

subgraph group_channels["Assistant and notifications"]
  node_assistantagent["Assistant agent<br/>[agent.py]"]
  node_assistanttools["Allowlisted tools<br/>[tools.py]"]
  node_notificationconsumer["Notification consumer<br/>[consumer.py]"]
  node_notificationservice["Notification dispatch<br/>[service.py]"]
  node_wsapi["Realtime API<br/>[ws.py]"]
  node_wsmanager["WebSocket manager<br/>[manager.py]"]
end

node_customer(("Customer"))
node_llm{{"LLM provider"}}
node_whatsapp{{"WhatsApp provider<br/>[whatsapp.py]"}}
node_browser(("Browser"))

node_customer -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_authui
node_webapp -->|"routes to"| node_bankui
node_webapp -->|"routes to"| node_assistantui
node_browser -->|"renders"| node_webapp
node_authui -->|"requests auth"| node_apiclient
node_bankui -->|"requests banking"| node_apiclient
node_assistantui -->|"requests chat"| node_apiclient
node_apiclient -->|"HTTP requests"| node_bankapi
node_realtimehook -->|"opens socket"| node_wsapi
node_bankapi -->|"routes auth"| node_authapi
node_authapi -->|"authenticates"| node_authlogic
node_bankapi -->|"routes transfers"| node_transferapi
node_transferapi -->|"handles transfer"| node_bankinglogic
node_bankinglogic -->|"applies rules"| node_transferdomain
node_bankinglogic -->|"reads and writes"| node_bankdb
node_bankinglogic -->|"records events"| node_eventoutbox
node_eventoutbox -->|"publishes events"| node_kafka
node_kafka -->|"delivers events"| node_fraudconsumer
node_fraudconsumer -->|"assesses risk"| node_riskengine
node_riskengine -->|"stores assessment"| node_frauddb
node_riskengine -.->|"adds graph signal"| node_graphrisk
node_fraudconsumer -->|"records result"| node_riskoutbox
node_riskoutbox -->|"publishes result"| node_kafka
node_kafka -->|"delivers events"| node_notificationconsumer
node_notificationconsumer -->|"dispatches alerts"| node_notificationservice
node_notificationservice -->|"sends realtime"| node_wsmanager
node_wsapi -->|"manages sockets"| node_wsmanager
node_notificationservice -.->|"sends alerts"| node_whatsapp
node_bankapi -->|"routes chat"| node_assistantapi
node_assistantapi -->|"invokes agent"| node_assistantagent
node_assistantagent -->|"executes tools"| node_assistanttools
node_assistantagent -.->|"requests completion"| node_llm
node_assistanttools -->|"reads banking data"| node_bankinglogic

click node_webapp "https://github.com/imrohit44/project_synthesis_17/blob/main/frontend/src/app/App.tsx"
click node_authui "https://github.com/imrohit44/project_synthesis_17/blob/main/frontend/src/app/AuthContext.tsx"
click node_bankui "https://github.com/imrohit44/project_synthesis_17/blob/main/frontend/src/pages/Transfer.tsx"
click node_assistantui "https://github.com/imrohit44/project_synthesis_17/blob/main/frontend/src/pages/Assistant.tsx"
click node_apiclient "https://github.com/imrohit44/project_synthesis_17/blob/main/frontend/src/lib/api.ts"
click node_realtimehook "https://github.com/imrohit44/project_synthesis_17/blob/main/frontend/src/lib/useRealtime.ts"
click node_bankapi "https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/api/v1/router.py"
click node_authapi "https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/api/v1/auth.py"
click node_transferapi "https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/api/v1/transfers.py"
click node_assistantapi "https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/api/v1/assistant.py"
click node_bankinglogic "https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/application/banking.py"
click node_authlogic "https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/application/auth.py"
click node_transferdomain "https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/domain/services/transfer.py"
click node_bankdb "https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/infrastructure/persistence/database.py"
click node_eventoutbox "https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/infrastructure/outbox.py"
click node_kafka "https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/infrastructure/kafka.py"
click node_fraudconsumer "https://github.com/imrohit44/project_synthesis_17/blob/main/services/fraud/app/infrastructure/kafka_consumer.py"
click node_riskengine "https://github.com/imrohit44/project_synthesis_17/blob/main/services/fraud/app/domain/risk.py"
click node_frauddb "https://github.com/imrohit44/project_synthesis_17/blob/main/services/fraud/app/infrastructure/database.py"
click node_graphrisk "https://github.com/imrohit44/project_synthesis_17/blob/main/services/fraud/graph/risk.py"
click node_riskoutbox "https://github.com/imrohit44/project_synthesis_17/blob/main/services/fraud/app/infrastructure/outbox.py"
click node_assistantagent "https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/assistant/agent.py"
click node_assistanttools "https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/assistant/tools.py"
click node_notificationconsumer "https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/notifications/consumer.py"
click node_notificationservice "https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/notifications/service.py"
click node_wsapi "https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/api/v1/ws.py"
click node_wsmanager "https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/realtime/manager.py"
click node_whatsapp "https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/notifications/whatsapp.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_webapp,node_authui,node_bankui,node_assistantui,node_apiclient,node_realtimehook,node_browser toneBlue
class node_bankapi,node_authapi,node_transferapi,node_assistantapi,node_bankinglogic,node_authlogic,node_transferdomain,node_bankdb toneAmber
class node_eventoutbox,node_kafka,node_fraudconsumer,node_riskengine,node_frauddb,node_graphrisk,node_riskoutbox toneMint
class node_assistantagent,node_assistanttools,node_notificationconsumer,node_notificationservice,node_wsapi,node_wsmanager toneRose
class node_customer,node_llm,node_whatsapp toneIndigo
```

## Components

### Banking client

- [React application](https://github.com/imrohit44/project_synthesis_17/blob/main/frontend/src/app/App.tsx): `frontend/src/app/App.tsx`
- [Login and profile](https://github.com/imrohit44/project_synthesis_17/blob/main/frontend/src/app/AuthContext.tsx): `frontend/src/app/AuthContext.tsx`
- [Accounts and transfers](https://github.com/imrohit44/project_synthesis_17/blob/main/frontend/src/pages/Transfer.tsx): `frontend/src/pages/Transfer.tsx`
- [Assistant page](https://github.com/imrohit44/project_synthesis_17/blob/main/frontend/src/pages/Assistant.tsx): `frontend/src/pages/Assistant.tsx`
- [API and queries](https://github.com/imrohit44/project_synthesis_17/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`
- [Realtime hook](https://github.com/imrohit44/project_synthesis_17/blob/main/frontend/src/lib/useRealtime.ts): `frontend/src/lib/useRealtime.ts`

### Banking service

- [Versioned API](https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/api/v1/router.py): `backend/app/api/v1/router.py`
- [Authentication API](https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/api/v1/auth.py): `backend/app/api/v1/auth.py`
- [Transfer API](https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/api/v1/transfers.py): `backend/app/api/v1/transfers.py`
- [Assistant API](https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/api/v1/assistant.py): `backend/app/api/v1/assistant.py`
- [Banking application](https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/application/banking.py): `backend/app/application/banking.py`
- [Authentication logic](https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/application/auth.py): `backend/app/application/auth.py`
- [Transfer domain](https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/domain/services/transfer.py): `backend/app/domain/services/transfer.py`
- [Banking database](https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/infrastructure/persistence/database.py): `backend/app/infrastructure/persistence/database.py`

### Events and risk

- [Event outbox](https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/infrastructure/outbox.py): `backend/app/infrastructure/outbox.py`
- [Kafka transport](https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/infrastructure/kafka.py): `backend/app/infrastructure/kafka.py`
- [Fraud event consumer](https://github.com/imrohit44/project_synthesis_17/blob/main/services/fraud/app/infrastructure/kafka_consumer.py): `services/fraud/app/infrastructure/kafka_consumer.py`
- [Risk assessment](https://github.com/imrohit44/project_synthesis_17/blob/main/services/fraud/app/domain/risk.py): `services/fraud/app/domain/risk.py`
- [Fraud assessments](https://github.com/imrohit44/project_synthesis_17/blob/main/services/fraud/app/infrastructure/database.py): `services/fraud/app/infrastructure/database.py`
- [Graph risk signal](https://github.com/imrohit44/project_synthesis_17/blob/main/services/fraud/graph/risk.py): `services/fraud/graph/risk.py`
- [Risk event outbox](https://github.com/imrohit44/project_synthesis_17/blob/main/services/fraud/app/infrastructure/outbox.py): `services/fraud/app/infrastructure/outbox.py`

### Assistant and notifications

- [Assistant agent](https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/assistant/agent.py): `backend/app/assistant/agent.py`
- [Allowlisted tools](https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/assistant/tools.py): `backend/app/assistant/tools.py`
- [Notification consumer](https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/notifications/consumer.py): `backend/app/notifications/consumer.py`
- [Notification dispatch](https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/notifications/service.py): `backend/app/notifications/service.py`
- [Realtime API](https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/api/v1/ws.py): `backend/app/api/v1/ws.py`
- [WebSocket manager](https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/realtime/manager.py): `backend/app/realtime/manager.py`

### Other components

- **Customer**
- **LLM provider**
- [WhatsApp provider](https://github.com/imrohit44/project_synthesis_17/blob/main/backend/app/notifications/whatsapp.py): `backend/app/notifications/whatsapp.py`
- **Browser**

## Connections

- Customer → React application: uses
- React application → Login and profile: routes to
- React application → Accounts and transfers: routes to
- React application → Assistant page: routes to
- Browser → React application: renders
- Login and profile → API and queries: requests auth
- Accounts and transfers → API and queries: requests banking
- Assistant page → API and queries: requests chat
- API and queries → Versioned API: HTTP requests
- Realtime hook → Realtime API: opens socket
- Versioned API → Authentication API: routes auth
- Authentication API → Authentication logic: authenticates
- Versioned API → Transfer API: routes transfers
- Transfer API → Banking application: handles transfer
- Banking application → Transfer domain: applies rules
- Banking application → Banking database: reads and writes
- Banking application → Event outbox: records events
- Event outbox → Kafka transport: publishes events
- Kafka transport → Fraud event consumer: delivers events
- Fraud event consumer → Risk assessment: assesses risk
- Risk assessment → Fraud assessments: stores assessment
- Risk assessment → Graph risk signal: adds graph signal
- Fraud event consumer → Risk event outbox: records result
- Risk event outbox → Kafka transport: publishes result
- Kafka transport → Notification consumer: delivers events
- Notification consumer → Notification dispatch: dispatches alerts
- Notification dispatch → WebSocket manager: sends realtime
- Realtime API → WebSocket manager: manages sockets
- Notification dispatch → WhatsApp provider: sends alerts
- Versioned API → Assistant API: routes chat
- Assistant API → Assistant agent: invokes agent
- Assistant agent → Allowlisted tools: executes tools
- Assistant agent → LLM provider: requests completion
- Allowlisted tools → Banking application: reads banking data
