# ddancingdeath/aadhatmanagementapp architecture

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

- Interactive diagram: https://gitdiagram.com/ddancingdeath/aadhatmanagementapp
- Repository: https://github.com/ddancingdeath/aadhatmanagementapp

## Overview

Aadhat is a wholesale/retail business-management app. Users sign in, work with purchase and sales bills, stock, cash and dues, then review operational and financial reports; Firestore syncs app data. The map retains the README’s distinct reporting, anomaly, rate-trend, notification and production-health capabilities. Main, Firestore, cash, UI and TIP excerpts support some links; other feature modules are included from the tree and README, so their internal call paths are not inferred.

Main entry points: [`www/js/main.js`](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/main.js) (App startup), [`www/js/firebase/firestore-service.js`](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/firebase/firestore-service.js) (Firestore service), [`www/js/modules/cash-management.js`](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/cash-management.js) (Cash management), [`www/js/auth/authentication.js`](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/auth/authentication.js) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry and access"]
  node_main["App startup<br/>[main.js]"]
  node_auth["Authentication<br/>[authentication.js]"]
  node_ui["UI manager<br/>[ui-manager.js]"]
end

subgraph group_operations["Business operations"]
  node_items["Items and rates<br/>[items.js]"]
  node_billing["Purchase and retail bills<br/>[billing.js]"]
  node_wholesale["Wholesale sales<br/>[wholesale-sales.js]"]
  node_stock["Stock tracking<br/>[stock.js]"]
  node_cash["Cash management<br/>[cash-management.js]"]
  node_outstanding["Outstanding dues<br/>[outstanding.js]"]
  node_history["Transaction history<br/>[history.js]"]
end

subgraph group_insights["Reports and oversight"]
  node_finance["Finance<br/>[finance.js]"]
  node_reports["Reports<br/>[reports.js]"]
  node_analytics["Analytics<br/>[analytics.js]"]
  node_anomalies["Anomaly review<br/>[anomalies.js]"]
  node_rate_trends["Rate trends<br/>[rate-trends.js]"]
  node_health["App health<br/>[health.js]"]
  node_notifications["In-app notifications<br/>[notifications.js]"]
end

subgraph group_platform["Data and integrations"]
  node_firestore_service["Firestore service"]
  node_firestore[("Cloud Firestore")]
  node_firebase_auth(("Firebase Auth"))
  node_printer["Bluetooth printing<br/>[printer.js]"]
  node_service_worker["Offline support<br/>[service-worker.js]"]
end

subgraph group_shared["Shared runtime"]
  node_state["Application state<br/>[state.js]"]
  node_cash_session["Cash calculations<br/>[cash-session.js]"]
  node_tip["Production checks<br/>[index.js]"]
end

node_user(("Business user"))

node_user -->|"opens app"| node_main
node_main -->|"initializes"| node_auth
node_main -->|"uses"| node_ui
node_main -->|"initializes"| node_firestore_service
node_main -->|"loads"| node_items
node_main -->|"loads"| node_billing
node_main -->|"loads"| node_wholesale
node_main -->|"loads"| node_stock
node_main -->|"loads"| node_history
node_main -->|"loads"| node_outstanding
node_main -->|"loads"| node_reports
node_main -->|"loads"| node_printer
node_auth -->|"authenticates users"| node_firebase_auth
node_auth -->|"reads profiles"| node_firestore
node_firestore_service -->|"reads and writes"| node_firestore
node_firestore_service -->|"updates"| node_state
node_firestore_service -->|"records bill checks"| node_tip
node_cash -->|"reads and writes"| node_firestore_service
node_cash -->|"calculates totals"| node_cash_session
node_cash -->|"uses due payments"| node_outstanding
node_printer -.->|"prints receipts"| node_user
node_tip -->|"reports health"| node_firestore_service
node_firestore_service -->|"syncs item data"| node_items
node_firestore_service -->|"syncs stock data"| node_stock
node_firestore_service -->|"syncs cash sessions"| node_cash
node_user -.->|"reviews"| node_finance
node_user -.->|"reviews"| node_analytics
node_user -.->|"reviews"| node_anomalies
node_user -.->|"reviews"| node_rate_trends
node_user -.->|"reviews"| node_health
node_user -.->|"checks inbox"| node_notifications
node_user -.->|"uses offline app"| node_service_worker

