# cnjialin/budgetgauge architecture

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

## Overview

额度舱记账是一款以每日剩余额度仪表盘为入口的消费记录 App：用户设置月预算、录入消费，再查看今日明细或本月汇总。README 说明数据可保存在本地或同步至 Supabase，并列出登录、分类、图表和版本更新能力；script.js 是唯一列出的核心模块，承载这些前端职责。关系主要依据 README 和所示脚本片段；未展示的实现细节不作推断。

Main entry points: [`script.js`](https://github.com/cnjialin/budgetgauge/blob/main/script.js) (消费录入)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_budget["预算与仪表盘"]
  node_dashboard["额度仪表盘<br/>[script.js]"]
  node_budget_calc["额度计算<br/>[script.js]"]
end

subgraph group_records["消费与历史"]
  node_expense_entry["消费录入<br/>[script.js]"]
  node_category_settings["用途分类<br/>[script.js]"]
  node_expense_records[("消费记录<br/>[script.js]")]
  node_history["历史查看<br/>[script.js]"]
  node_monthly_summary["月度汇总<br/>[script.js]"]
  node_stats_chart["消费图表<br/>[script.js]"]
end

subgraph group_sync["账户与同步"]
  node_auth_settings["登录与连接设置<br/>[script.js]"]
  node_supabase[("Supabase")]
  node_local_storage[("设备本地存储")]
end

subgraph group_app["应用能力"]
  node_update_check["版本检查<br/>[script.js]"]
  node_download_options["更新下载选项"]
end

node_user(("用户"))

node_user -->|"查看额度"| node_dashboard
node_user -->|"设置月额度"| node_budget_calc
node_budget_calc -->|"计算显示"| node_dashboard
node_user -->|"录入消费"| node_expense_entry
node_expense_entry -->|"保存记录"| node_expense_records
node_expense_entry -->|"选择用途"| node_category_settings
node_user -->|"查看历史"| node_history
node_history -->|"读取记录"| node_expense_records
node_history -->|"按日汇总"| node_monthly_summary
node_monthly_summary -->|"构建图表数据"| node_stats_chart
node_user -->|"配置并登录"| node_auth_settings
node_auth_settings -->|"登录同步"| node_supabase
node_expense_entry -->|"写入消费"| node_supabase
node_history -->|"读取云端记录"| node_supabase
node_expense_entry -->|"本地保存"| node_local_storage
node_history -->|"读取本地记录"| node_local_storage
node_user -->|"查看更新"| node_update_check
node_update_check -->|"提供下载选项"| node_download_options

click node_dashboard "https://github.com/cnjialin/budgetgauge/blob/main/script.js"
click node_budget_calc "https://github.com/cnjialin/budgetgauge/blob/main/script.js"
click node_expense_entry "https://github.com/cnjialin/budgetgauge/blob/main/script.js"
click node_category_settings "https://github.com/cnjialin/budgetgauge/blob/main/script.js"
click node_expense_records "https://github.com/cnjialin/budgetgauge/blob/main/script.js"
click node_history "https://github.com/cnjialin/budgetgauge/blob/main/script.js"
click node_monthly_summary "https://github.com/cnjialin/budgetgauge/blob/main/script.js"
click node_stats_chart "https://github.com/cnjialin/budgetgauge/blob/main/script.js"
click node_auth_settings "https://github.com/cnjialin/budgetgauge/blob/main/script.js"
click node_update_check "https://github.com/cnjialin/budgetgauge/blob/main/script.js"

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_dashboard,node_budget_calc toneBlue
class node_expense_entry,node_category_settings,node_expense_records,node_history,node_monthly_summary,node_stats_chart toneAmber
class node_auth_settings,node_supabase,node_local_storage toneMint
class node_update_check,node_download_options toneRose
class node_user toneIndigo
```

## Components

### 预算与仪表盘

- [额度仪表盘](https://github.com/cnjialin/budgetgauge/blob/main/script.js): `script.js`
- [额度计算](https://github.com/cnjialin/budgetgauge/blob/main/script.js): `script.js`

### 消费与历史

- [消费录入](https://github.com/cnjialin/budgetgauge/blob/main/script.js): `script.js`
- [用途分类](https://github.com/cnjialin/budgetgauge/blob/main/script.js): `script.js`
- [消费记录](https://github.com/cnjialin/budgetgauge/blob/main/script.js): `script.js`
- [历史查看](https://github.com/cnjialin/budgetgauge/blob/main/script.js): `script.js`
- [月度汇总](https://github.com/cnjialin/budgetgauge/blob/main/script.js): `script.js`
- [消费图表](https://github.com/cnjialin/budgetgauge/blob/main/script.js): `script.js`

### 账户与同步

- [登录与连接设置](https://github.com/cnjialin/budgetgauge/blob/main/script.js): `script.js`
- **Supabase**
- **设备本地存储**

### 应用能力

- [版本检查](https://github.com/cnjialin/budgetgauge/blob/main/script.js): `script.js`
- **更新下载选项**

### Other components

- **用户**

## Connections

- 用户 → 额度仪表盘: 查看额度 (evidence: `README.md`)
- 用户 → 额度计算: 设置月额度 (evidence: `README.md`)
- 额度计算 → 额度仪表盘: 计算显示 (evidence: `README.md`)
- 用户 → 消费录入: 录入消费 (evidence: `README.md`)
- 消费录入 → 消费记录: 保存记录 (evidence: `README.md`)
- 消费录入 → 用途分类: 选择用途 (evidence: `README.md`)
- 用户 → 历史查看: 查看历史 (evidence: `README.md`)
- 历史查看 → 消费记录: 读取记录 (evidence: `README.md`)
- 历史查看 → 月度汇总: 按日汇总 (evidence: `README.md`)
- 月度汇总 → 消费图表: 构建图表数据 (evidence: `script.js`)
- 用户 → 登录与连接设置: 配置并登录 (evidence: `README.md`)
- 登录与连接设置 → Supabase: 登录同步 (evidence: `README.md`)
- 消费录入 → Supabase: 写入消费 (evidence: `script.js`)
- 历史查看 → Supabase: 读取云端记录 (evidence: `README.md`)
- 消费录入 → 设备本地存储: 本地保存 (evidence: `README.md`)
- 历史查看 → 设备本地存储: 读取本地记录 (evidence: `README.md`)
- 用户 → 版本检查: 查看更新 (evidence: `README.md`)
- 版本检查 → 更新下载选项: 提供下载选项 (evidence: `README.md`)
