# pvhung2112/cashew architecture

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

- Interactive diagram: https://gitdiagram.com/pvhung2112/cashew
- Repository: https://github.com/pvhung2112/cashew

## Overview

Cashew is a cross-platform personal-finance app. The principal workflow is entering transactions, organizing them into budgets and goals, then reviewing account balances and spending insights. Its Flutter interface also supports search, filtering, currency conversion, notifications, backup, and cross-device sync. The README identifies Drift/SQL and Firebase; the source excerpts do not include the Dart implementations, so links between these subsystems are limited to documented capabilities rather than inferred call chains.

Main entry points: [`budget/lib/database/tables.dart`](https://github.com/pvhung2112/cashew/blob/main/budget/lib/database/tables.dart) (Drift database), [`budget/lib/struct/syncClient.dart`](https://github.com/pvhung2112/cashew/blob/main/budget/lib/struct/syncClient.dart) (Sync client), [`budget/lib/main.dart`](https://github.com/pvhung2112/cashew/blob/main/budget/lib/main.dart) (Flutter app), [`budget/lib/pages/homePage/homePage.dart`](https://github.com/pvhung2112/cashew/blob/main/budget/lib/pages/homePage/homePage.dart) (Home dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_app["Flutter app<br/>[main.dart]"]
  node_home["Home dashboard<br/>[homePage.dart]"]
end

subgraph group_finance["Finance features"]
  node_transactions["Transactions"]
  node_transaction_search["Search and filters"]
  node_budgets["Budgets<br/>[budgetPage.dart]"]
  node_objectives["Goals<br/>[objectivePage.dart]"]
  node_accounts["Accounts<br/>[accountsPage.dart]"]
  node_exchange["Currency conversion"]
  node_insights["Spending insights"]
end

subgraph group_data["Data and storage"]
  node_database[("Drift database<br/>[tables.dart]")]
  node_backup["Backup and restore"]
  node_csv["CSV import/export<br/>[importCSV.dart]"]
end

subgraph group_services["Connected services"]
  node_sync["Sync client<br/>[syncClient.dart]"]
  node_firebase["Firebase services"]
  node_notifications["Notifications"]
end

node_user(("User"))
node_exchange_service["Exchange-rate service"]

node_user -->|"uses"| node_app
node_app -->|"shows"| node_home
node_user -->|"records"| node_transactions
node_user -->|"sets budgets"| node_budgets
node_user -->|"sets goals"| node_objectives
node_user -->|"manages"| node_accounts
node_user -->|"searches"| node_transaction_search
node_transactions -->|"stores transactions"| node_database
node_budgets -->|"stores budgets"| node_database
node_objectives -->|"stores goals"| node_database
node_accounts -->|"stores accounts"| node_database
node_home -->|"shows summaries"| node_insights
node_insights -->|"reads finance data"| node_database
node_exchange -.->|"gets rates"| node_exchange_service
node_sync -->|"syncs data"| node_database
node_sync -->|"uses"| node_firebase
node_backup -->|"backs up data"| node_database
node_csv -->|"imports and exports"| node_database
node_notifications -->|"sends reminders"| node_user

click node_app "https://github.com/pvhung2112/cashew/blob/main/budget/lib/main.dart"
click node_home "https://github.com/pvhung2112/cashew/blob/main/budget/lib/pages/homePage/homePage.dart"
click node_transactions "https://github.com/pvhung2112/cashew/blob/main/budget/lib/pages/addTransactionPage.dart"
click node_transaction_search "https://github.com/pvhung2112/cashew/blob/main/budget/lib/pages/transactionsSearchPage.dart"
click node_budgets "https://github.com/pvhung2112/cashew/blob/main/budget/lib/pages/budgetPage.dart"
click node_objectives "https://github.com/pvhung2112/cashew/blob/main/budget/lib/pages/objectivePage.dart"
click node_accounts "https://github.com/pvhung2112/cashew/blob/main/budget/lib/pages/accountsPage.dart"
click node_exchange "https://github.com/pvhung2112/cashew/blob/main/budget/lib/pages/exchangeRatesPage.dart"
click node_insights "https://github.com/pvhung2112/cashew/blob/main/budget/lib/struct/spendingSummaryHelper.dart"
click node_database "https://github.com/pvhung2112/cashew/blob/main/budget/lib/database/tables.dart"
click node_sync "https://github.com/pvhung2112/cashew/blob/main/budget/lib/struct/syncClient.dart"
click node_firebase "https://github.com/pvhung2112/cashew/blob/main/budget/lib/firebase_options.dart"
click node_backup "https://github.com/pvhung2112/cashew/blob/main/budget/lib/widgets/accountAndBackup.dart"
click node_csv "https://github.com/pvhung2112/cashew/blob/main/budget/lib/widgets/importCSV.dart"
click node_notifications "https://github.com/pvhung2112/cashew/blob/main/budget/lib/struct/initializeNotifications.dart"

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_home,node_user toneBlue
class node_transactions,node_transaction_search,node_budgets,node_objectives,node_accounts,node_exchange,node_insights toneAmber
class node_database,node_backup,node_csv toneMint
class node_sync,node_firebase,node_notifications toneRose
class node_exchange_service toneIndigo
```

## Components

### App experience

- [Flutter app](https://github.com/pvhung2112/cashew/blob/main/budget/lib/main.dart): `budget/lib/main.dart`
- [Home dashboard](https://github.com/pvhung2112/cashew/blob/main/budget/lib/pages/homePage/homePage.dart): `budget/lib/pages/homePage/homePage.dart`

### Finance features

- [Transactions](https://github.com/pvhung2112/cashew/blob/main/budget/lib/pages/addTransactionPage.dart): `budget/lib/pages/addTransactionPage.dart`
- [Search and filters](https://github.com/pvhung2112/cashew/blob/main/budget/lib/pages/transactionsSearchPage.dart): `budget/lib/pages/transactionsSearchPage.dart`
- [Budgets](https://github.com/pvhung2112/cashew/blob/main/budget/lib/pages/budgetPage.dart): `budget/lib/pages/budgetPage.dart`
- [Goals](https://github.com/pvhung2112/cashew/blob/main/budget/lib/pages/objectivePage.dart): `budget/lib/pages/objectivePage.dart`
- [Accounts](https://github.com/pvhung2112/cashew/blob/main/budget/lib/pages/accountsPage.dart): `budget/lib/pages/accountsPage.dart`
- [Currency conversion](https://github.com/pvhung2112/cashew/blob/main/budget/lib/pages/exchangeRatesPage.dart): `budget/lib/pages/exchangeRatesPage.dart`
- [Spending insights](https://github.com/pvhung2112/cashew/blob/main/budget/lib/struct/spendingSummaryHelper.dart): `budget/lib/struct/spendingSummaryHelper.dart`

### Data and storage

- [Drift database](https://github.com/pvhung2112/cashew/blob/main/budget/lib/database/tables.dart): `budget/lib/database/tables.dart`
- [Backup and restore](https://github.com/pvhung2112/cashew/blob/main/budget/lib/widgets/accountAndBackup.dart): `budget/lib/widgets/accountAndBackup.dart`
- [CSV import/export](https://github.com/pvhung2112/cashew/blob/main/budget/lib/widgets/importCSV.dart): `budget/lib/widgets/importCSV.dart`

### Connected services

- [Sync client](https://github.com/pvhung2112/cashew/blob/main/budget/lib/struct/syncClient.dart): `budget/lib/struct/syncClient.dart`
- [Firebase services](https://github.com/pvhung2112/cashew/blob/main/budget/lib/firebase_options.dart): `budget/lib/firebase_options.dart`
- [Notifications](https://github.com/pvhung2112/cashew/blob/main/budget/lib/struct/initializeNotifications.dart): `budget/lib/struct/initializeNotifications.dart`

### Other components

- **User**
- **Exchange-rate service**

## Connections

- User → Flutter app: uses
- Flutter app → Home dashboard: shows
- User → Transactions: records
- User → Budgets: sets budgets
- User → Goals: sets goals
- User → Accounts: manages
- User → Search and filters: searches
- Transactions → Drift database: stores transactions
- Budgets → Drift database: stores budgets
- Goals → Drift database: stores goals
- Accounts → Drift database: stores accounts
- Home dashboard → Spending insights: shows summaries
- Spending insights → Drift database: reads finance data
- Currency conversion → Exchange-rate service: gets rates
- Sync client → Drift database: syncs data
- Sync client → Firebase services: uses
- Backup and restore → Drift database: backs up data
- CSV import/export → Drift database: imports and exports
- Notifications → User: sends reminders
