# enthonydev/real-balance-room-rbr. architecture

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

- Interactive diagram: https://gitdiagram.com/enthonydev/real-balance-room-rbr.
- Repository: https://github.com/enthonydev/real-balance-room-rbr.

## Overview

RBR is a local mortgage-planning and simulation application. The main workflow is entering financing details, choosing an amortization strategy, reviewing projected results, and saving or revisiting financing records. The README documents Price/SAC schedules, extra-payment comparisons, dashboard indicators, and a paginated amortization table. The React app and API/storage calls are partly evidenced by excerpts; some client-to-API wiring is not shown, so that link is marked unverified. Bank/Open Finance and document-import capabilities are explicitly roadmap items, not implemented subsystems.

Main entry points: [`client/src/pages/Home.tsx`](https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/pages/Home.tsx) (Planning workspace), [`client/src/App.tsx`](https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/App.tsx) (App routing), [`client/src/pages/Auth.tsx`](https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/pages/Auth.tsx) (Sign-in screen), [`client/src/contexts/AuthContext.tsx`](https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/contexts/AuthContext.tsx) (Auth state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_entry["App routing<br/>[App.tsx]"]
  node_authpage["Sign-in screen<br/>[Auth.tsx]"]
  node_home["Planning workspace<br/>[Home.tsx]"]
  node_inputs["Financing inputs<br/>[Home.tsx]"]
  node_strategy["Payment strategy<br/>[Home.tsx]"]
  node_dashboard["Results dashboard<br/>[Home.tsx]"]
  node_schedule["Amortization table<br/>[Home.tsx]"]
  node_history["Financing history<br/>[Home.tsx]"]
end

subgraph group_domain["Financial domain"]
  node_finance["Simulation engine<br/>[finance.ts]"]
end

subgraph group_service["Persistence and API"]
  node_api_client["API client<br/>[api.ts]"]
  node_routes["Financing API<br/>[index.ts]"]
  node_storage[("SQLite operations<br/>[db.ts]")]
end

subgraph group_identity["Identity and shared UI"]
  node_firebase{{"Firebase Auth"}}
  node_auth_context["Auth state<br/>[AuthContext.tsx]"]
  node_theme["Theme provider<br/>[ThemeContext.tsx]"]
  node_boundary["Error boundary<br/>[ErrorBoundary.tsx]"]
  node_persist_fn["Stable callback hook<br/>[usePersistFn.ts]"]
  node_composition["Composition hook<br/>[useComposition.ts]"]
end

node_user(("User"))

node_user -->|"opens app"| node_entry
node_entry -->|"routes to"| node_home
node_entry -->|"routes to"| node_authpage
node_entry -->|"provides auth"| node_auth_context
node_entry -->|"provides theme"| node_theme
node_entry -->|"wraps app"| node_boundary
node_home -->|"collects"| node_inputs
node_home -->|"configures"| node_strategy
node_home -->|"simulates locally"| node_finance
node_home -->|"shows projections"| node_dashboard
node_home -->|"shows schedule"| node_schedule
node_home -->|"manages records"| node_history
node_home -.->|"uses API"| node_api_client
node_api_client -.->|"sends requests"| node_routes
node_routes -->|"reads and writes"| node_storage
node_authpage -->|"authenticates"| node_firebase
node_authpage -->|"reads auth state"| node_auth_context
node_auth_context -->|"observes session"| node_firebase
node_composition -->|"uses callbacks"| node_persist_fn

click node_entry "https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/App.tsx"
click node_authpage "https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/pages/Auth.tsx"
click node_home "https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/pages/Home.tsx"
click node_inputs "https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/pages/Home.tsx"
click node_strategy "https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/pages/Home.tsx"
click node_dashboard "https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/pages/Home.tsx"
click node_schedule "https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/pages/Home.tsx"
click node_history "https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/pages/Home.tsx"
click node_finance "https://github.com/enthonydev/real-balance-room-rbr./blob/main/shared/finance.ts"
click node_api_client "https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/lib/api.ts"
click node_routes "https://github.com/enthonydev/real-balance-room-rbr./blob/main/server/index.ts"
click node_storage "https://github.com/enthonydev/real-balance-room-rbr./blob/main/server/db.ts"
click node_auth_context "https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/contexts/AuthContext.tsx"
click node_theme "https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/contexts/ThemeContext.tsx"
click node_boundary "https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/components/ErrorBoundary.tsx"
click node_persist_fn "https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/hooks/usePersistFn.ts"
click node_composition "https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/hooks/useComposition.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_entry,node_authpage,node_home,node_inputs,node_strategy,node_dashboard,node_schedule,node_history,node_user toneBlue
class node_finance toneAmber
class node_api_client,node_routes,node_storage toneMint
class node_firebase,node_auth_context,node_theme,node_boundary,node_persist_fn,node_composition toneRose
```

## Components

### User experience

- [App routing](https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/App.tsx): `client/src/App.tsx`
- [Sign-in screen](https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/pages/Auth.tsx): `client/src/pages/Auth.tsx`
- [Planning workspace](https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/pages/Home.tsx): `client/src/pages/Home.tsx`
- [Financing inputs](https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/pages/Home.tsx): `client/src/pages/Home.tsx`
- [Payment strategy](https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/pages/Home.tsx): `client/src/pages/Home.tsx`
- [Results dashboard](https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/pages/Home.tsx): `client/src/pages/Home.tsx`
- [Amortization table](https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/pages/Home.tsx): `client/src/pages/Home.tsx`
- [Financing history](https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/pages/Home.tsx): `client/src/pages/Home.tsx`

### Financial domain

- [Simulation engine](https://github.com/enthonydev/real-balance-room-rbr./blob/main/shared/finance.ts): `shared/finance.ts`

### Persistence and API

- [API client](https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/lib/api.ts): `client/src/lib/api.ts`
- [Financing API](https://github.com/enthonydev/real-balance-room-rbr./blob/main/server/index.ts): `server/index.ts`
- [SQLite operations](https://github.com/enthonydev/real-balance-room-rbr./blob/main/server/db.ts): `server/db.ts`

### Identity and shared UI

- **Firebase Auth**
- [Auth state](https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/contexts/AuthContext.tsx): `client/src/contexts/AuthContext.tsx`
- [Theme provider](https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/contexts/ThemeContext.tsx): `client/src/contexts/ThemeContext.tsx`
- [Error boundary](https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/components/ErrorBoundary.tsx): `client/src/components/ErrorBoundary.tsx`
- [Stable callback hook](https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/hooks/usePersistFn.ts): `client/src/hooks/usePersistFn.ts`
- [Composition hook](https://github.com/enthonydev/real-balance-room-rbr./blob/main/client/src/hooks/useComposition.ts): `client/src/hooks/useComposition.ts`

### Other components

- **User**

## Connections

- User → App routing: opens app
- App routing → Planning workspace: routes to (evidence: `client/src/App.tsx`)
- App routing → Sign-in screen: routes to (evidence: `client/src/App.tsx`)
- App routing → Auth state: provides auth (evidence: `client/src/App.tsx`)
- App routing → Theme provider: provides theme (evidence: `client/src/App.tsx`)
- App routing → Error boundary: wraps app (evidence: `client/src/App.tsx`)
- Planning workspace → Financing inputs: collects (evidence: `README.md`)
- Planning workspace → Payment strategy: configures (evidence: `README.md`)
- Planning workspace → Simulation engine: simulates locally (evidence: `README.md`)
- Planning workspace → Results dashboard: shows projections (evidence: `README.md`)
- Planning workspace → Amortization table: shows schedule (evidence: `README.md`)
- Planning workspace → Financing history: manages records (evidence: `README.md`)
- Planning workspace → API client: uses API
- API client → Financing API: sends requests
- Financing API → SQLite operations: reads and writes (evidence: `server/index.ts`)
- Sign-in screen → Firebase Auth: authenticates (evidence: `client/src/pages/Auth.tsx`)
- Sign-in screen → Auth state: reads auth state (evidence: `client/src/pages/Auth.tsx`)
- Auth state → Firebase Auth: observes session (evidence: `client/src/contexts/AuthContext.tsx`)
- Composition hook → Stable callback hook: uses callbacks (evidence: `client/src/hooks/useComposition.ts`)
