# khalid1904/budget-bro-bb architecture

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

- Interactive diagram: https://gitdiagram.com/khalid1904/budget-bro-bb
- Repository: https://github.com/khalid1904/budget-bro-bb

## Overview

Budget Bro is a React personal-finance app for web and Capacitor Android. Users enter through public/auth routes, then manage budgets, expenses, recurring transactions, savings, lending and financial insights; shared receipts can enter through Android and be scanned into expenses. The sampled routing and context code supports the main route-to-state-to-Supabase flow. Many page implementations and the native bridge were not excerpted, so uncertain links are omitted or marked unverified.

Main entry points: [`src/App.tsx`](https://github.com/khalid1904/budget-bro-bb/blob/main/src/App.tsx) (Application routes), [`src/lib/budget-context.tsx`](https://github.com/khalid1904/budget-bro-bb/blob/main/src/lib/budget-context.tsx) (Budget state), [`src/pages/Expenses.tsx`](https://github.com/khalid1904/budget-bro-bb/blob/main/src/pages/Expenses.tsx) (Expense tracking), [`src/lib/recurring-context.tsx`](https://github.com/khalid1904/budget-bro-bb/blob/main/src/lib/recurring-context.tsx) (Recurring transactions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and access"]
  node_app["Application routes<br/>[App.tsx]"]
  node_layout["App navigation<br/>[AppLayout.tsx]"]
  node_auth["Authentication flow<br/>[auth-flow.ts]"]
end

subgraph group_finance["Finance features"]
  node_budget["Budget state<br/>[budget-context.tsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_budgetpage["Budget management<br/>[Budget.tsx]"]
  node_expenses["Expense tracking<br/>[Expenses.tsx]"]
  node_analytics["Analytics<br/>[Analytics.tsx]"]
  node_yearly["Yearly insights<br/>[YearlyInsights.tsx]"]
  node_recurring["Recurring transactions"]
  node_recurringpage["Recurring management<br/>[Recurring.tsx]"]
  node_lending["Lending tracker<br/>[Lending.tsx]"]
  node_savings["Savings goals<br/>[SavingsGoals.tsx]"]
  node_otherbudgets["Other budgets<br/>[OtherBudgets.tsx]"]
  node_settings["Settings and profile<br/>[Settings.tsx]"]
end

subgraph group_platform["Backend and sharing"]
  node_supabase["Supabase service<br/>[client.ts]"]
  node_db[("Supabase data store")]
  node_receipt["Receipt scanning<br/>[bill-scan.ts]"]
  node_scanfn["Bill scan function<br/>[index.ts]"]
  node_android["Android share bridge"]
  node_sharelib["Native receipt adapter"]
end

subgraph group_ui["Presentation"]
  node_ui["UI components"]
  node_icons["Category icons<br/>[category-icons.ts]"]
end

node_user(("App user"))

node_user -->|"opens"| node_app
node_app -->|"routes auth"| node_auth
node_app -.->|"renders shell"| node_layout
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_budgetpage
node_app -->|"routes to"| node_expenses
node_app -->|"routes to"| node_analytics
node_app -->|"routes to"| node_recurringpage
node_app -->|"routes to"| node_lending
node_app -->|"routes to"| node_savings
node_app -->|"routes to"| node_settings
node_dashboard -->|"reads state"| node_budget
node_budgetpage -->|"reads state"| node_budget
node_expenses -->|"reads state"| node_budget
node_analytics -->|"reads state"| node_budget
node_lending -->|"reads state"| node_budget
node_recurringpage -.->|"uses context"| node_recurring
node_recurring -->|"uses user state"| node_budget
node_yearly -.->|"reads state"| node_budget
node_otherbudgets -.->|"reads state"| node_budget
node_settings -.->|"reads state"| node_budget
node_budget -->|"queries data"| node_supabase
node_recurring -->|"queries data"| node_supabase
node_supabase -->|"reads and writes"| node_db
node_expenses -->|"scans receipts"| node_receipt
node_expenses -->|"consumes shared images"| node_sharelib
node_sharelib -.->|"receives shared files"| node_android
node_receipt -.->|"invokes scan"| node_scanfn
node_expenses -->|"uses categories"| node_icons
node_app -->|"renders providers"| node_ui

click node_app "https://github.com/khalid1904/budget-bro-bb/blob/main/src/App.tsx"
click node_layout "https://github.com/khalid1904/budget-bro-bb/blob/main/src/components/layout/AppLayout.tsx"
click node_auth "https://github.com/khalid1904/budget-bro-bb/blob/main/src/lib/auth-flow.ts"
click node_budget "https://github.com/khalid1904/budget-bro-bb/blob/main/src/lib/budget-context.tsx"
click node_dashboard "https://github.com/khalid1904/budget-bro-bb/blob/main/src/pages/Dashboard.tsx"
click node_budgetpage "https://github.com/khalid1904/budget-bro-bb/blob/main/src/pages/Budget.tsx"
click node_expenses "https://github.com/khalid1904/budget-bro-bb/blob/main/src/pages/Expenses.tsx"
click node_analytics "https://github.com/khalid1904/budget-bro-bb/blob/main/src/pages/Analytics.tsx"
click node_yearly "https://github.com/khalid1904/budget-bro-bb/blob/main/src/pages/YearlyInsights.tsx"
click node_recurring "https://github.com/khalid1904/budget-bro-bb/blob/main/src/lib/recurring-context.tsx"
click node_recurringpage "https://github.com/khalid1904/budget-bro-bb/blob/main/src/pages/Recurring.tsx"
click node_lending "https://github.com/khalid1904/budget-bro-bb/blob/main/src/pages/Lending.tsx"
click node_savings "https://github.com/khalid1904/budget-bro-bb/blob/main/src/pages/SavingsGoals.tsx"
click node_otherbudgets "https://github.com/khalid1904/budget-bro-bb/blob/main/src/pages/OtherBudgets.tsx"
click node_settings "https://github.com/khalid1904/budget-bro-bb/blob/main/src/pages/Settings.tsx"
click node_supabase "https://github.com/khalid1904/budget-bro-bb/blob/main/src/integrations/supabase/client.ts"
click node_receipt "https://github.com/khalid1904/budget-bro-bb/blob/main/src/lib/bill-scan.ts"
click node_scanfn "https://github.com/khalid1904/budget-bro-bb/blob/main/supabase/functions/scan-bill/index.ts"
click node_android "https://github.com/khalid1904/budget-bro-bb/blob/main/android/app/src/main/java/app/lovable/p83abe351206248f9a1cefeca04124c9c/ReceiptSharePlugin.java"
click node_sharelib "https://github.com/khalid1904/budget-bro-bb/blob/main/src/lib/android-receipt-share.ts"
click node_ui "https://github.com/khalid1904/budget-bro-bb/tree/main/src/components/ui"
click node_icons "https://github.com/khalid1904/budget-bro-bb/blob/main/src/lib/category-icons.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_auth,node_user toneBlue
class node_budget,node_dashboard,node_budgetpage,node_expenses,node_analytics,node_yearly,node_recurring,node_recurringpage,node_lending,node_savings,node_otherbudgets,node_settings toneAmber
class node_supabase,node_db,node_receipt,node_scanfn,node_android,node_sharelib toneMint
class node_ui,node_icons toneRose
```

## Components

### App and access

- [Application routes](https://github.com/khalid1904/budget-bro-bb/blob/main/src/App.tsx): `src/App.tsx`
- [App navigation](https://github.com/khalid1904/budget-bro-bb/blob/main/src/components/layout/AppLayout.tsx): `src/components/layout/AppLayout.tsx`
- [Authentication flow](https://github.com/khalid1904/budget-bro-bb/blob/main/src/lib/auth-flow.ts): `src/lib/auth-flow.ts`

### Finance features

- [Budget state](https://github.com/khalid1904/budget-bro-bb/blob/main/src/lib/budget-context.tsx): `src/lib/budget-context.tsx`
- [Dashboard](https://github.com/khalid1904/budget-bro-bb/blob/main/src/pages/Dashboard.tsx): `src/pages/Dashboard.tsx`
- [Budget management](https://github.com/khalid1904/budget-bro-bb/blob/main/src/pages/Budget.tsx): `src/pages/Budget.tsx`
- [Expense tracking](https://github.com/khalid1904/budget-bro-bb/blob/main/src/pages/Expenses.tsx): `src/pages/Expenses.tsx`
- [Analytics](https://github.com/khalid1904/budget-bro-bb/blob/main/src/pages/Analytics.tsx): `src/pages/Analytics.tsx`
- [Yearly insights](https://github.com/khalid1904/budget-bro-bb/blob/main/src/pages/YearlyInsights.tsx): `src/pages/YearlyInsights.tsx`
- [Recurring transactions](https://github.com/khalid1904/budget-bro-bb/blob/main/src/lib/recurring-context.tsx): `src/lib/recurring-context.tsx`
- [Recurring management](https://github.com/khalid1904/budget-bro-bb/blob/main/src/pages/Recurring.tsx): `src/pages/Recurring.tsx`
- [Lending tracker](https://github.com/khalid1904/budget-bro-bb/blob/main/src/pages/Lending.tsx): `src/pages/Lending.tsx`
- [Savings goals](https://github.com/khalid1904/budget-bro-bb/blob/main/src/pages/SavingsGoals.tsx): `src/pages/SavingsGoals.tsx`
- [Other budgets](https://github.com/khalid1904/budget-bro-bb/blob/main/src/pages/OtherBudgets.tsx): `src/pages/OtherBudgets.tsx`
- [Settings and profile](https://github.com/khalid1904/budget-bro-bb/blob/main/src/pages/Settings.tsx): `src/pages/Settings.tsx`

### Backend and sharing

- [Supabase service](https://github.com/khalid1904/budget-bro-bb/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- **Supabase data store**
- [Receipt scanning](https://github.com/khalid1904/budget-bro-bb/blob/main/src/lib/bill-scan.ts): `src/lib/bill-scan.ts`
- [Bill scan function](https://github.com/khalid1904/budget-bro-bb/blob/main/supabase/functions/scan-bill/index.ts): `supabase/functions/scan-bill/index.ts`
- [Android share bridge](https://github.com/khalid1904/budget-bro-bb/blob/main/android/app/src/main/java/app/lovable/p83abe351206248f9a1cefeca04124c9c/ReceiptSharePlugin.java): `android/app/src/main/java/app/lovable/p83abe351206248f9a1cefeca04124c9c/ReceiptSharePlugin.java`
- [Native receipt adapter](https://github.com/khalid1904/budget-bro-bb/blob/main/src/lib/android-receipt-share.ts): `src/lib/android-receipt-share.ts`

### Presentation

- [UI components](https://github.com/khalid1904/budget-bro-bb/tree/main/src/components/ui): `src/components/ui`
- [Category icons](https://github.com/khalid1904/budget-bro-bb/blob/main/src/lib/category-icons.ts): `src/lib/category-icons.ts`

### Other components

- **App user**

## Connections

- App user → Application routes: opens
- Application routes → Authentication flow: routes auth (evidence: `src/App.tsx`)
- Application routes → App navigation: renders shell (evidence: `src/App.tsx`)
- Application routes → Dashboard: routes to (evidence: `src/App.tsx`)
- Application routes → Budget management: routes to (evidence: `src/App.tsx`)
- Application routes → Expense tracking: routes to (evidence: `src/App.tsx`)
- Application routes → Analytics: routes to (evidence: `src/App.tsx`)
- Application routes → Recurring management: routes to (evidence: `src/App.tsx`)
- Application routes → Lending tracker: routes to (evidence: `src/App.tsx`)
- Application routes → Savings goals: routes to (evidence: `src/App.tsx`)
- Application routes → Settings and profile: routes to (evidence: `src/App.tsx`)
- Dashboard → Budget state: reads state
- Budget management → Budget state: reads state
- Expense tracking → Budget state: reads state (evidence: `src/pages/Expenses.tsx`)
- Analytics → Budget state: reads state
- Lending tracker → Budget state: reads state (evidence: `src/pages/Lending.tsx`)
- Recurring management → Recurring transactions: uses context
- Recurring transactions → Budget state: uses user state (evidence: `src/lib/recurring-context.tsx`)
- Yearly insights → Budget state: reads state
- Other budgets → Budget state: reads state
- Settings and profile → Budget state: reads state
- Budget state → Supabase service: queries data (evidence: `src/lib/budget-context.tsx`)
- Recurring transactions → Supabase service: queries data (evidence: `src/lib/recurring-context.tsx`)
- Supabase service → Supabase data store: reads and writes (evidence: `src/integrations/supabase/client.ts`)
- Expense tracking → Receipt scanning: scans receipts (evidence: `src/pages/Expenses.tsx`)
- Expense tracking → Native receipt adapter: consumes shared images (evidence: `src/pages/Expenses.tsx`)
- Native receipt adapter → Android share bridge: receives shared files
- Receipt scanning → Bill scan function: invokes scan
- Expense tracking → Category icons: uses categories (evidence: `src/pages/Expenses.tsx`)
- Application routes → UI components: renders providers (evidence: `src/App.tsx`)
