# muju3013/loan-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/muju3013/loan-tracker
- Repository: https://github.com/muju3013/loan-tracker

## Overview

Personal Loan & EMI Tracker: users authenticate, manage loans and payments, and review schedules, reminders, and outstanding balances. The main runtime is React routes backed by an app-store context; loan calculations and schedule updates are handled in a domain service, with user data synchronized through Firestore. The README documents the core tracking workflow, while sampled source also shows notification and financial-advice services. Some page-to-service wiring is not shown in the excerpts, so uncertain links are omitted.

Main entry points: [`src/App.tsx`](https://github.com/muju3013/loan-tracker/blob/main/src/App.tsx) (Routes and providers), [`src/hooks/useAppStore.tsx`](https://github.com/muju3013/loan-tracker/blob/main/src/hooks/useAppStore.tsx) (App store), [`src/pages/DashboardPage.tsx`](https://github.com/muju3013/loan-tracker/blob/main/src/pages/DashboardPage.tsx) (Dashboard), [`src/pages/LoansPage.tsx`](https://github.com/muju3013/loan-tracker/blob/main/src/pages/LoansPage.tsx) (Loan pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and pages"]
  node_app["Routes and providers<br/>[App.tsx]"]
  node_authpage["Sign-in page<br/>[AuthPage.tsx]"]
  node_dashboard["Dashboard<br/>[DashboardPage.tsx]"]
  node_loanspages["Loan pages<br/>[LoansPage.tsx]"]
  node_loanform["Loan form<br/>[LoanForm.tsx]"]
  node_holidays["Holiday settings<br/>[HolidaysPage.tsx]"]
  node_notificationspage["Notifications page"]
end

subgraph group_domain["Loan domain"]
  node_loanservice["Loan operations<br/>[loanService.ts]"]
  node_emi["EMI calculator<br/>[emiCalculator.ts]"]
  node_duedate["Due-date engine<br/>[dueDateEngine.ts]"]
  node_reminderpick["Upcoming EMI selection<br/>[nextReminder.ts]"]
end

subgraph group_data["User data"]
  node_appstore["App store<br/>[useAppStore.tsx]"]
  node_firestoreservice["Firestore sync"]
end

subgraph group_support["Account and reminders"]
  node_auth["Auth context<br/>[useAuth.tsx]"]
  node_firebaseauth["Firebase auth operations<br/>[firebaseAuth.ts]"]
  node_notificationservice["Reminder service"]
  node_advisor["Loan advice"]
  node_export["Data export<br/>[exportService.ts]"]
end

node_user(("User"))
node_firestore[("Cloud Firestore")]
node_firebase[("Firebase Authentication")]
node_systemnotifications["System notifications"]

node_user -->|"uses"| node_app
node_app -->|"provides auth"| node_auth
node_app -->|"provides data"| node_appstore
node_app -->|"routes to"| node_authpage
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_loanspages
node_app -->|"routes to"| node_holidays
node_app -->|"routes to"| node_notificationspage
node_authpage -->|"uses"| node_auth
node_auth -->|"calls"| node_firebaseauth
node_firebaseauth -->|"authenticates with"| node_firebase
node_loanspages -->|"uses"| node_loanform
node_loanform -->|"submits loan"| node_appstore
node_holidays -->|"updates holidays"| node_appstore
node_dashboard -->|"reads summary"| node_appstore
node_appstore -->|"updates loan data"| node_loanservice
node_loanservice -->|"calculates installments"| node_emi
node_loanservice -->|"resolves due dates"| node_duedate
node_appstore -->|"selects upcoming EMIs"| node_reminderpick
node_appstore -->|"subscribes and syncs"| node_firestoreservice
node_firestoreservice -->|"reads and writes"| node_firestore
node_notificationspage -->|"manages reminders"| node_notificationservice
node_notificationservice -->|"reads and writes"| node_firestore
node_notificationservice -->|"dispatches"| node_systemnotifications
node_dashboard -.->|"advice capability"| node_advisor
node_loanspages -.->|"export capability"| node_export

click node_app "https://github.com/muju3013/loan-tracker/blob/main/src/App.tsx"
click node_authpage "https://github.com/muju3013/loan-tracker/blob/main/src/pages/AuthPage.tsx"
click node_dashboard "https://github.com/muju3013/loan-tracker/blob/main/src/pages/DashboardPage.tsx"
click node_loanspages "https://github.com/muju3013/loan-tracker/blob/main/src/pages/LoansPage.tsx"
click node_loanform "https://github.com/muju3013/loan-tracker/blob/main/src/components/LoanForm.tsx"
click node_holidays "https://github.com/muju3013/loan-tracker/blob/main/src/pages/HolidaysPage.tsx"
click node_notificationspage "https://github.com/muju3013/loan-tracker/blob/main/src/pages/NotificationsPage.tsx"
click node_appstore "https://github.com/muju3013/loan-tracker/blob/main/src/hooks/useAppStore.tsx"
click node_loanservice "https://github.com/muju3013/loan-tracker/blob/main/src/services/loanService.ts"
click node_emi "https://github.com/muju3013/loan-tracker/blob/main/src/utils/emiCalculator.ts"
click node_duedate "https://github.com/muju3013/loan-tracker/blob/main/src/utils/dueDateEngine.ts"
click node_reminderpick "https://github.com/muju3013/loan-tracker/blob/main/src/utils/nextReminder.ts"
click node_firestoreservice "https://github.com/muju3013/loan-tracker/blob/main/src/services/firestoreService.ts"
click node_auth "https://github.com/muju3013/loan-tracker/blob/main/src/hooks/useAuth.tsx"
click node_firebaseauth "https://github.com/muju3013/loan-tracker/blob/main/src/utils/firebaseAuth.ts"
click node_notificationservice "https://github.com/muju3013/loan-tracker/blob/main/src/services/notificationService.ts"
click node_advisor "https://github.com/muju3013/loan-tracker/blob/main/src/services/aiAdvisorService.ts"
click node_export "https://github.com/muju3013/loan-tracker/blob/main/src/services/exportService.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_authpage,node_dashboard,node_loanspages,node_loanform,node_holidays,node_notificationspage,node_user toneBlue
class node_loanservice,node_emi,node_duedate,node_reminderpick,node_firestore,node_firebase toneAmber
class node_appstore,node_firestoreservice toneMint
class node_auth,node_firebaseauth,node_notificationservice,node_advisor,node_export toneRose
class node_systemnotifications toneIndigo
```

## Components

### App and pages

- [Routes and providers](https://github.com/muju3013/loan-tracker/blob/main/src/App.tsx): `src/App.tsx`
- [Sign-in page](https://github.com/muju3013/loan-tracker/blob/main/src/pages/AuthPage.tsx): `src/pages/AuthPage.tsx`
- [Dashboard](https://github.com/muju3013/loan-tracker/blob/main/src/pages/DashboardPage.tsx): `src/pages/DashboardPage.tsx`
- [Loan pages](https://github.com/muju3013/loan-tracker/blob/main/src/pages/LoansPage.tsx): `src/pages/LoansPage.tsx`
- [Loan form](https://github.com/muju3013/loan-tracker/blob/main/src/components/LoanForm.tsx): `src/components/LoanForm.tsx`
- [Holiday settings](https://github.com/muju3013/loan-tracker/blob/main/src/pages/HolidaysPage.tsx): `src/pages/HolidaysPage.tsx`
- [Notifications page](https://github.com/muju3013/loan-tracker/blob/main/src/pages/NotificationsPage.tsx): `src/pages/NotificationsPage.tsx`

### Loan domain

- [Loan operations](https://github.com/muju3013/loan-tracker/blob/main/src/services/loanService.ts): `src/services/loanService.ts`
- [EMI calculator](https://github.com/muju3013/loan-tracker/blob/main/src/utils/emiCalculator.ts): `src/utils/emiCalculator.ts`
- [Due-date engine](https://github.com/muju3013/loan-tracker/blob/main/src/utils/dueDateEngine.ts): `src/utils/dueDateEngine.ts`
- [Upcoming EMI selection](https://github.com/muju3013/loan-tracker/blob/main/src/utils/nextReminder.ts): `src/utils/nextReminder.ts`

### User data

- [App store](https://github.com/muju3013/loan-tracker/blob/main/src/hooks/useAppStore.tsx): `src/hooks/useAppStore.tsx`
- [Firestore sync](https://github.com/muju3013/loan-tracker/blob/main/src/services/firestoreService.ts): `src/services/firestoreService.ts`

### Account and reminders

- [Auth context](https://github.com/muju3013/loan-tracker/blob/main/src/hooks/useAuth.tsx): `src/hooks/useAuth.tsx`
- [Firebase auth operations](https://github.com/muju3013/loan-tracker/blob/main/src/utils/firebaseAuth.ts): `src/utils/firebaseAuth.ts`
- [Reminder service](https://github.com/muju3013/loan-tracker/blob/main/src/services/notificationService.ts): `src/services/notificationService.ts`
- [Loan advice](https://github.com/muju3013/loan-tracker/blob/main/src/services/aiAdvisorService.ts): `src/services/aiAdvisorService.ts`
- [Data export](https://github.com/muju3013/loan-tracker/blob/main/src/services/exportService.ts): `src/services/exportService.ts`

### Other components

- **User**
- **Cloud Firestore**
- **Firebase Authentication**
- **System notifications**

## Connections

- User → Routes and providers: uses
- Routes and providers → Auth context: provides auth
- Routes and providers → App store: provides data
- Routes and providers → Sign-in page: routes to
- Routes and providers → Dashboard: routes to
- Routes and providers → Loan pages: routes to
- Routes and providers → Holiday settings: routes to
- Routes and providers → Notifications page: routes to
- Sign-in page → Auth context: uses
- Auth context → Firebase auth operations: calls
- Firebase auth operations → Firebase Authentication: authenticates with
- Loan pages → Loan form: uses
- Loan form → App store: submits loan
- Holiday settings → App store: updates holidays
- Dashboard → App store: reads summary
- App store → Loan operations: updates loan data
- Loan operations → EMI calculator: calculates installments
- Loan operations → Due-date engine: resolves due dates
- App store → Upcoming EMI selection: selects upcoming EMIs
- App store → Firestore sync: subscribes and syncs
- Firestore sync → Cloud Firestore: reads and writes
- Notifications page → Reminder service: manages reminders
- Reminder service → Cloud Firestore: reads and writes
- Reminder service → System notifications: dispatches
- Dashboard → Loan advice: advice capability
- Loan pages → Data export: export capability
