# dangesid/invoice-pro architecture

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

- Interactive diagram: https://gitdiagram.com/dangesid/invoice-pro
- Repository: https://github.com/dangesid/invoice-pro

## Overview

InvoicePro is an invoice-analysis application with a React dashboard, FastAPI backend, and a separate Streamlit interface. The main workflow is authenticated upload, document extraction and invoice analysis, then review, chat, history, and report download. Backend excerpts show parsing and retrieval responsibilities, but leave parts of ingestion and analysis orchestration unsampled; links for those stages are therefore omitted rather than inferred. The tree and excerpts also support the login/signup flow and persistent user/invoice records.

Main entry points: [`InvoicePro/backend/invoice_api.py`](https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/backend/invoice_api.py) (HTTP API), [`InvoicePro/invoice_FE/src/pages/Index.tsx`](https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/invoice_FE/src/pages/Index.tsx) (Dashboard), [`InvoicePro/invoice_FE/src/App.tsx`](https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/invoice_FE/src/App.tsx) (Route shell), [`InvoicePro/invoice_FE/src/pages/Login.tsx`](https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/invoice_FE/src/pages/Login.tsx) (Login and signup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["React dashboard"]
  node_app["Route shell<br/>[App.tsx]"]
  node_login["Login and signup<br/>[Login.tsx]"]
  node_dashboard["Dashboard<br/>[Index.tsx]"]
  node_upload["Upload zone<br/>[UploadZone.tsx]"]
  node_viewer["Document viewer<br/>[DocumentViewer.tsx]"]
  node_chatwidget["Chat widget<br/>[ChatWidget.tsx]"]
  node_history["Invoice history<br/>[InvoiceHistory.tsx]"]
  node_authclient["Auth client<br/>[auth.ts]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_api["API and identity"]
  node_fastapi["HTTP API<br/>[invoice_api.py]"]
  node_auth["Token and password auth<br/>[auth.py]"]
  node_config["Provider configuration<br/>[config.py]"]
end

subgraph group_analysis["Invoice processing"]
  node_extract["File parsers"]
  node_model{{"LLM provider"}}
  node_cli["CLI ingestion and chat<br/>[main.py]"]
end

subgraph group_state["Persistence and memory"]
  node_userdb[("User and invoice records<br/>[database.py]")]
  node_memory["Chat memory<br/>[memory_store.py]"]
end

subgraph group_streamlit["Streamlit interface"]
  node_streamlit_ui["Streamlit workspace<br/>[streamlit_ui.py]"]
end

node_user(("User"))
node_streamlit_user(("Streamlit user"))

node_user -->|"opens dashboard"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_dashboard
node_dashboard -.->|"renders"| node_upload
node_dashboard -->|"renders"| node_viewer
node_dashboard -->|"renders"| node_chatwidget
node_dashboard -.->|"renders"| node_history
node_login -.->|"uses"| node_authclient
node_dashboard -->|"uses"| node_api_client
node_dashboard -->|"requests API"| node_fastapi
node_authclient -.->|"sends authenticated requests"| node_fastapi
node_fastapi -->|"validates tokens"| node_auth
node_auth -->|"loads auth settings"| node_config
node_fastapi -->|"reads and writes records"| node_userdb
node_fastapi -->|"parses uploaded files"| node_extract
node_fastapi -->|"stores chat turns"| node_memory
node_fastapi -.->|"generates answers"| node_model
node_config -.->|"selects provider"| node_model
node_user -->|"runs commands"| node_cli
node_cli -->|"calls ingestion and chat"| node_fastapi
node_streamlit_user -->|"uses workspace"| node_streamlit_ui
node_streamlit_ui -->|"calls chat"| node_fastapi

click node_app "https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/invoice_FE/src/App.tsx"
click node_login "https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/invoice_FE/src/pages/Login.tsx"
click node_dashboard "https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/invoice_FE/src/pages/Index.tsx"
click node_upload "https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/invoice_FE/src/components/UploadZone.tsx"
click node_viewer "https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/invoice_FE/src/components/DocumentViewer.tsx"
click node_chatwidget "https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/invoice_FE/src/components/ChatWidget.tsx"
click node_history "https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/invoice_FE/src/components/InvoiceHistory.tsx"
click node_authclient "https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/invoice_FE/src/lib/auth.ts"
click node_api_client "https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/invoice_FE/src/lib/api.ts"
click node_fastapi "https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/backend/invoice_api.py"
click node_auth "https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/backend/auth.py"
click node_userdb "https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/backend/database.py"
click node_extract "https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/backend/azure_invoice_process_functions.py"
click node_memory "https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/backend/memory_store.py"
click node_config "https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/backend/config.py"
click node_cli "https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/main.py"
click node_streamlit_ui "https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/streamlit_ui.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_app,node_login,node_dashboard,node_upload,node_viewer,node_chatwidget,node_history,node_authclient,node_api_client,node_user,node_streamlit_user toneBlue
class node_fastapi,node_auth,node_config toneAmber
class node_extract,node_model,node_cli toneMint
class node_userdb,node_memory toneRose
class node_streamlit_ui toneIndigo
```

## Components

### React dashboard

- [Route shell](https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/invoice_FE/src/App.tsx): `InvoicePro/invoice_FE/src/App.tsx`
- [Login and signup](https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/invoice_FE/src/pages/Login.tsx): `InvoicePro/invoice_FE/src/pages/Login.tsx`
- [Dashboard](https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/invoice_FE/src/pages/Index.tsx): `InvoicePro/invoice_FE/src/pages/Index.tsx`
- [Upload zone](https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/invoice_FE/src/components/UploadZone.tsx): `InvoicePro/invoice_FE/src/components/UploadZone.tsx`
- [Document viewer](https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/invoice_FE/src/components/DocumentViewer.tsx): `InvoicePro/invoice_FE/src/components/DocumentViewer.tsx`
- [Chat widget](https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/invoice_FE/src/components/ChatWidget.tsx): `InvoicePro/invoice_FE/src/components/ChatWidget.tsx`
- [Invoice history](https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/invoice_FE/src/components/InvoiceHistory.tsx): `InvoicePro/invoice_FE/src/components/InvoiceHistory.tsx`
- [Auth client](https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/invoice_FE/src/lib/auth.ts): `InvoicePro/invoice_FE/src/lib/auth.ts`
- [API client](https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/invoice_FE/src/lib/api.ts): `InvoicePro/invoice_FE/src/lib/api.ts`

### API and identity

- [HTTP API](https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/backend/invoice_api.py): `InvoicePro/backend/invoice_api.py`
- [Token and password auth](https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/backend/auth.py): `InvoicePro/backend/auth.py`
- [Provider configuration](https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/backend/config.py): `InvoicePro/backend/config.py`

### Invoice processing

- [File parsers](https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/backend/azure_invoice_process_functions.py): `InvoicePro/backend/azure_invoice_process_functions.py`
- **LLM provider**
- [CLI ingestion and chat](https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/main.py): `InvoicePro/main.py`

### Persistence and memory

- [User and invoice records](https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/backend/database.py): `InvoicePro/backend/database.py`
- [Chat memory](https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/backend/memory_store.py): `InvoicePro/backend/memory_store.py`

### Streamlit interface

- [Streamlit workspace](https://github.com/dangesid/invoice-pro/blob/main/InvoicePro/streamlit_ui.py): `InvoicePro/streamlit_ui.py`

### Other components

- **User**
- **Streamlit user**

## Connections

- User → Route shell: opens dashboard
- Route shell → Login and signup: routes to (evidence: `InvoicePro/invoice_FE/src/App.tsx`)
- Route shell → Dashboard: routes to (evidence: `InvoicePro/invoice_FE/src/App.tsx`)
- Dashboard → Upload zone: renders
- Dashboard → Document viewer: renders (evidence: `InvoicePro/invoice_FE/src/pages/Index.tsx`)
- Dashboard → Chat widget: renders (evidence: `InvoicePro/invoice_FE/src/pages/Index.tsx`)
- Dashboard → Invoice history: renders
- Login and signup → Auth client: uses
- Dashboard → API client: uses (evidence: `InvoicePro/invoice_FE/src/pages/Index.tsx`)
- Dashboard → HTTP API: requests API (evidence: `InvoicePro/invoice_FE/src/pages/Index.tsx`)
- Auth client → HTTP API: sends authenticated requests
- HTTP API → Token and password auth: validates tokens (evidence: `InvoicePro/backend/invoice_api.py`)
- Token and password auth → Provider configuration: loads auth settings (evidence: `InvoicePro/backend/auth.py`)
- HTTP API → User and invoice records: reads and writes records (evidence: `InvoicePro/backend/invoice_api.py`)
- HTTP API → File parsers: parses uploaded files (evidence: `InvoicePro/backend/invoice_api.py`)
- HTTP API → Chat memory: stores chat turns (evidence: `InvoicePro/backend/invoice_api.py`)
- HTTP API → LLM provider: generates answers
- Provider configuration → LLM provider: selects provider
- User → CLI ingestion and chat: runs commands (evidence: `InvoicePro/main.py`)
- CLI ingestion and chat → HTTP API: calls ingestion and chat (evidence: `InvoicePro/main.py`)
- Streamlit user → Streamlit workspace: uses workspace (evidence: `InvoicePro/streamlit_ui.py`)
- Streamlit workspace → HTTP API: calls chat (evidence: `InvoicePro/streamlit_ui.py`)
