# aradhyshukla/mist-mug-dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/aradhyshukla/mist-mug-dashboard
- Repository: https://github.com/aradhyshukla/mist-mug-dashboard

## Overview

Mist & Mug is a browser-based café dashboard for managing its product catalogue and settings, importing transaction data, and reviewing sales analytics and period-over-period performance. The main workflow routes users to a dashboard page; uploads are previewed and validated before persistence, while analytics pages retrieve transaction data and calculate reports. Settings and the overview manage catalogue data. Reporting-period utilities and per-page persisted selection state support date-filtered reports. The README gives no further capability details, and some source excerpts are partial, so links reflect only indexed references or shown calls.

Main entry points: [`src/pages/SalesAnalytics.tsx`](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/pages/SalesAnalytics.tsx) (Sales analytics), [`src/App.tsx`](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/App.tsx) (Page router), [`src/pages/PerformanceTracker.tsx`](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/pages/PerformanceTracker.tsx) (Performance tracker), [`src/db.ts`](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/db.ts) (IndexedDB store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Dashboard app"]
  node_router["Page router<br/>[App.tsx]"]
  node_layout["Dashboard layout"]
  node_database[("IndexedDB store<br/>[db.ts]")]
  node_events["Data change events<br/>[events.ts]"]
  node_types["Domain types<br/>[types.ts]"]
end

subgraph group_sales["Sales reporting"]
  node_performance["Performance tracker"]
  node_analyticspage["Sales analytics<br/>[SalesAnalytics.tsx]"]
  node_analytics["Analytics calculations<br/>[analytics.ts]"]
  node_periodnav["Period navigator"]
  node_periodlogic["Period calculations"]
  node_periodstate["Period selection state"]
  node_revenuechart["Revenue trends<br/>[RevenueTrends.tsx]"]
  node_productschart["Top products"]
  node_hourschart["Busiest hours"]
  node_weekdaychart["Weekday comparison"]
end

subgraph group_imports["Transaction imports"]
  node_upload["Upload data<br/>[UploadData.tsx]"]
  node_preview["Import preview<br/>[ImportPreview.tsx]"]
  node_importlogic["Import processing<br/>[import.ts]"]
end

subgraph group_catalog["Catalogue management"]
  node_overview["Overview<br/>[Overview.tsx]"]
  node_settings["Settings<br/>[Settings.tsx]"]
  node_productform["Product editor"]
  node_productcard["Product card<br/>[ProductCard.tsx]"]
end

node_user(("Dashboard user"))

node_user -->|"opens dashboard"| node_router
node_router -->|"wraps routes"| node_layout
node_router -->|"routes to"| node_overview
node_router -->|"routes to"| node_analyticspage
node_router -->|"routes to"| node_upload
node_router -->|"routes to"| node_performance
node_router -->|"routes to"| node_settings
node_upload -->|"renders preview"| node_preview
node_preview -->|"suggests mappings"| node_importlogic
node_upload -->|"processes imports"| node_importlogic
node_upload -->|"saves imports"| node_database
node_importlogic -->|"stores import lines"| node_database
node_upload -->|"emits changes"| node_events
node_performance -->|"loads transactions"| node_database
node_performance -->|"computes metrics"| node_analytics
node_analyticspage -->|"loads transactions"| node_database
node_analyticspage -->|"requests analytics"| node_analytics
node_analyticspage -->|"renders navigator"| node_periodnav
node_performance -->|"renders navigator"| node_periodnav
node_analyticspage -->|"uses selection state"| node_periodstate
node_performance -->|"uses selection state"| node_periodstate
node_periodstate -->|"validates selection"| node_periodlogic
node_analyticspage -->|"renders chart"| node_revenuechart
node_analyticspage -->|"renders chart"| node_productschart
node_analyticspage -->|"renders chart"| node_hourschart
node_analyticspage -->|"renders chart"| node_weekdaychart
node_overview -->|"reads and updates"| node_database
node_overview -->|"renders editor"| node_productform
node_overview -->|"renders products"| node_productcard
node_settings -->|"manages catalogue"| node_database
node_settings -->|"renders editor"| node_productform
node_layout -.->|"hosts page content"| node_router
node_analytics -->|"reads transactions"| node_database
node_analyticspage -->|"listens for changes"| node_events
node_performance -->|"listens for changes"| node_events
node_overview -->|"emits changes"| node_events

click node_router "https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/App.tsx"
click node_layout "https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/components/layout/DashboardLayout.tsx"
click node_overview "https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/pages/Overview.tsx"
click node_upload "https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/pages/UploadData.tsx"
click node_preview "https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/components/common/ImportPreview.tsx"
click node_importlogic "https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/lib/import.ts"
click node_performance "https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/pages/PerformanceTracker.tsx"
click node_analyticspage "https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/pages/SalesAnalytics.tsx"
click node_analytics "https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/lib/analytics.ts"
click node_periodnav "https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/components/common/ReportingPeriodNavigator.tsx"
click node_periodlogic "https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/lib/reporting-periods.ts"
click node_periodstate "https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/lib/useReportingPeriodState.ts"
click node_revenuechart "https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/components/analytics/RevenueTrends.tsx"
click node_productschart "https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/components/analytics/TopSellingProducts.tsx"
click node_hourschart "https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/components/analytics/BusiestHoursChart.tsx"
click node_weekdaychart "https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/components/analytics/WeekdayWeekendChart.tsx"
click node_settings "https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/pages/Settings.tsx"
click node_productform "https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/components/common/ProductFormDialog.tsx"
click node_productcard "https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/components/common/ProductCard.tsx"
click node_database "https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/db.ts"
click node_events "https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/lib/events.ts"
click node_types "https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/types.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_router,node_layout,node_database,node_events,node_types,node_user toneBlue
class node_performance,node_analyticspage,node_analytics,node_periodnav,node_periodlogic,node_periodstate,node_revenuechart,node_productschart,node_hourschart,node_weekdaychart toneAmber
class node_upload,node_preview,node_importlogic toneMint
class node_overview,node_settings,node_productform,node_productcard toneRose
```

## Components

### Dashboard app

- [Page router](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/App.tsx): `src/App.tsx`
- [Dashboard layout](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/components/layout/DashboardLayout.tsx): `src/components/layout/DashboardLayout.tsx`
- [IndexedDB store](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/db.ts): `src/db.ts`
- [Data change events](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/lib/events.ts): `src/lib/events.ts`
- [Domain types](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/types.ts): `src/types.ts`

### Sales reporting

- [Performance tracker](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/pages/PerformanceTracker.tsx): `src/pages/PerformanceTracker.tsx`
- [Sales analytics](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/pages/SalesAnalytics.tsx): `src/pages/SalesAnalytics.tsx`
- [Analytics calculations](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/lib/analytics.ts): `src/lib/analytics.ts`
- [Period navigator](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/components/common/ReportingPeriodNavigator.tsx): `src/components/common/ReportingPeriodNavigator.tsx`
- [Period calculations](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/lib/reporting-periods.ts): `src/lib/reporting-periods.ts`
- [Period selection state](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/lib/useReportingPeriodState.ts): `src/lib/useReportingPeriodState.ts`
- [Revenue trends](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/components/analytics/RevenueTrends.tsx): `src/components/analytics/RevenueTrends.tsx`
- [Top products](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/components/analytics/TopSellingProducts.tsx): `src/components/analytics/TopSellingProducts.tsx`
- [Busiest hours](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/components/analytics/BusiestHoursChart.tsx): `src/components/analytics/BusiestHoursChart.tsx`
- [Weekday comparison](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/components/analytics/WeekdayWeekendChart.tsx): `src/components/analytics/WeekdayWeekendChart.tsx`

### Transaction imports

- [Upload data](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/pages/UploadData.tsx): `src/pages/UploadData.tsx`
- [Import preview](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/components/common/ImportPreview.tsx): `src/components/common/ImportPreview.tsx`
- [Import processing](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/lib/import.ts): `src/lib/import.ts`

### Catalogue management

- [Overview](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/pages/Overview.tsx): `src/pages/Overview.tsx`
- [Settings](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/pages/Settings.tsx): `src/pages/Settings.tsx`
- [Product editor](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/components/common/ProductFormDialog.tsx): `src/components/common/ProductFormDialog.tsx`
- [Product card](https://github.com/aradhyshukla/mist-mug-dashboard/blob/main/src/components/common/ProductCard.tsx): `src/components/common/ProductCard.tsx`

### Other components

- **Dashboard user**

## Connections

- Dashboard user → Page router: opens dashboard (evidence: `src/App.tsx`)
- Page router → Dashboard layout: wraps routes (evidence: `src/App.tsx`)
- Page router → Overview: routes to (evidence: `src/App.tsx`)
- Page router → Sales analytics: routes to (evidence: `src/App.tsx`)
- Page router → Upload data: routes to (evidence: `src/App.tsx`)
- Page router → Performance tracker: routes to (evidence: `src/App.tsx`)
- Page router → Settings: routes to (evidence: `src/App.tsx`)
- Upload data → Import preview: renders preview (evidence: `src/pages/UploadData.tsx`)
- Import preview → Import processing: suggests mappings (evidence: `src/components/common/ImportPreview.tsx`)
- Upload data → Import processing: processes imports (evidence: `src/pages/UploadData.tsx`)
- Upload data → IndexedDB store: saves imports (evidence: `src/pages/UploadData.tsx`)
- Import processing → IndexedDB store: stores import lines (evidence: `src/lib/import.ts`)
- Upload data → Data change events: emits changes (evidence: `src/pages/UploadData.tsx`)
- Performance tracker → IndexedDB store: loads transactions (evidence: `src/pages/PerformanceTracker.tsx`)
- Performance tracker → Analytics calculations: computes metrics (evidence: `src/pages/PerformanceTracker.tsx`)
- Sales analytics → IndexedDB store: loads transactions (evidence: `src/pages/SalesAnalytics.tsx`)
- Sales analytics → Analytics calculations: requests analytics (evidence: `src/pages/SalesAnalytics.tsx`)
- Sales analytics → Period navigator: renders navigator (evidence: `src/pages/SalesAnalytics.tsx`)
- Performance tracker → Period navigator: renders navigator (evidence: `src/pages/PerformanceTracker.tsx`)
- Sales analytics → Period selection state: uses selection state (evidence: `src/pages/SalesAnalytics.tsx`)
- Performance tracker → Period selection state: uses selection state (evidence: `src/pages/PerformanceTracker.tsx`)
- Period selection state → Period calculations: validates selection (evidence: `src/lib/useReportingPeriodState.ts`)
- Sales analytics → Revenue trends: renders chart (evidence: `src/pages/SalesAnalytics.tsx`)
- Sales analytics → Top products: renders chart (evidence: `src/pages/SalesAnalytics.tsx`)
- Sales analytics → Busiest hours: renders chart (evidence: `src/pages/SalesAnalytics.tsx`)
- Sales analytics → Weekday comparison: renders chart (evidence: `src/pages/SalesAnalytics.tsx`)
- Overview → IndexedDB store: reads and updates (evidence: `src/pages/Overview.tsx`)
- Overview → Product editor: renders editor (evidence: `src/pages/Overview.tsx`)
- Overview → Product card: renders products (evidence: `src/pages/Overview.tsx`)
- Settings → IndexedDB store: manages catalogue (evidence: `src/pages/Settings.tsx`)
- Settings → Product editor: renders editor (evidence: `src/pages/Settings.tsx`)
- Dashboard layout → Page router: hosts page content (evidence: `src/App.tsx`)
- Analytics calculations → IndexedDB store: reads transactions (evidence: `src/lib/analytics.ts`)
- Sales analytics → Data change events: listens for changes (evidence: `src/pages/SalesAnalytics.tsx`)
- Performance tracker → Data change events: listens for changes (evidence: `src/pages/PerformanceTracker.tsx`)
- Overview → Data change events: emits changes (evidence: `src/pages/Overview.tsx`)
