# john0931-st/pesobudget architecture

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

- Interactive diagram: https://gitdiagram.com/john0931-st/pesobudget
- Repository: https://github.com/john0931-st/pesobudget

## Overview

PesoBudget is an offline-ready Philippine payroll and expense workbook. Users enter monthly or 15th-cutoff obligations in the sheet; the app recalculates totals and balances, then presents summaries and analytics. Supporting branches provide audit history, import/export and printable reports, offline persistence and queued sync, and account security with cloud backup. The graph follows the sampled app/storage calls and source-index references; several feature links are documented in the README, while unsampled implementation details are not inferred.

Main entry points: [`src/App.tsx`](https://github.com/john0931-st/pesobudget/blob/main/src/App.tsx) (App coordinator), [`src/components/BudgetTable.tsx`](https://github.com/john0931-st/pesobudget/blob/main/src/components/BudgetTable.tsx) (Budget sheet), [`src/utils/storage.ts`](https://github.com/john0931-st/pesobudget/blob/main/src/utils/storage.ts) (Workbook storage), [`src/services/firebaseSyncService.ts`](https://github.com/john0931-st/pesobudget/blob/main/src/services/firebaseSyncService.ts) (Cloud sync service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Budget workspace"]
  node_app["App coordinator<br/>[App.tsx]"]
  node_budget_table["Budget sheet<br/>[BudgetTable.tsx]"]
  node_month_tabs["Month tabs<br/>[MonthSheetTabs.tsx]"]
  node_budget_types["Budget models<br/>[budget.ts]"]
  node_cell_merge["Cell merging<br/>[cellMerge.ts]"]
  node_currency_hook["Currency hook<br/>[useCurrency.ts]"]
end

subgraph group_calculations["Budget calculations"]
  node_computation["Budget calculations<br/>[computation.ts]"]
  node_formula["Formula evaluator<br/>[formula.ts]"]
  node_currency["Currency settings<br/>[currency.ts]"]
end

subgraph group_insights["Insights and reporting"]
  node_summary["Monthly summary<br/>[MonthlySummary.tsx]"]
  node_visualization["Analytics charts"]
  node_month_grouping["Workbook aggregation<br/>[monthGrouping.ts]"]
  node_audit[("Audit history")]
  node_print["PDF reports<br/>[printService.ts]"]
end

subgraph group_persistence["Persistence and sync"]
  node_storage[("Workbook storage<br/>[storage.ts]")]
  node_offline_queue["Offline edit queue<br/>[offlineQueue.ts]"]
  node_sync_modal["Sync controls"]
  node_sync_service["Cloud sync service"]
  node_firebase["Firebase setup<br/>[firebase.ts]"]
end

subgraph group_security["Security and export"]
  node_import_export["Import and export"]
  node_excel["Excel conversion<br/>[excelService.ts]"]
  node_security_service["Security and backup<br/>[securityService.ts]"]
  node_settings["Settings and exports<br/>[SettingsModal.tsx]"]
  node_portable_crypto["Portable encryption<br/>[portableCrypto.ts]"]
end

node_user(("Budget user"))
node_cloud[("Firebase services")]

node_user -->|"uses"| node_app
node_app -->|"shows sheet"| node_budget_table
node_app -->|"shows tabs"| node_month_tabs
node_app -->|"loads workbook"| node_storage
node_app -->|"recalculates"| node_computation
node_budget_table -->|"resolves merges"| node_cell_merge
node_budget_table -->|"reads sheet data"| node_storage
node_storage -->|"recalculates data"| node_computation
node_computation -->|"evaluates formulas"| node_formula
node_app -->|"shows summary"| node_summary
node_app -->|"shows analytics"| node_visualization
node_visualization -->|"aggregates sheets"| node_month_grouping
node_visualization -->|"formats values"| node_currency
node_app -->|"selects currency"| node_currency_hook
node_currency_hook -->|"reads and updates"| node_currency
node_import_export -->|"imports and exports"| node_excel
node_excel -->|"recalculates imports"| node_computation
node_excel -->|"aggregates workbook"| node_month_grouping
node_print -->|"aggregates reports"| node_month_grouping
node_print -->|"includes history"| node_audit
node_app -.->|"records changes"| node_audit
node_sync_modal -->|"manages queued edits"| node_offline_queue
node_sync_modal -->|"controls sync"| node_sync_service
node_sync_service -->|"uses Firebase"| node_firebase
node_sync_service -.->|"syncs workbook"| node_cloud
node_settings -->|"manages security"| node_security_service
node_security_service -->|"creates cloud backup"| node_sync_service
node_settings -->|"configures encryption"| node_portable_crypto
node_settings -.->|"offers PDF manual"| node_print
node_budget_table -->|"uses budget models"| node_budget_types
node_storage -->|"stores workbook models"| node_budget_types

click node_app "https://github.com/john0931-st/pesobudget/blob/main/src/App.tsx"
click node_budget_table "https://github.com/john0931-st/pesobudget/blob/main/src/components/BudgetTable.tsx"
click node_month_tabs "https://github.com/john0931-st/pesobudget/blob/main/src/components/MonthSheetTabs.tsx"
click node_budget_types "https://github.com/john0931-st/pesobudget/blob/main/src/types/budget.ts"
click node_storage "https://github.com/john0931-st/pesobudget/blob/main/src/utils/storage.ts"
click node_computation "https://github.com/john0931-st/pesobudget/blob/main/src/utils/computation.ts"
click node_formula "https://github.com/john0931-st/pesobudget/blob/main/src/utils/formula.ts"
click node_cell_merge "https://github.com/john0931-st/pesobudget/blob/main/src/utils/cellMerge.ts"
click node_currency "https://github.com/john0931-st/pesobudget/blob/main/src/utils/currency.ts"
click node_currency_hook "https://github.com/john0931-st/pesobudget/blob/main/src/hooks/useCurrency.ts"
click node_summary "https://github.com/john0931-st/pesobudget/blob/main/src/components/MonthlySummary.tsx"
click node_visualization "https://github.com/john0931-st/pesobudget/blob/main/src/components/DataVisualization.tsx"
click node_month_grouping "https://github.com/john0931-st/pesobudget/blob/main/src/utils/monthGrouping.ts"
click node_audit "https://github.com/john0931-st/pesobudget/blob/main/src/utils/changeLogService.ts"
click node_import_export "https://github.com/john0931-st/pesobudget/blob/main/src/components/ImportExportModal.tsx"
click node_excel "https://github.com/john0931-st/pesobudget/blob/main/src/utils/excelService.ts"
click node_print "https://github.com/john0931-st/pesobudget/blob/main/src/utils/printService.ts"
click node_offline_queue "https://github.com/john0931-st/pesobudget/blob/main/src/utils/offlineQueue.ts"
click node_sync_modal "https://github.com/john0931-st/pesobudget/blob/main/src/components/SyncOfflineModal.tsx"
click node_sync_service "https://github.com/john0931-st/pesobudget/blob/main/src/services/firebaseSyncService.ts"
click node_firebase "https://github.com/john0931-st/pesobudget/blob/main/src/firebase.ts"
click node_security_service "https://github.com/john0931-st/pesobudget/blob/main/src/services/securityService.ts"
click node_settings "https://github.com/john0931-st/pesobudget/blob/main/src/components/SettingsModal.tsx"
click node_portable_crypto "https://github.com/john0931-st/pesobudget/blob/main/src/utils/portableCrypto.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_budget_table,node_month_tabs,node_budget_types,node_cell_merge,node_currency_hook,node_user toneBlue
class node_computation,node_formula,node_currency,node_cloud toneAmber
class node_summary,node_visualization,node_month_grouping,node_audit,node_print toneMint
class node_storage,node_offline_queue,node_sync_modal,node_sync_service,node_firebase toneRose
class node_import_export,node_excel,node_security_service,node_settings,node_portable_crypto toneIndigo
```

## Components

### Budget workspace

- [App coordinator](https://github.com/john0931-st/pesobudget/blob/main/src/App.tsx): `src/App.tsx`
- [Budget sheet](https://github.com/john0931-st/pesobudget/blob/main/src/components/BudgetTable.tsx): `src/components/BudgetTable.tsx`
- [Month tabs](https://github.com/john0931-st/pesobudget/blob/main/src/components/MonthSheetTabs.tsx): `src/components/MonthSheetTabs.tsx`
- [Budget models](https://github.com/john0931-st/pesobudget/blob/main/src/types/budget.ts): `src/types/budget.ts`
- [Cell merging](https://github.com/john0931-st/pesobudget/blob/main/src/utils/cellMerge.ts): `src/utils/cellMerge.ts`
- [Currency hook](https://github.com/john0931-st/pesobudget/blob/main/src/hooks/useCurrency.ts): `src/hooks/useCurrency.ts`

### Budget calculations

- [Budget calculations](https://github.com/john0931-st/pesobudget/blob/main/src/utils/computation.ts): `src/utils/computation.ts`
- [Formula evaluator](https://github.com/john0931-st/pesobudget/blob/main/src/utils/formula.ts): `src/utils/formula.ts`
- [Currency settings](https://github.com/john0931-st/pesobudget/blob/main/src/utils/currency.ts): `src/utils/currency.ts`

### Insights and reporting

- [Monthly summary](https://github.com/john0931-st/pesobudget/blob/main/src/components/MonthlySummary.tsx): `src/components/MonthlySummary.tsx`
- [Analytics charts](https://github.com/john0931-st/pesobudget/blob/main/src/components/DataVisualization.tsx): `src/components/DataVisualization.tsx`
- [Workbook aggregation](https://github.com/john0931-st/pesobudget/blob/main/src/utils/monthGrouping.ts): `src/utils/monthGrouping.ts`
- [Audit history](https://github.com/john0931-st/pesobudget/blob/main/src/utils/changeLogService.ts): `src/utils/changeLogService.ts`
- [PDF reports](https://github.com/john0931-st/pesobudget/blob/main/src/utils/printService.ts): `src/utils/printService.ts`

### Persistence and sync

- [Workbook storage](https://github.com/john0931-st/pesobudget/blob/main/src/utils/storage.ts): `src/utils/storage.ts`
- [Offline edit queue](https://github.com/john0931-st/pesobudget/blob/main/src/utils/offlineQueue.ts): `src/utils/offlineQueue.ts`
- [Sync controls](https://github.com/john0931-st/pesobudget/blob/main/src/components/SyncOfflineModal.tsx): `src/components/SyncOfflineModal.tsx`
- [Cloud sync service](https://github.com/john0931-st/pesobudget/blob/main/src/services/firebaseSyncService.ts): `src/services/firebaseSyncService.ts`
- [Firebase setup](https://github.com/john0931-st/pesobudget/blob/main/src/firebase.ts): `src/firebase.ts`

### Security and export

- [Import and export](https://github.com/john0931-st/pesobudget/blob/main/src/components/ImportExportModal.tsx): `src/components/ImportExportModal.tsx`
- [Excel conversion](https://github.com/john0931-st/pesobudget/blob/main/src/utils/excelService.ts): `src/utils/excelService.ts`
- [Security and backup](https://github.com/john0931-st/pesobudget/blob/main/src/services/securityService.ts): `src/services/securityService.ts`
- [Settings and exports](https://github.com/john0931-st/pesobudget/blob/main/src/components/SettingsModal.tsx): `src/components/SettingsModal.tsx`
- [Portable encryption](https://github.com/john0931-st/pesobudget/blob/main/src/utils/portableCrypto.ts): `src/utils/portableCrypto.ts`

### Other components

- **Budget user**
- **Firebase services**

## Connections

- Budget user → App coordinator: uses (evidence: `README.md`)
- App coordinator → Budget sheet: shows sheet (evidence: `src/App.tsx`)
- App coordinator → Month tabs: shows tabs (evidence: `src/App.tsx`)
- App coordinator → Workbook storage: loads workbook (evidence: `src/App.tsx`)
- App coordinator → Budget calculations: recalculates (evidence: `src/App.tsx`)
- Budget sheet → Cell merging: resolves merges (evidence: `src/components/BudgetTable.tsx`)
- Budget sheet → Workbook storage: reads sheet data (evidence: `src/components/BudgetTable.tsx`)
- Workbook storage → Budget calculations: recalculates data (evidence: `src/utils/storage.ts`)
- Budget calculations → Formula evaluator: evaluates formulas (evidence: `src/utils/computation.ts`)
- App coordinator → Monthly summary: shows summary (evidence: `src/App.tsx`)
- App coordinator → Analytics charts: shows analytics (evidence: `src/App.tsx`)
- Analytics charts → Workbook aggregation: aggregates sheets (evidence: `src/components/DataVisualization.tsx`)
- Analytics charts → Currency settings: formats values (evidence: `src/components/DataVisualization.tsx`)
- App coordinator → Currency hook: selects currency (evidence: `src/App.tsx`)
- Currency hook → Currency settings: reads and updates (evidence: `src/hooks/useCurrency.ts`)
- Import and export → Excel conversion: imports and exports (evidence: `src/components/ImportExportModal.tsx`)
- Excel conversion → Budget calculations: recalculates imports (evidence: `src/utils/excelService.ts`)
- Excel conversion → Workbook aggregation: aggregates workbook (evidence: `src/utils/excelService.ts`)
- PDF reports → Workbook aggregation: aggregates reports (evidence: `src/utils/printService.ts`)
- PDF reports → Audit history: includes history (evidence: `src/utils/printService.ts`)
- App coordinator → Audit history: records changes (evidence: `src/App.tsx`)
- Sync controls → Offline edit queue: manages queued edits (evidence: `src/components/SyncOfflineModal.tsx`)
- Sync controls → Cloud sync service: controls sync (evidence: `src/components/SyncOfflineModal.tsx`)
- Cloud sync service → Firebase setup: uses Firebase (evidence: `src/services/firebaseSyncService.ts`)
- Cloud sync service → Firebase services: syncs workbook (evidence: `README.md`)
- Settings and exports → Security and backup: manages security (evidence: `src/components/SettingsModal.tsx`)
- Security and backup → Cloud sync service: creates cloud backup (evidence: `src/App.tsx`)
- Settings and exports → Portable encryption: configures encryption (evidence: `src/components/SettingsModal.tsx`)
- Settings and exports → PDF reports: offers PDF manual (evidence: `README.md`)
- Budget sheet → Budget models: uses budget models (evidence: `src/components/BudgetTable.tsx`)
- Workbook storage → Budget models: stores workbook models (evidence: `src/utils/storage.ts`)
