# sadika-dotcom/finpilot-ai architecture

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

- Interactive diagram: https://gitdiagram.com/sadika-dotcom/finpilot-ai
- Repository: https://github.com/sadika-dotcom/finpilot-ai

## Overview

RemitWise is a remittance assistant API. A user sends a chat message; the chat handler can ask for a transaction ID, return a rate-alert action, or calculate transfer options and use Gemini to explain them. The calculator fetches a live USD-to-BDT rate, falling back to a stale rate if needed, then ranks provider estimates. The API returns text plus optional structured data or an action. The shown code does not implement transaction lookup or alert delivery; those branches only return prompts or action payloads.

Main entry points: [`main.py`](https://github.com/sadika-dotcom/finpilot-ai/blob/main/main.py) (Chat Handler), [`calculator.py`](https://github.com/sadika-dotcom/finpilot-ai/blob/main/calculator.py) (Transfer Comparison)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_chat["Chat API"]
  node_chat_api["Chat Endpoint<br/>[main.py]"]
  node_chat_handler["Chat Handler<br/>[main.py]"]
  node_troubleshooting["Delay Triage<br/>[main.py]"]
  node_alert_action["Alert Action<br/>[main.py]"]
  node_chat_response["Chat Response<br/>[main.py]"]
end

subgraph group_calc["Transfer Calculations"]
  node_transfer_comparison["Transfer Comparison<br/>[calculator.py]"]
  node_live_rate["Live Rate Lookup<br/>[calculator.py]"]
end

subgraph group_external["External Services"]
  node_gemini["Gemini AI"]
  node_exchange_api["Exchange Rate API"]
end

node_user(("User"))

node_user -->|"sends message"| node_chat_api
node_chat_api -->|"dispatches"| node_chat_handler
node_chat_handler -->|"handles delay queries"| node_troubleshooting
node_chat_handler -->|"returns alert action"| node_alert_action
node_chat_handler -->|"calculates transfers"| node_transfer_comparison
node_transfer_comparison -->|"gets rate"| node_live_rate
node_live_rate -->|"requests rates"| node_exchange_api
node_chat_handler -->|"requests explanation"| node_gemini
node_chat_handler -->|"returns result"| node_chat_response
node_troubleshooting -->|"returns prompt"| node_chat_response
node_alert_action -->|"returns action"| node_chat_response
node_user -->|"receives reply"| node_chat_response

click node_chat_api "https://github.com/sadika-dotcom/finpilot-ai/blob/main/main.py"
click node_chat_handler "https://github.com/sadika-dotcom/finpilot-ai/blob/main/main.py"
click node_troubleshooting "https://github.com/sadika-dotcom/finpilot-ai/blob/main/main.py"
click node_alert_action "https://github.com/sadika-dotcom/finpilot-ai/blob/main/main.py"
click node_chat_response "https://github.com/sadika-dotcom/finpilot-ai/blob/main/main.py"
click node_transfer_comparison "https://github.com/sadika-dotcom/finpilot-ai/blob/main/calculator.py"
click node_live_rate "https://github.com/sadika-dotcom/finpilot-ai/blob/main/calculator.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_chat_api,node_chat_handler,node_troubleshooting,node_alert_action,node_chat_response,node_user toneBlue
class node_transfer_comparison,node_live_rate toneAmber
class node_gemini,node_exchange_api toneMint
```

## Components

### Chat API

- [Chat Endpoint](https://github.com/sadika-dotcom/finpilot-ai/blob/main/main.py): `main.py`
- [Chat Handler](https://github.com/sadika-dotcom/finpilot-ai/blob/main/main.py): `main.py`
- [Delay Triage](https://github.com/sadika-dotcom/finpilot-ai/blob/main/main.py): `main.py`
- [Alert Action](https://github.com/sadika-dotcom/finpilot-ai/blob/main/main.py): `main.py`
- [Chat Response](https://github.com/sadika-dotcom/finpilot-ai/blob/main/main.py): `main.py`

### Transfer Calculations

- [Transfer Comparison](https://github.com/sadika-dotcom/finpilot-ai/blob/main/calculator.py): `calculator.py`
- [Live Rate Lookup](https://github.com/sadika-dotcom/finpilot-ai/blob/main/calculator.py): `calculator.py`

### External Services

- **Gemini AI**
- **Exchange Rate API**

### Other components

- **User**

## Connections

- User → Chat Endpoint: sends message (evidence: `main.py`)
- Chat Endpoint → Chat Handler: dispatches (evidence: `main.py`)
- Chat Handler → Delay Triage: handles delay queries (evidence: `main.py`)
- Chat Handler → Alert Action: returns alert action (evidence: `main.py`)
- Chat Handler → Transfer Comparison: calculates transfers (evidence: `main.py`)
- Transfer Comparison → Live Rate Lookup: gets rate (evidence: `calculator.py`)
- Live Rate Lookup → Exchange Rate API: requests rates (evidence: `calculator.py`)
- Chat Handler → Gemini AI: requests explanation (evidence: `main.py`)
- Chat Handler → Chat Response: returns result (evidence: `main.py`)
- Delay Triage → Chat Response: returns prompt (evidence: `main.py`)
- Alert Action → Chat Response: returns action (evidence: `main.py`)
- User → Chat Response: receives reply (evidence: `main.py`)
