# iamyogeshmohan/nexguard-ai-wallet architecture

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

- Interactive diagram: https://gitdiagram.com/iamyogeshmohan/nexguard-ai-wallet
- Repository: https://github.com/iamyogeshmohan/nexguard-ai-wallet

## Overview

NexGuard is a simulated digital-wallet and payment platform paired with a bank security operations center. A customer authenticates, submits a payment with device and transaction telemetry, and receives an allow, verify, or block decision; analysts monitor alerts and can remediate accounts and incidents. The graph includes the documented mobile, SOC, and supporting risk capabilities. Some links rely on README architecture descriptions because frontend pages and several backend routers were not sampled.

Main entry points: [`backend/app/main.py`](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/main.py) (FastAPI application), [`backend/app/models.py`](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/models.py) (Wallet and risk records), [`backend/app/routers/transactions.py`](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/routers/transactions.py) (Transaction lifecycle), [`backend/app/websocket.py`](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/websocket.py) (Live event channels)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Customer experience"]
  node_wallet_ui["Mobile wallet<br/>[page.tsx]"]
  node_payment_flow_ui["Send payment flow<br/>[page.tsx]"]
  node_auth_ui["Customer authentication<br/>[page.tsx]"]
  node_soc_ui["SOC command center<br/>[page.tsx]"]
  node_server_ui["Server operations UI<br/>[page.tsx]"]
  node_frontend_api["API client<br/>[api.ts]"]
end

subgraph group_payment["Payment and identity API"]
  node_api["FastAPI application<br/>[main.py]"]
  node_auth["Authentication routes<br/>[auth.py]"]
  node_wallet["Wallet routes<br/>[wallet.py]"]
  node_transactions["Transaction lifecycle<br/>[transactions.py]"]
  node_account_routes["Account controls<br/>[accounts.py]"]
end

subgraph group_risk["Risk assessment"]
  node_agents["Multi-agent risk engine<br/>[agents.py]"]
end

subgraph group_operations["SOC operations"]
  node_soc_routes["SOC and threat intelligence<br/>[soc.py]"]
  node_server_ops["Platform operations<br/>[server_ops.py]"]
  node_incidents["Incident handling<br/>[incidents.py]"]
  node_websocket["Live event channels<br/>[websocket.py]"]
end

subgraph group_platform["Shared platform services"]
  node_database["Database access<br/>[database.py]"]
  node_models[("Wallet and risk records<br/>[models.py]")]
  node_audit["Audit log service<br/>[audit.py]"]
  node_security["Token and access security<br/>[security.py]"]
  node_bootstrap["Demo data bootstrap<br/>[bootstrap.py]"]
end

node_customer(("Wallet customer"))

node_customer -->|"uses"| node_wallet_ui
node_customer -->|"authenticates"| node_auth_ui
node_wallet_ui -->|"starts payment"| node_payment_flow_ui
node_payment_flow_ui -.->|"submits request"| node_frontend_api
node_auth_ui -.->|"sends credentials"| node_frontend_api
node_frontend_api -.->|"calls API"| node_api
node_api -->|"routes requests"| node_auth
node_api -->|"routes requests"| node_wallet
node_api -->|"routes requests"| node_transactions
node_api -->|"routes requests"| node_incidents
node_api -->|"routes requests"| node_soc_routes
node_api -->|"serves channels"| node_websocket
node_api -->|"seeds demo data"| node_bootstrap
node_transactions -->|"evaluates risk"| node_agents
node_transactions -->|"records payment"| node_models
node_transactions -->|"queries database"| node_database
node_transactions -->|"writes audit log"| node_audit
node_transactions -->|"notifies SOC"| node_websocket
node_agents -->|"returns decision"| node_transactions
node_auth -->|"uses token security"| node_security
node_auth -->|"queries users"| node_models
node_wallet -->|"reads wallet records"| node_models
node_wallet -->|"queries database"| node_database
node_account_routes -->|"publishes updates"| node_websocket
node_account_routes -->|"writes audit log"| node_audit
node_account_routes -->|"updates accounts"| node_models
node_soc_ui -.->|"requests SOC data"| node_frontend_api
node_server_ui -.->|"requests operations data"| node_frontend_api
node_soc_routes -->|"reports agent status"| node_agents
node_soc_routes -->|"reads SOC records"| node_models
node_server_ops -->|"monitors records"| node_models
node_server_ops -->|"sends notifications"| node_websocket
node_server_ops -->|"records actions"| node_audit
node_incidents -.->|"alerts analysts"| node_websocket
node_bootstrap -->|"seeds records"| node_models
node_bootstrap -->|"uses security utilities"| node_security
node_audit -->|"creates audit records"| node_models
node_models -->|"binds ORM base"| node_database
node_websocket -->|"streams SOC events"| node_soc_ui

