# fchfaz/jagacuan architecture

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

- Interactive diagram: https://gitdiagram.com/fchfaz/jagacuan
- Repository: https://github.com/fchfaz/jagacuan

## Overview

Jaga Cuan is a local-first personal-finance app for recording transactions and managing wallets, budgets, recurring activity, savings goals, reports, and backups. Users onboard by setting up a wallet, then use the dashboard and feature pages to enter and review finances; data is stored in IndexedDB and summarized for display. App routing and startup are visible in the App excerpt. Page-to-data and supporting-feature links below are based on SOURCE INDEX references; unsampled implementation details are not assumed.

Main entry points: [`src/App.tsx`](https://github.com/fchfaz/jagacuan/blob/main/src/App.tsx) (App Router), [`src/hooks/useFinanceData.ts`](https://github.com/fchfaz/jagacuan/blob/main/src/hooks/useFinanceData.ts) (Finance Data), [`src/components/layout/AppLayout.tsx`](https://github.com/fchfaz/jagacuan/blob/main/src/components/layout/AppLayout.tsx) (App Layout), [`src/components/onboarding/OnboardingModal.tsx`](https://github.com/fchfaz/jagacuan/blob/main/src/components/onboarding/OnboardingModal.tsx) (Onboarding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App Shell"]
  node_app["App Router<br/>[App.tsx]"]
  node_layout["App Layout<br/>[AppLayout.tsx]"]
  node_store["App State<br/>[useAppStore.ts]"]
end

subgraph group_finance["Finance Workflows"]
  node_onboarding["Onboarding"]
  node_transaction["Transaction Entry"]
  node_dashboard["Dashboard<br/>[DashboardPage.tsx]"]
  node_transactions["Transactions"]
  node_budgets["Budgets<br/>[BudgetsPage.tsx]"]
  node_reports["Reports<br/>[ReportsPage.tsx]"]
  node_wallets["Wallets And Goals<br/>[WalletsPage.tsx]"]
  node_settings["Settings And Backup<br/>[SettingsPage.tsx]"]
end

subgraph group_data["Data And Logic"]
  node_datahook["Finance Data<br/>[useFinanceData.ts]"]
  node_db[("Finance Database<br/>[db.ts]")]
  node_calculations["Finance Calculations<br/>[calculations.ts]"]
  node_recurring["Recurring Rules<br/>[recurring.ts]"]
end

subgraph group_support["Setup And Utilities"]
  node_backup["Backup Utilities<br/>[backup.ts]"]
  node_validation["Input Validation<br/>[validation.ts]"]
  node_pwa["PWA Install"]
  node_installhook["Install Detection<br/>[usePWAInstall.ts]"]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_layout
node_app -->|"reads state"| node_store
node_app -->|"initializes and reads"| node_db
node_app -->|"processes rules"| node_recurring
node_app -->|"routes"| node_dashboard
node_app -->|"routes"| node_transactions
node_app -->|"routes"| node_budgets
node_app -->|"routes"| node_reports
node_app -->|"routes"| node_wallets
node_app -->|"routes"| node_settings
node_app -->|"renders form"| node_transaction
node_app -->|"renders onboarding"| node_onboarding
node_layout -->|"reads state"| node_store
node_layout -->|"renders"| node_pwa
node_pwa -->|"uses"| node_installhook
node_onboarding -->|"writes setup data"| node_db
node_onboarding -->|"calculates budget split"| node_calculations
node_transaction -->|"uses finance data"| node_datahook
node_dashboard -->|"reads summaries"| node_datahook
node_transactions -->|"reads transactions"| node_datahook
node_budgets -->|"reads budget data"| node_datahook
node_reports -->|"reads summaries"| node_datahook
node_wallets -->|"reads balances"| node_datahook
node_settings -->|"reads finance data"| node_datahook
node_settings -->|"uses backup tools"| node_backup
node_backup -->|"validates imports"| node_validation
node_datahook -->|"queries and writes"| node_db
node_datahook -->|"computes summaries"| node_calculations
node_transaction -->|"validates input"| node_validation

click node_app "https://github.com/fchfaz/jagacuan/blob/main/src/App.tsx"
click node_layout "https://github.com/fchfaz/jagacuan/blob/main/src/components/layout/AppLayout.tsx"
click node_store "https://github.com/fchfaz/jagacuan/blob/main/src/store/useAppStore.ts"
click node_onboarding "https://github.com/fchfaz/jagacuan/blob/main/src/components/onboarding/OnboardingModal.tsx"
click node_transaction "https://github.com/fchfaz/jagacuan/blob/main/src/components/forms/TransactionForm.tsx"
click node_dashboard "https://github.com/fchfaz/jagacuan/blob/main/src/pages/DashboardPage.tsx"
click node_transactions "https://github.com/fchfaz/jagacuan/blob/main/src/pages/TransactionsPage.tsx"
click node_budgets "https://github.com/fchfaz/jagacuan/blob/main/src/pages/BudgetsPage.tsx"
click node_reports "https://github.com/fchfaz/jagacuan/blob/main/src/pages/ReportsPage.tsx"
click node_wallets "https://github.com/fchfaz/jagacuan/blob/main/src/pages/WalletsPage.tsx"
click node_settings "https://github.com/fchfaz/jagacuan/blob/main/src/pages/SettingsPage.tsx"
click node_datahook "https://github.com/fchfaz/jagacuan/blob/main/src/hooks/useFinanceData.ts"
click node_db "https://github.com/fchfaz/jagacuan/blob/main/src/db/db.ts"
click node_calculations "https://github.com/fchfaz/jagacuan/blob/main/src/lib/calculations.ts"
click node_recurring "https://github.com/fchfaz/jagacuan/blob/main/src/lib/recurring.ts"
click node_backup "https://github.com/fchfaz/jagacuan/blob/main/src/lib/backup.ts"
click node_validation "https://github.com/fchfaz/jagacuan/blob/main/src/lib/validation.ts"
click node_pwa "https://github.com/fchfaz/jagacuan/blob/main/src/components/ui/PWAInstallButton.tsx"
click node_installhook "https://github.com/fchfaz/jagacuan/blob/main/src/hooks/usePWAInstall.ts"

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_layout,node_store,node_user toneBlue
class node_onboarding,node_transaction,node_dashboard,node_transactions,node_budgets,node_reports,node_wallets,node_settings toneAmber
class node_datahook,node_db,node_calculations,node_recurring toneMint
class node_backup,node_validation,node_pwa,node_installhook toneRose
```

## Components

### App Shell

- [App Router](https://github.com/fchfaz/jagacuan/blob/main/src/App.tsx): `src/App.tsx`
- [App Layout](https://github.com/fchfaz/jagacuan/blob/main/src/components/layout/AppLayout.tsx): `src/components/layout/AppLayout.tsx`
- [App State](https://github.com/fchfaz/jagacuan/blob/main/src/store/useAppStore.ts): `src/store/useAppStore.ts`

### Finance Workflows

- [Onboarding](https://github.com/fchfaz/jagacuan/blob/main/src/components/onboarding/OnboardingModal.tsx): `src/components/onboarding/OnboardingModal.tsx`
- [Transaction Entry](https://github.com/fchfaz/jagacuan/blob/main/src/components/forms/TransactionForm.tsx): `src/components/forms/TransactionForm.tsx`
- [Dashboard](https://github.com/fchfaz/jagacuan/blob/main/src/pages/DashboardPage.tsx): `src/pages/DashboardPage.tsx`
- [Transactions](https://github.com/fchfaz/jagacuan/blob/main/src/pages/TransactionsPage.tsx): `src/pages/TransactionsPage.tsx`
- [Budgets](https://github.com/fchfaz/jagacuan/blob/main/src/pages/BudgetsPage.tsx): `src/pages/BudgetsPage.tsx`
- [Reports](https://github.com/fchfaz/jagacuan/blob/main/src/pages/ReportsPage.tsx): `src/pages/ReportsPage.tsx`
- [Wallets And Goals](https://github.com/fchfaz/jagacuan/blob/main/src/pages/WalletsPage.tsx): `src/pages/WalletsPage.tsx`
- [Settings And Backup](https://github.com/fchfaz/jagacuan/blob/main/src/pages/SettingsPage.tsx): `src/pages/SettingsPage.tsx`

### Data And Logic

- [Finance Data](https://github.com/fchfaz/jagacuan/blob/main/src/hooks/useFinanceData.ts): `src/hooks/useFinanceData.ts`
- [Finance Database](https://github.com/fchfaz/jagacuan/blob/main/src/db/db.ts): `src/db/db.ts`
- [Finance Calculations](https://github.com/fchfaz/jagacuan/blob/main/src/lib/calculations.ts): `src/lib/calculations.ts`
- [Recurring Rules](https://github.com/fchfaz/jagacuan/blob/main/src/lib/recurring.ts): `src/lib/recurring.ts`

### Setup And Utilities

- [Backup Utilities](https://github.com/fchfaz/jagacuan/blob/main/src/lib/backup.ts): `src/lib/backup.ts`
- [Input Validation](https://github.com/fchfaz/jagacuan/blob/main/src/lib/validation.ts): `src/lib/validation.ts`
- [PWA Install](https://github.com/fchfaz/jagacuan/blob/main/src/components/ui/PWAInstallButton.tsx): `src/components/ui/PWAInstallButton.tsx`
- [Install Detection](https://github.com/fchfaz/jagacuan/blob/main/src/hooks/usePWAInstall.ts): `src/hooks/usePWAInstall.ts`

### Other components

- **User**

## Connections

- User → App Router: uses (evidence: `src/App.tsx`)
- App Router → App Layout: renders (evidence: `src/App.tsx`)
- App Router → App State: reads state (evidence: `src/App.tsx`)
- App Router → Finance Database: initializes and reads (evidence: `src/App.tsx`)
- App Router → Recurring Rules: processes rules (evidence: `src/App.tsx`)
- App Router → Dashboard: routes (evidence: `src/App.tsx`)
- App Router → Transactions: routes (evidence: `src/App.tsx`)
- App Router → Budgets: routes (evidence: `src/App.tsx`)
- App Router → Reports: routes (evidence: `src/App.tsx`)
- App Router → Wallets And Goals: routes (evidence: `src/App.tsx`)
- App Router → Settings And Backup: routes (evidence: `src/App.tsx`)
- App Router → Transaction Entry: renders form (evidence: `src/App.tsx`)
- App Router → Onboarding: renders onboarding (evidence: `src/App.tsx`)
- App Layout → App State: reads state (evidence: `src/components/layout/AppLayout.tsx`)
- App Layout → PWA Install: renders (evidence: `src/components/layout/AppLayout.tsx`)
- PWA Install → Install Detection: uses (evidence: `src/components/ui/PWAInstallButton.tsx`)
- Onboarding → Finance Database: writes setup data (evidence: `src/components/onboarding/OnboardingModal.tsx`)
- Onboarding → Finance Calculations: calculates budget split (evidence: `src/components/onboarding/OnboardingModal.tsx`)
- Transaction Entry → Finance Data: uses finance data (evidence: `src/components/forms/TransactionForm.tsx`)
- Dashboard → Finance Data: reads summaries (evidence: `src/pages/DashboardPage.tsx`)
- Transactions → Finance Data: reads transactions (evidence: `src/pages/TransactionsPage.tsx`)
- Budgets → Finance Data: reads budget data (evidence: `src/pages/BudgetsPage.tsx`)
- Reports → Finance Data: reads summaries (evidence: `src/pages/ReportsPage.tsx`)
- Wallets And Goals → Finance Data: reads balances (evidence: `src/pages/WalletsPage.tsx`)
- Settings And Backup → Finance Data: reads finance data (evidence: `src/pages/SettingsPage.tsx`)
- Settings And Backup → Backup Utilities: uses backup tools (evidence: `src/pages/SettingsPage.tsx`)
- Backup Utilities → Input Validation: validates imports (evidence: `src/lib/backup.ts`)
- Finance Data → Finance Database: queries and writes (evidence: `src/hooks/useFinanceData.ts`)
- Finance Data → Finance Calculations: computes summaries (evidence: `src/hooks/useFinanceData.ts`)
- Transaction Entry → Input Validation: validates input (evidence: `src/components/forms/TransactionForm.tsx`)
