# sharegear01-lang/ai_accounting architecture

> Architecture diagram of the GitHub repository sharegear01-lang/ai_accounting, 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/sharegear01-lang/ai_accounting
- Repository: https://github.com/sharegear01-lang/ai_accounting

## Overview

AIAcct is a personal/family bookkeeping assistant: users describe transactions or submit receipt screenshots, then the assistant extracts or reasons about transaction details, stores or queries records, and routes edits/deletions through human approval. The graph includes the Vue client, authenticated API, OCR and agent stages, transaction persistence, and session checkpoints. Edges are limited to relationships evidenced by excerpts, the source index, or README; several internal graph-node connections are not detailed in the sampled code.

Main entry points: [`app/api/chat.py`](https://github.com/sharegear01-lang/ai_accounting/blob/main/app/api/chat.py) (Chat Route), [`frontend/src/api/index.js`](https://github.com/sharegear01-lang/ai_accounting/blob/main/frontend/src/api/index.js) (API Client), [`app/api/transactions.py`](https://github.com/sharegear01-lang/ai_accounting/blob/main/app/api/transactions.py) (Transaction Routes), [`app/agent/tools/crud.py`](https://github.com/sharegear01-lang/ai_accounting/blob/main/app/agent/tools/crud.py) (Transaction Tools)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Vue Client"]
  node_webapp["Vue App<br/>[main.js]"]
  node_chatui["Chat Interface<br/>[ChatPanel.vue]"]
  node_approval["Approval Card<br/>[ApprovalCard.vue]"]
  node_transactionui["Transaction Views<br/>[Dashboard.vue]"]
  node_transactionform["Transaction Form"]
  node_clientapi["API Client<br/>[index.js]"]
end

subgraph group_api["API and Identity"]
  node_authapi["Auth Routes<br/>[auth.py]"]
  node_chatapi["Chat Route<br/>[chat.py]"]
  node_transactionsapi["Transaction Routes<br/>[transactions.py]"]
  node_identity["JWT Identity<br/>[jwt.py]"]
  node_authdependency["Auth Dependency<br/>[dependencies.py]"]
end

subgraph group_assistant["Assistant Workflow"]
  node_agentgraph["Agent Graph<br/>[graph.py]"]
  node_agentnodes["Agent Reasoning<br/>[agent.py]"]
  node_llm["DeepSeek LLM<br/>[llm.py]"]
  node_ocrnode["OCR Graph Node<br/>[ocr.py]"]
  node_ocrservice["OCR Service<br/>[ocr_service.py]"]
  node_imageprocessing["Image Processing<br/>[image.py]"]
  node_crudtools["Transaction Tools<br/>[crud.py]"]
end

subgraph group_persistence["Persistence"]
  node_userrecords[("User Records<br/>[user.py]")]
  node_transactions[("Transaction Records<br/>[transaction.py]")]
  node_database[("PostgreSQL<br/>[database.py]")]
  node_checkpointer[("Conversation Checkpointer<br/>[checkpointer.py]")]
end

subgraph group_services["External Services"]
  node_deepseek["DeepSeek"]
  node_dashscope["Dashscope OCR"]
end

node_user(("User"))

node_user -->|"uses"| node_webapp
node_webapp -->|"renders"| node_chatui
node_chatui -->|"requests"| node_clientapi
node_chatui -->|"shows review"| node_approval
node_user -->|"manages records"| node_transactionui
node_transactionui -->|"requests"| node_clientapi
node_transactionui -->|"opens form"| node_transactionform
node_clientapi -->|"calls chat"| node_chatapi
node_clientapi -->|"calls auth"| node_authapi
node_clientapi -.->|"calls records"| node_transactionsapi
node_authapi -->|"issues tokens"| node_identity
node_authapi -->|"reads/writes"| node_userrecords
node_chatapi -->|"requires identity"| node_authdependency
node_transactionsapi -->|"requires identity"| node_authdependency
node_authdependency -->|"validates token"| node_identity
node_chatapi -->|"invokes graph"| node_agentgraph
node_chatapi -->|"loads checkpoint"| node_checkpointer
node_agentgraph -->|"dispatches nodes"| node_agentnodes
node_agentnodes -->|"uses model"| node_llm
node_llm -->|"calls model"| node_deepseek
node_llm -->|"binds tools"| node_crudtools
node_chatapi -.->|"handles image input"| node_ocrnode
node_ocrnode -.->|"recognizes image"| node_ocrservice
node_ocrservice -->|"compresses image"| node_imageprocessing
node_ocrservice -->|"calls OCR"| node_dashscope
node_crudtools -->|"queries/writes"| node_database
node_crudtools -->|"uses model"| node_transactions
node_transactionsapi -->|"accesses records"| node_database
node_transactionsapi -->|"uses model"| node_transactions
node_chatapi -->|"resumes approved tools"| node_crudtools
node_userrecords -->|"maps table"| node_database
node_transactions -->|"maps table"| node_database

click node_webapp "https://github.com/sharegear01-lang/ai_accounting/blob/main/frontend/src/main.js"
click node_chatui "https://github.com/sharegear01-lang/ai_accounting/blob/main/frontend/src/components/ChatPanel.vue"
click node_approval "https://github.com/sharegear01-lang/ai_accounting/blob/main/frontend/src/components/ApprovalCard.vue"
click node_transactionui "https://github.com/sharegear01-lang/ai_accounting/blob/main/frontend/src/views/Dashboard.vue"
click node_transactionform "https://github.com/sharegear01-lang/ai_accounting/blob/main/frontend/src/components/TransactionFormDialog.vue"
click node_clientapi "https://github.com/sharegear01-lang/ai_accounting/blob/main/frontend/src/api/index.js"
click node_authapi "https://github.com/sharegear01-lang/ai_accounting/blob/main/app/api/auth.py"
click node_chatapi "https://github.com/sharegear01-lang/ai_accounting/blob/main/app/api/chat.py"
click node_transactionsapi "https://github.com/sharegear01-lang/ai_accounting/blob/main/app/api/transactions.py"
click node_identity "https://github.com/sharegear01-lang/ai_accounting/blob/main/app/auth/jwt.py"
click node_authdependency "https://github.com/sharegear01-lang/ai_accounting/blob/main/app/auth/dependencies.py"
click node_agentgraph "https://github.com/sharegear01-lang/ai_accounting/blob/main/app/agent/graph.py"
click node_agentnodes "https://github.com/sharegear01-lang/ai_accounting/blob/main/app/agent/nodes/agent.py"
click node_llm "https://github.com/sharegear01-lang/ai_accounting/blob/main/app/agent/nodes/llm.py"
click node_ocrnode "https://github.com/sharegear01-lang/ai_accounting/blob/main/app/agent/nodes/ocr.py"
click node_ocrservice "https://github.com/sharegear01-lang/ai_accounting/blob/main/app/services/ocr_service.py"
click node_imageprocessing "https://github.com/sharegear01-lang/ai_accounting/blob/main/app/services/image.py"
click node_crudtools "https://github.com/sharegear01-lang/ai_accounting/blob/main/app/agent/tools/crud.py"
click node_userrecords "https://github.com/sharegear01-lang/ai_accounting/blob/main/app/models/user.py"
click node_transactions "https://github.com/sharegear01-lang/ai_accounting/blob/main/app/models/transaction.py"
click node_database "https://github.com/sharegear01-lang/ai_accounting/blob/main/app/database.py"
click node_checkpointer "https://github.com/sharegear01-lang/ai_accounting/blob/main/app/checkpointer.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_chatui,node_approval,node_transactionui,node_transactionform,node_clientapi,node_user toneBlue
class node_authapi,node_chatapi,node_transactionsapi,node_identity,node_authdependency toneAmber
class node_agentgraph,node_agentnodes,node_llm,node_ocrnode,node_ocrservice,node_imageprocessing,node_crudtools toneMint
class node_userrecords,node_transactions,node_database,node_checkpointer toneRose
class node_deepseek,node_dashscope toneIndigo
```

## Components

### Vue Client

- [Vue App](https://github.com/sharegear01-lang/ai_accounting/blob/main/frontend/src/main.js): `frontend/src/main.js`
- [Chat Interface](https://github.com/sharegear01-lang/ai_accounting/blob/main/frontend/src/components/ChatPanel.vue): `frontend/src/components/ChatPanel.vue`
- [Approval Card](https://github.com/sharegear01-lang/ai_accounting/blob/main/frontend/src/components/ApprovalCard.vue): `frontend/src/components/ApprovalCard.vue`
- [Transaction Views](https://github.com/sharegear01-lang/ai_accounting/blob/main/frontend/src/views/Dashboard.vue): `frontend/src/views/Dashboard.vue`
- [Transaction Form](https://github.com/sharegear01-lang/ai_accounting/blob/main/frontend/src/components/TransactionFormDialog.vue): `frontend/src/components/TransactionFormDialog.vue`
- [API Client](https://github.com/sharegear01-lang/ai_accounting/blob/main/frontend/src/api/index.js): `frontend/src/api/index.js`

### API and Identity

- [Auth Routes](https://github.com/sharegear01-lang/ai_accounting/blob/main/app/api/auth.py): `app/api/auth.py`
- [Chat Route](https://github.com/sharegear01-lang/ai_accounting/blob/main/app/api/chat.py): `app/api/chat.py`
- [Transaction Routes](https://github.com/sharegear01-lang/ai_accounting/blob/main/app/api/transactions.py): `app/api/transactions.py`
- [JWT Identity](https://github.com/sharegear01-lang/ai_accounting/blob/main/app/auth/jwt.py): `app/auth/jwt.py`
- [Auth Dependency](https://github.com/sharegear01-lang/ai_accounting/blob/main/app/auth/dependencies.py): `app/auth/dependencies.py`

### Assistant Workflow

- [Agent Graph](https://github.com/sharegear01-lang/ai_accounting/blob/main/app/agent/graph.py): `app/agent/graph.py`
- [Agent Reasoning](https://github.com/sharegear01-lang/ai_accounting/blob/main/app/agent/nodes/agent.py): `app/agent/nodes/agent.py`
- [DeepSeek LLM](https://github.com/sharegear01-lang/ai_accounting/blob/main/app/agent/nodes/llm.py): `app/agent/nodes/llm.py`
- [OCR Graph Node](https://github.com/sharegear01-lang/ai_accounting/blob/main/app/agent/nodes/ocr.py): `app/agent/nodes/ocr.py`
- [OCR Service](https://github.com/sharegear01-lang/ai_accounting/blob/main/app/services/ocr_service.py): `app/services/ocr_service.py`
- [Image Processing](https://github.com/sharegear01-lang/ai_accounting/blob/main/app/services/image.py): `app/services/image.py`
- [Transaction Tools](https://github.com/sharegear01-lang/ai_accounting/blob/main/app/agent/tools/crud.py): `app/agent/tools/crud.py`

### Persistence

- [User Records](https://github.com/sharegear01-lang/ai_accounting/blob/main/app/models/user.py): `app/models/user.py`
- [Transaction Records](https://github.com/sharegear01-lang/ai_accounting/blob/main/app/models/transaction.py): `app/models/transaction.py`
- [PostgreSQL](https://github.com/sharegear01-lang/ai_accounting/blob/main/app/database.py): `app/database.py`
- [Conversation Checkpointer](https://github.com/sharegear01-lang/ai_accounting/blob/main/app/checkpointer.py): `app/checkpointer.py`

### External Services

- **DeepSeek**
- **Dashscope OCR**

### Other components

- **User**

## Connections

- User → Vue App: uses (evidence: `README.md`)
- Vue App → Chat Interface: renders (evidence: `frontend/src/main.js`)
- Chat Interface → API Client: requests (evidence: `frontend/src/components/ChatPanel.vue`)
- Chat Interface → Approval Card: shows review (evidence: `frontend/src/components/ChatPanel.vue`)
- User → Transaction Views: manages records (evidence: `README.md`)
- Transaction Views → API Client: requests (evidence: `frontend/src/views/Dashboard.vue`)
- Transaction Views → Transaction Form: opens form (evidence: `frontend/src/views/Dashboard.vue`)
- API Client → Chat Route: calls chat (evidence: `README.md`)
- API Client → Auth Routes: calls auth (evidence: `README.md`)
- API Client → Transaction Routes: calls records
- Auth Routes → JWT Identity: issues tokens (evidence: `app/api/auth.py`)
- Auth Routes → User Records: reads/writes (evidence: `app/api/auth.py`)
- Chat Route → Auth Dependency: requires identity (evidence: `app/api/chat.py`)
- Transaction Routes → Auth Dependency: requires identity (evidence: `app/api/transactions.py`)
- Auth Dependency → JWT Identity: validates token (evidence: `app/auth/dependencies.py`)
- Chat Route → Agent Graph: invokes graph (evidence: `app/api/chat.py`)
- Chat Route → Conversation Checkpointer: loads checkpoint (evidence: `app/api/chat.py`)
- Agent Graph → Agent Reasoning: dispatches nodes (evidence: `app/agent/graph.py`)
- Agent Reasoning → DeepSeek LLM: uses model (evidence: `app/agent/nodes/agent.py`)
- DeepSeek LLM → DeepSeek: calls model (evidence: `app/agent/nodes/llm.py`)
- DeepSeek LLM → Transaction Tools: binds tools (evidence: `app/agent/nodes/llm.py`)
- Chat Route → OCR Graph Node: handles image input
- OCR Graph Node → OCR Service: recognizes image
- OCR Service → Image Processing: compresses image (evidence: `app/services/ocr_service.py`)
- OCR Service → Dashscope OCR: calls OCR (evidence: `app/services/ocr_service.py`)
- Transaction Tools → PostgreSQL: queries/writes (evidence: `app/agent/tools/crud.py`)
- Transaction Tools → Transaction Records: uses model (evidence: `app/agent/tools/crud.py`)
- Transaction Routes → PostgreSQL: accesses records (evidence: `app/api/transactions.py`)
- Transaction Routes → Transaction Records: uses model (evidence: `app/api/transactions.py`)
- Chat Route → Transaction Tools: resumes approved tools (evidence: `app/api/chat.py`)
- User Records → PostgreSQL: maps table (evidence: `app/models/user.py`)
- Transaction Records → PostgreSQL: maps table (evidence: `app/models/transaction.py`)