click node_main "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/main.js"
click node_auth "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/auth/authentication.js"
click node_ui "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/ui/ui-manager.js"
click node_items "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/items.js"
click node_billing "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/billing.js"
click node_wholesale "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/wholesale-sales.js"
click node_stock "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/stock.js"
click node_cash "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/cash-management.js"
click node_outstanding "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/outstanding.js"
click node_history "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/history.js"
click node_finance "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/finance.js"
click node_reports "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/reports.js"
click node_analytics "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/analytics.js"
click node_anomalies "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/anomalies.js"
click node_rate_trends "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/rate-trends.js"
click node_health "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/health.js"
click node_notifications "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/notifications.js"
click node_firestore_service "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/firebase/firestore-service.js"
click node_printer "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/services/printer.js"
click node_service_worker "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/service-worker.js"
click node_state "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/utils/state.js"
click node_cash_session "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/utils/cash-session.js"
click node_tip "https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/tip/index.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_main,node_auth,node_ui,node_user toneBlue
class node_items,node_billing,node_wholesale,node_stock,node_cash,node_outstanding,node_history toneAmber
class node_finance,node_reports,node_analytics,node_anomalies,node_rate_trends,node_health,node_notifications toneMint
class node_firestore_service,node_firestore,node_firebase_auth,node_printer,node_service_worker toneRose
class node_state,node_cash_session,node_tip toneIndigo
```

## Components

### App entry and access

- [App startup](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/main.js): `www/js/main.js`
- [Authentication](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/auth/authentication.js): `www/js/auth/authentication.js`
- [UI manager](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/ui/ui-manager.js): `www/js/ui/ui-manager.js`

### Business operations

- [Items and rates](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/items.js): `www/js/modules/items.js`
- [Purchase and retail bills](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/billing.js): `www/js/modules/billing.js`
- [Wholesale sales](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/wholesale-sales.js): `www/js/modules/wholesale-sales.js`
- [Stock tracking](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/stock.js): `www/js/modules/stock.js`
- [Cash management](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/cash-management.js): `www/js/modules/cash-management.js`
- [Outstanding dues](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/outstanding.js): `www/js/modules/outstanding.js`
- [Transaction history](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/history.js): `www/js/modules/history.js`

### Reports and oversight

- [Finance](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/finance.js): `www/js/modules/finance.js`
- [Reports](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/reports.js): `www/js/modules/reports.js`
- [Analytics](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/analytics.js): `www/js/modules/analytics.js`
- [Anomaly review](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/anomalies.js): `www/js/modules/anomalies.js`
- [Rate trends](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/rate-trends.js): `www/js/modules/rate-trends.js`
- [App health](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/health.js): `www/js/modules/health.js`
- [In-app notifications](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/modules/notifications.js): `www/js/modules/notifications.js`

### Data and integrations

- [Firestore service](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/firebase/firestore-service.js): `www/js/firebase/firestore-service.js`
- **Cloud Firestore**
- **Firebase Auth**
- [Bluetooth printing](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/services/printer.js): `www/js/services/printer.js`
- [Offline support](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/service-worker.js): `www/service-worker.js`

### Shared runtime

- [Application state](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/utils/state.js): `www/js/utils/state.js`
- [Cash calculations](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/utils/cash-session.js): `www/js/utils/cash-session.js`
- [Production checks](https://github.com/ddancingdeath/aadhatmanagementapp/blob/main/www/js/tip/index.js): `www/js/tip/index.js`

### Other components

- **Business user**

## Connections

- Business user → App startup: opens app (evidence: `README.md`)
- App startup → Authentication: initializes (evidence: `www/js/main.js`)
- App startup → UI manager: uses (evidence: `www/js/main.js`)
- App startup → Firestore service: initializes (evidence: `www/js/main.js`)
- App startup → Items and rates: loads (evidence: `www/js/main.js`)
- App startup → Purchase and retail bills: loads (evidence: `www/js/main.js`)
- App startup → Wholesale sales: loads (evidence: `www/js/main.js`)
- App startup → Stock tracking: loads (evidence: `www/js/main.js`)
- App startup → Transaction history: loads (evidence: `www/js/main.js`)
- App startup → Outstanding dues: loads (evidence: `www/js/main.js`)
- App startup → Reports: loads (evidence: `www/js/main.js`)
- App startup → Bluetooth printing: loads (evidence: `www/js/main.js`)
- Authentication → Firebase Auth: authenticates users (evidence: `www/js/auth/authentication.js`)
- Authentication → Cloud Firestore: reads profiles (evidence: `www/js/auth/authentication.js`)
- Firestore service → Cloud Firestore: reads and writes (evidence: `README.md`)
- Firestore service → Application state: updates (evidence: `www/js/firebase/firestore-service.js`)
- Firestore service → Production checks: records bill checks (evidence: `www/js/firebase/firestore-service.js`)
- Cash management → Firestore service: reads and writes (evidence: `www/js/modules/cash-management.js`)
- Cash management → Cash calculations: calculates totals (evidence: `www/js/modules/cash-management.js`)
- Cash management → Outstanding dues: uses due payments (evidence: `www/js/modules/cash-management.js`)
- Bluetooth printing → Business user: prints receipts (evidence: `README.md`)
- Production checks → Firestore service: reports health (evidence: `www/js/tip/index.js`)
- Firestore service → Items and rates: syncs item data (evidence: `README.md`)
- Firestore service → Stock tracking: syncs stock data (evidence: `README.md`)
- Firestore service → Cash management: syncs cash sessions (evidence: `README.md`)
- Business user → Finance: reviews (evidence: `README.md`)
- Business user → Analytics: reviews (evidence: `README.md`)
- Business user → Anomaly review: reviews (evidence: `README.md`)
- Business user → Rate trends: reviews (evidence: `README.md`)
- Business user → App health: reviews (evidence: `README.md`)
- Business user → In-app notifications: checks inbox (evidence: `README.md`)
- Business user → Offline support: uses offline app (evidence: `README.md`)