click node_wallet_ui "https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/frontend/src/app/mobile/dashboard/page.tsx"
click node_payment_flow_ui "https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/frontend/src/app/wallet/send/page.tsx"
click node_auth_ui "https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/frontend/src/app/register/page.tsx"
click node_soc_ui "https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/frontend/src/app/soc/page.tsx"
click node_server_ui "https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/frontend/src/app/server/page.tsx"
click node_frontend_api "https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/frontend/src/lib/api.ts"
click node_api "https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/main.py"
click node_auth "https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/routers/auth.py"
click node_wallet "https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/routers/wallet.py"
click node_transactions "https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/routers/transactions.py"
click node_account_routes "https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/routers/accounts.py"
click node_agents "https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/agents.py"
click node_soc_routes "https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/routers/soc.py"
click node_server_ops "https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/routers/server_ops.py"
click node_incidents "https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/routers/incidents.py"
click node_websocket "https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/websocket.py"
click node_database "https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/database.py"
click node_models "https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/models.py"
click node_audit "https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/audit.py"
click node_security "https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/security.py"
click node_bootstrap "https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/bootstrap.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_wallet_ui,node_payment_flow_ui,node_auth_ui,node_soc_ui,node_server_ui,node_frontend_api toneBlue
class node_api,node_auth,node_wallet,node_transactions,node_account_routes toneAmber
class node_agents toneMint
class node_soc_routes,node_server_ops,node_incidents,node_websocket toneRose
class node_database,node_models,node_audit,node_security,node_bootstrap,node_customer toneIndigo
```

## Components

### Customer experience

- [Mobile wallet](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/frontend/src/app/mobile/dashboard/page.tsx): `frontend/src/app/mobile/dashboard/page.tsx`
- [Send payment flow](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/frontend/src/app/wallet/send/page.tsx): `frontend/src/app/wallet/send/page.tsx`
- [Customer authentication](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/frontend/src/app/register/page.tsx): `frontend/src/app/register/page.tsx`
- [SOC command center](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/frontend/src/app/soc/page.tsx): `frontend/src/app/soc/page.tsx`
- [Server operations UI](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/frontend/src/app/server/page.tsx): `frontend/src/app/server/page.tsx`
- [API client](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### Payment and identity API

- [FastAPI application](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication routes](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [Wallet routes](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/routers/wallet.py): `backend/app/routers/wallet.py`
- [Transaction lifecycle](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/routers/transactions.py): `backend/app/routers/transactions.py`
- [Account controls](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/routers/accounts.py): `backend/app/routers/accounts.py`

### Risk assessment

- [Multi-agent risk engine](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/agents.py): `backend/app/agents.py`

### SOC operations

- [SOC and threat intelligence](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/routers/soc.py): `backend/app/routers/soc.py`
- [Platform operations](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/routers/server_ops.py): `backend/app/routers/server_ops.py`
- [Incident handling](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/routers/incidents.py): `backend/app/routers/incidents.py`
- [Live event channels](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/websocket.py): `backend/app/websocket.py`

### Shared platform services

- [Database access](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/database.py): `backend/app/database.py`
- [Wallet and risk records](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/models.py): `backend/app/models.py`
- [Audit log service](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/audit.py): `backend/app/audit.py`
- [Token and access security](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/security.py): `backend/app/security.py`
- [Demo data bootstrap](https://github.com/iamyogeshmohan/nexguard-ai-wallet/blob/main/backend/app/bootstrap.py): `backend/app/bootstrap.py`

### Other components

- **Wallet customer**

## Connections

- Wallet customer → Mobile wallet: uses
- Wallet customer → Customer authentication: authenticates
- Mobile wallet → Send payment flow: starts payment
- Send payment flow → API client: submits request
- Customer authentication → API client: sends credentials
- API client → FastAPI application: calls API
- FastAPI application → Authentication routes: routes requests (evidence: `backend/app/main.py`)
- FastAPI application → Wallet routes: routes requests (evidence: `backend/app/main.py`)
- FastAPI application → Transaction lifecycle: routes requests (evidence: `backend/app/main.py`)
- FastAPI application → Incident handling: routes requests (evidence: `backend/app/main.py`)
- FastAPI application → SOC and threat intelligence: routes requests (evidence: `backend/app/main.py`)
- FastAPI application → Live event channels: serves channels (evidence: `backend/app/main.py`)
- FastAPI application → Demo data bootstrap: seeds demo data (evidence: `backend/app/main.py`)
- Transaction lifecycle → Multi-agent risk engine: evaluates risk (evidence: `backend/app/routers/transactions.py`)
- Transaction lifecycle → Wallet and risk records: records payment (evidence: `backend/app/routers/transactions.py`)
- Transaction lifecycle → Database access: queries database (evidence: `backend/app/routers/transactions.py`)
- Transaction lifecycle → Audit log service: writes audit log (evidence: `backend/app/routers/transactions.py`)
- Transaction lifecycle → Live event channels: notifies SOC (evidence: `backend/app/routers/transactions.py`)
- Multi-agent risk engine → Transaction lifecycle: returns decision (evidence: `backend/app/routers/transactions.py`)
- Authentication routes → Token and access security: uses token security (evidence: `backend/app/routers/auth.py`)
- Authentication routes → Wallet and risk records: queries users (evidence: `backend/app/routers/auth.py`)
- Wallet routes → Wallet and risk records: reads wallet records (evidence: `backend/app/routers/wallet.py`)
- Wallet routes → Database access: queries database (evidence: `backend/app/routers/wallet.py`)
- Account controls → Live event channels: publishes updates (evidence: `backend/app/routers/accounts.py`)
- Account controls → Audit log service: writes audit log (evidence: `backend/app/routers/accounts.py`)
- Account controls → Wallet and risk records: updates accounts (evidence: `backend/app/routers/accounts.py`)
- SOC command center → API client: requests SOC data
- Server operations UI → API client: requests operations data
- SOC and threat intelligence → Multi-agent risk engine: reports agent status (evidence: `backend/app/routers/soc.py`)
- SOC and threat intelligence → Wallet and risk records: reads SOC records (evidence: `backend/app/routers/soc.py`)
- Platform operations → Wallet and risk records: monitors records (evidence: `backend/app/routers/server_ops.py`)
- Platform operations → Live event channels: sends notifications (evidence: `backend/app/routers/server_ops.py`)
- Platform operations → Audit log service: records actions (evidence: `backend/app/routers/server_ops.py`)
- Incident handling → Live event channels: alerts analysts
- Demo data bootstrap → Wallet and risk records: seeds records (evidence: `backend/app/bootstrap.py`)
- Demo data bootstrap → Token and access security: uses security utilities (evidence: `backend/app/bootstrap.py`)
- Audit log service → Wallet and risk records: creates audit records (evidence: `backend/app/audit.py`)
- Wallet and risk records → Database access: binds ORM base (evidence: `backend/app/models.py`)
- Live event channels → SOC command center: streams SOC events
