# iggusti/monthly-budget architecture

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

- Interactive diagram: https://gitdiagram.com/iggusti/monthly-budget
- Repository: https://github.com/iggusti/monthly-budget

## Overview

Monthly Budget Nia Ilham is a shared family budgeting app. A family member passes the keyword gate, signs in anonymously, and edits a budget period; Firestore syncs the period across devices. The app presents income, fixed expenses, and salary- or savings-funded daily spending, with period calculations and expense dates/payment methods. Backup, PWA/offline support, and delayed Pushover notifications are separate capabilities. Route-to-store details and several feature implementations were not excerpted, so those connections are shown only where documented or marked unverified.

Main entry points: [`src/routes/month/[id]/+page.svelte`](https://github.com/iggusti/monthly-budget/blob/main/src/routes/month/%5Bid%5D/%2Bpage.svelte) (Period page), [`src/routes/+page.svelte`](https://github.com/iggusti/monthly-budget/blob/main/src/routes/%2Bpage.svelte) (Budget dashboard), [`functions/send-push.js`](https://github.com/iggusti/monthly-budget/blob/main/functions/send-push.js) (Push sender), [`src/lib/budget-store.ts`](https://github.com/iggusti/monthly-budget/blob/main/src/lib/budget-store.ts) (Budget store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and shell"]
  node_login["Keyword login<br/>[+page.svelte]"]
  node_auth["Anonymous auth<br/>[auth.ts]"]
  node_shell["App shell<br/>[+layout.svelte]"]
  node_pwa["Service worker<br/>[service-worker.js]"]
end

subgraph group_budget["Budget workflow"]
  node_dashboard["Budget dashboard<br/>[+page.svelte]"]
  node_period["Period page<br/>[+page.svelte]"]
  node_expense["Expense sections"]
  node_quickadd["Quick daily entry"]
  node_methods["Payment methods<br/>[expense-methods.ts]"]
  node_search["Expense search<br/>[search.ts]"]
  node_calculations["Budget calculations<br/>[equal-split.ts]"]
  node_periodrules["Period rules<br/>[period.ts]"]
end

subgraph group_data["Persistence and backup"]
  node_store["Budget store<br/>[budget-store.ts]"]
  node_firebase["Firebase client<br/>[firebase.ts]"]
  node_firestore[("Firestore")]
  node_backup["JSON and CSV backup<br/>[backup.ts]"]
  node_pdf["PDF report<br/>[backup-pdf.ts]"]
end

subgraph group_notify["Notifications and delivery"]
  node_notificationui["Notification settings"]
  node_registrations["Device registrations"]
  node_outbox["Notification outbox"]
  node_sender["Push sender<br/>[send-push.js]"]
  node_helpers["Recipient planning<br/>[notify-helpers.js]"]
  node_changes["Change formatting<br/>[changes.js]"]
end

node_family(("Family member"))
node_pushover["Pushover"]

node_family -->|"enters keyword"| node_login
node_login -->|"starts sign-in"| node_auth
node_family -.->|"uses budget"| node_dashboard
node_dashboard -.->|"loads and saves"| node_store
node_period -.->|"loads and saves"| node_store
node_dashboard -->|"opens period"| node_period
node_period -.->|"edits expenses"| node_expense
node_period -.->|"adds daily entries"| node_quickadd
node_expense -->|"parses payment"| node_methods
node_search -->|"parses payment"| node_methods
node_period -->|"shows split totals"| node_calculations
node_period -.->|"uses period dates"| node_periodrules
node_store -->|"uses client"| node_firebase
node_firebase -->|"reads and writes"| node_firestore
node_dashboard -->|"exports and restores"| node_backup
node_dashboard -->|"exports report"| node_pdf
node_shell -->|"serves cached app"| node_pwa
node_shell -->|"shows settings"| node_notificationui
node_notificationui -->|"registers device"| node_registrations
node_store -->|"writes change jobs"| node_outbox
node_sender -->|"claims jobs"| node_outbox
node_sender -->|"loads devices"| node_registrations
node_sender -->|"plans messages"| node_helpers
node_helpers -->|"formats changes"| node_changes
node_sender -->|"posts messages"| node_pushover

click node_login "https://github.com/iggusti/monthly-budget/blob/main/src/routes/login/%2Bpage.svelte"
click node_auth "https://github.com/iggusti/monthly-budget/blob/main/src/lib/auth.ts"
click node_shell "https://github.com/iggusti/monthly-budget/blob/main/src/routes/%2Blayout.svelte"
click node_dashboard "https://github.com/iggusti/monthly-budget/blob/main/src/routes/%2Bpage.svelte"
click node_period "https://github.com/iggusti/monthly-budget/blob/main/src/routes/month/%5Bid%5D/%2Bpage.svelte"
click node_expense "https://github.com/iggusti/monthly-budget/blob/main/src/lib/components/ExpenseSection.svelte"
click node_quickadd "https://github.com/iggusti/monthly-budget/blob/main/src/lib/components/QuickAddDailyExpense.svelte"
click node_methods "https://github.com/iggusti/monthly-budget/blob/main/src/lib/expense-methods.ts"
click node_search "https://github.com/iggusti/monthly-budget/blob/main/src/lib/search.ts"
click node_calculations "https://github.com/iggusti/monthly-budget/blob/main/src/lib/equal-split.ts"
click node_periodrules "https://github.com/iggusti/monthly-budget/blob/main/src/lib/period.ts"
click node_store "https://github.com/iggusti/monthly-budget/blob/main/src/lib/budget-store.ts"
click node_firebase "https://github.com/iggusti/monthly-budget/blob/main/src/lib/firebase.ts"
click node_backup "https://github.com/iggusti/monthly-budget/blob/main/src/lib/backup.ts"
click node_pdf "https://github.com/iggusti/monthly-budget/blob/main/src/lib/backup-pdf.ts"
click node_pwa "https://github.com/iggusti/monthly-budget/blob/main/src/service-worker/service-worker.js"
click node_notificationui "https://github.com/iggusti/monthly-budget/blob/main/src/lib/components/NotificationToggle.svelte"
click node_registrations "https://github.com/iggusti/monthly-budget/blob/main/src/lib/notifications.svelte.ts"
click node_sender "https://github.com/iggusti/monthly-budget/blob/main/functions/send-push.js"
click node_helpers "https://github.com/iggusti/monthly-budget/blob/main/functions/notify-helpers.js"
click node_changes "https://github.com/iggusti/monthly-budget/blob/main/functions/changes.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_login,node_auth,node_shell,node_pwa toneBlue
class node_dashboard,node_period,node_expense,node_quickadd,node_methods,node_search,node_calculations,node_periodrules toneAmber
class node_store,node_firebase,node_firestore,node_backup,node_pdf toneMint
class node_notificationui,node_registrations,node_outbox,node_sender,node_helpers,node_changes toneRose
class node_family,node_pushover toneIndigo
```

## Components

### Access and shell

- [Keyword login](https://github.com/iggusti/monthly-budget/blob/main/src/routes/login/%2Bpage.svelte): `src/routes/login/+page.svelte`
- [Anonymous auth](https://github.com/iggusti/monthly-budget/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [App shell](https://github.com/iggusti/monthly-budget/blob/main/src/routes/%2Blayout.svelte): `src/routes/+layout.svelte`
- [Service worker](https://github.com/iggusti/monthly-budget/blob/main/src/service-worker/service-worker.js): `src/service-worker/service-worker.js`

### Budget workflow

- [Budget dashboard](https://github.com/iggusti/monthly-budget/blob/main/src/routes/%2Bpage.svelte): `src/routes/+page.svelte`
- [Period page](https://github.com/iggusti/monthly-budget/blob/main/src/routes/month/%5Bid%5D/%2Bpage.svelte): `src/routes/month/[id]/+page.svelte`
- [Expense sections](https://github.com/iggusti/monthly-budget/blob/main/src/lib/components/ExpenseSection.svelte): `src/lib/components/ExpenseSection.svelte`
- [Quick daily entry](https://github.com/iggusti/monthly-budget/blob/main/src/lib/components/QuickAddDailyExpense.svelte): `src/lib/components/QuickAddDailyExpense.svelte`
- [Payment methods](https://github.com/iggusti/monthly-budget/blob/main/src/lib/expense-methods.ts): `src/lib/expense-methods.ts`
- [Expense search](https://github.com/iggusti/monthly-budget/blob/main/src/lib/search.ts): `src/lib/search.ts`
- [Budget calculations](https://github.com/iggusti/monthly-budget/blob/main/src/lib/equal-split.ts): `src/lib/equal-split.ts`
- [Period rules](https://github.com/iggusti/monthly-budget/blob/main/src/lib/period.ts): `src/lib/period.ts`

### Persistence and backup

- [Budget store](https://github.com/iggusti/monthly-budget/blob/main/src/lib/budget-store.ts): `src/lib/budget-store.ts`
- [Firebase client](https://github.com/iggusti/monthly-budget/blob/main/src/lib/firebase.ts): `src/lib/firebase.ts`
- **Firestore**
- [JSON and CSV backup](https://github.com/iggusti/monthly-budget/blob/main/src/lib/backup.ts): `src/lib/backup.ts`
- [PDF report](https://github.com/iggusti/monthly-budget/blob/main/src/lib/backup-pdf.ts): `src/lib/backup-pdf.ts`

### Notifications and delivery

- [Notification settings](https://github.com/iggusti/monthly-budget/blob/main/src/lib/components/NotificationToggle.svelte): `src/lib/components/NotificationToggle.svelte`
- [Device registrations](https://github.com/iggusti/monthly-budget/blob/main/src/lib/notifications.svelte.ts): `src/lib/notifications.svelte.ts`
- **Notification outbox**
- [Push sender](https://github.com/iggusti/monthly-budget/blob/main/functions/send-push.js): `functions/send-push.js`
- [Recipient planning](https://github.com/iggusti/monthly-budget/blob/main/functions/notify-helpers.js): `functions/notify-helpers.js`
- [Change formatting](https://github.com/iggusti/monthly-budget/blob/main/functions/changes.js): `functions/changes.js`

### Other components

- **Family member**
- **Pushover**

## Connections

- Family member → Keyword login: enters keyword (evidence: `README.md`)
- Keyword login → Anonymous auth: starts sign-in (evidence: `src/lib/auth.ts`)
- Family member → Budget dashboard: uses budget
- Budget dashboard → Budget store: loads and saves
- Period page → Budget store: loads and saves
- Budget dashboard → Period page: opens period (evidence: `README.md`)
- Period page → Expense sections: edits expenses
- Period page → Quick daily entry: adds daily entries
- Expense sections → Payment methods: parses payment (evidence: `src/lib/components/ExpenseSection.svelte`)
- Expense search → Payment methods: parses payment (evidence: `src/lib/search.ts`)
- Period page → Budget calculations: shows split totals (evidence: `README.md`)
- Period page → Period rules: uses period dates
- Budget store → Firebase client: uses client (evidence: `src/lib/budget-store.ts`)
- Firebase client → Firestore: reads and writes (evidence: `src/lib/firebase.ts`)
- Budget dashboard → JSON and CSV backup: exports and restores (evidence: `README.md`)
- Budget dashboard → PDF report: exports report (evidence: `README.md`)
- App shell → Service worker: serves cached app (evidence: `README.md`)
- App shell → Notification settings: shows settings (evidence: `src/routes/+layout.svelte`)
- Notification settings → Device registrations: registers device (evidence: `README.md`)
- Budget store → Notification outbox: writes change jobs (evidence: `README.md`)
- Push sender → Notification outbox: claims jobs (evidence: `functions/send-push.js`)
- Push sender → Device registrations: loads devices (evidence: `functions/send-push.js`)
- Push sender → Recipient planning: plans messages (evidence: `functions/send-push.js`)
- Recipient planning → Change formatting: formats changes (evidence: `functions/notify-helpers.js`)
- Push sender → Pushover: posts messages (evidence: `functions/send-push.js`)
