# tnruok/vanity_tracker architecture

> Architecture diagram of the GitHub repository tnruok/vanity_tracker, 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/tnruok/vanity_tracker
- Repository: https://github.com/tnruok/vanity_tracker

## Overview

Vanity Tracker is a Flutter app for managing a personal cosmetics shelf. Users sign in or continue as guests, add products by scanning a barcode or entering details, track opened and expiry dates, and review active products, empties, and spending analytics. The README documents local-first persistence with optional Firebase sync, barcode lookup fallbacks, and scheduled local reminders. The graph follows those documented responsibilities; Dart implementation excerpts were not provided, so relationships are cited to the README rather than treated as source-verified calls.

Main entry points: [`lib/screens/main_navigation_scaffold.dart`](https://github.com/tnruok/vanity_tracker/blob/main/lib/screens/main_navigation_scaffold.dart) (App navigation), [`lib/screens/product/add_product_screen.dart`](https://github.com/tnruok/vanity_tracker/blob/main/lib/screens/product/add_product_screen.dart) (Product entry), [`lib/providers/vanity_provider.dart`](https://github.com/tnruok/vanity_tracker/blob/main/lib/providers/vanity_provider.dart) (Shelf management), [`lib/screens/dashboard/vanity_dashboard_screen.dart`](https://github.com/tnruok/vanity_tracker/blob/main/lib/screens/dashboard/vanity_dashboard_screen.dart) (Vanity dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and access"]
  node_app["App initialization<br/>[main.dart]"]
  node_auth_ui["Login and signup"]
  node_auth_provider["Auth state<br/>[auth_provider.dart]"]
  node_auth_service["Authentication<br/>[auth_service.dart]"]
  node_navigation["App navigation"]
end

subgraph group_catalog["Product intake"]
  node_product_entry["Product entry"]
  node_product_lookup["Barcode lookup"]
  node_product_model["Product details<br/>[product_model.dart]"]
  node_duplicate["Duplicate warning"]
end

subgraph group_shelf["Shelf lifecycle"]
  node_shelf_ui["Vanity dashboard"]
  node_vanity_provider["Shelf management"]
  node_item_model["Shelf item lifecycle"]
  node_product_edit["Product details and edit"]
  node_item_card["Shelf item display"]
end

subgraph group_insights["History and insights"]
  node_empties["Empties journal"]
  node_repurchase["Repurchase ratings"]
  node_stats["Budget analytics<br/>[stats_screen.dart]"]
end

subgraph group_platform["Persistence and reminders"]
  node_notifications["Expiry reminders"]
  node_notification_model["Reminder payload"]
  node_database[("Local and cloud data")]
end

node_user(("User"))
node_firebase[("Firebase services")]
node_lookup_sources["Product databases"]
node_local_scheduler["Local notifications"]

node_user -->|"opens"| node_app
node_app -->|"initializes auth"| node_auth_provider
node_user -->|"signs in"| node_auth_ui
node_auth_ui -->|"updates auth state"| node_auth_provider
node_auth_provider -->|"uses"| node_auth_service
node_auth_service -.->|"authenticates"| node_firebase
node_user -->|"navigates"| node_navigation
node_navigation -->|"opens intake"| node_product_entry
node_user -->|"scans or enters"| node_product_entry
node_product_entry -->|"looks up barcode"| node_product_lookup
node_product_lookup -->|"queries fallbacks"| node_lookup_sources
node_product_entry -->|"populates details"| node_product_model
node_product_entry -->|"warns on duplicate"| node_duplicate
node_navigation -->|"opens shelf"| node_shelf_ui
node_shelf_ui -->|"manages shelf"| node_vanity_provider
node_vanity_provider -->|"tracks lifecycle"| node_item_model
node_vanity_provider -->|"persists shelf"| node_database
node_database -.->|"syncs optionally"| node_firebase
node_shelf_ui -->|"opens item details"| node_product_edit
node_shelf_ui -->|"displays items"| node_item_card
node_vanity_provider -->|"schedules expiry alerts"| node_notifications
node_notifications -->|"uses payload"| node_notification_model
node_notifications -->|"schedules reminders"| node_local_scheduler
node_navigation -->|"opens archive"| node_empties
node_empties -->|"records ratings"| node_repurchase
node_navigation -->|"opens analytics"| node_stats
node_stats -.->|"summarizes shelf"| node_vanity_provider

click node_app "https://github.com/tnruok/vanity_tracker/blob/main/lib/main.dart"
click node_auth_ui "https://github.com/tnruok/vanity_tracker/tree/main/lib/screens/auth"
click node_auth_provider "https://github.com/tnruok/vanity_tracker/blob/main/lib/providers/auth_provider.dart"
click node_auth_service "https://github.com/tnruok/vanity_tracker/blob/main/lib/services/auth_service.dart"
click node_navigation "https://github.com/tnruok/vanity_tracker/blob/main/lib/screens/main_navigation_scaffold.dart"
click node_product_entry "https://github.com/tnruok/vanity_tracker/blob/main/lib/screens/product/add_product_screen.dart"
click node_product_lookup "https://github.com/tnruok/vanity_tracker/blob/main/lib/services/product_lookup_service.dart"
click node_product_model "https://github.com/tnruok/vanity_tracker/blob/main/lib/models/product_model.dart"
click node_duplicate "https://github.com/tnruok/vanity_tracker/blob/main/lib/widgets/duplicate_alert_dialog.dart"
click node_shelf_ui "https://github.com/tnruok/vanity_tracker/blob/main/lib/screens/dashboard/vanity_dashboard_screen.dart"
click node_vanity_provider "https://github.com/tnruok/vanity_tracker/blob/main/lib/providers/vanity_provider.dart"
click node_item_model "https://github.com/tnruok/vanity_tracker/blob/main/lib/models/vanity_item_model.dart"
click node_product_edit "https://github.com/tnruok/vanity_tracker/tree/main/lib/screens/product"
click node_item_card "https://github.com/tnruok/vanity_tracker/blob/main/lib/widgets/vanity_item_card.dart"
click node_notifications "https://github.com/tnruok/vanity_tracker/blob/main/lib/services/notification_service.dart"
click node_notification_model "https://github.com/tnruok/vanity_tracker/blob/main/lib/models/notification_model.dart"
click node_database "https://github.com/tnruok/vanity_tracker/blob/main/lib/services/database_service.dart"
click node_empties "https://github.com/tnruok/vanity_tracker/blob/main/lib/screens/history/empties_screen.dart"
click node_repurchase "https://github.com/tnruok/vanity_tracker/blob/main/lib/widgets/repurchase_dialog.dart"
click node_stats "https://github.com/tnruok/vanity_tracker/blob/main/lib/screens/stats/stats_screen.dart"

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_auth_ui,node_auth_provider,node_auth_service,node_navigation,node_user toneBlue
class node_product_entry,node_product_lookup,node_product_model,node_duplicate,node_firebase,node_lookup_sources toneAmber
class node_shelf_ui,node_vanity_provider,node_item_model,node_product_edit,node_item_card toneMint
class node_empties,node_repurchase,node_stats toneRose
class node_notifications,node_notification_model,node_database,node_local_scheduler toneIndigo
```

## Components

### App and access

- [App initialization](https://github.com/tnruok/vanity_tracker/blob/main/lib/main.dart): `lib/main.dart`
- [Login and signup](https://github.com/tnruok/vanity_tracker/tree/main/lib/screens/auth): `lib/screens/auth`
- [Auth state](https://github.com/tnruok/vanity_tracker/blob/main/lib/providers/auth_provider.dart): `lib/providers/auth_provider.dart`
- [Authentication](https://github.com/tnruok/vanity_tracker/blob/main/lib/services/auth_service.dart): `lib/services/auth_service.dart`
- [App navigation](https://github.com/tnruok/vanity_tracker/blob/main/lib/screens/main_navigation_scaffold.dart): `lib/screens/main_navigation_scaffold.dart`

### Product intake

- [Product entry](https://github.com/tnruok/vanity_tracker/blob/main/lib/screens/product/add_product_screen.dart): `lib/screens/product/add_product_screen.dart`
- [Barcode lookup](https://github.com/tnruok/vanity_tracker/blob/main/lib/services/product_lookup_service.dart): `lib/services/product_lookup_service.dart`
- [Product details](https://github.com/tnruok/vanity_tracker/blob/main/lib/models/product_model.dart): `lib/models/product_model.dart`
- [Duplicate warning](https://github.com/tnruok/vanity_tracker/blob/main/lib/widgets/duplicate_alert_dialog.dart): `lib/widgets/duplicate_alert_dialog.dart`

### Shelf lifecycle

- [Vanity dashboard](https://github.com/tnruok/vanity_tracker/blob/main/lib/screens/dashboard/vanity_dashboard_screen.dart): `lib/screens/dashboard/vanity_dashboard_screen.dart`
- [Shelf management](https://github.com/tnruok/vanity_tracker/blob/main/lib/providers/vanity_provider.dart): `lib/providers/vanity_provider.dart`
- [Shelf item lifecycle](https://github.com/tnruok/vanity_tracker/blob/main/lib/models/vanity_item_model.dart): `lib/models/vanity_item_model.dart`
- [Product details and edit](https://github.com/tnruok/vanity_tracker/tree/main/lib/screens/product): `lib/screens/product`
- [Shelf item display](https://github.com/tnruok/vanity_tracker/blob/main/lib/widgets/vanity_item_card.dart): `lib/widgets/vanity_item_card.dart`

### History and insights

- [Empties journal](https://github.com/tnruok/vanity_tracker/blob/main/lib/screens/history/empties_screen.dart): `lib/screens/history/empties_screen.dart`
- [Repurchase ratings](https://github.com/tnruok/vanity_tracker/blob/main/lib/widgets/repurchase_dialog.dart): `lib/widgets/repurchase_dialog.dart`
- [Budget analytics](https://github.com/tnruok/vanity_tracker/blob/main/lib/screens/stats/stats_screen.dart): `lib/screens/stats/stats_screen.dart`

### Persistence and reminders

- [Expiry reminders](https://github.com/tnruok/vanity_tracker/blob/main/lib/services/notification_service.dart): `lib/services/notification_service.dart`
- [Reminder payload](https://github.com/tnruok/vanity_tracker/blob/main/lib/models/notification_model.dart): `lib/models/notification_model.dart`
- [Local and cloud data](https://github.com/tnruok/vanity_tracker/blob/main/lib/services/database_service.dart): `lib/services/database_service.dart`

### Other components

- **User**
- **Firebase services**
- **Product databases**
- **Local notifications**

## Connections

- User → App initialization: opens (evidence: `README.md`)
- App initialization → Auth state: initializes auth (evidence: `README.md`)
- User → Login and signup: signs in (evidence: `README.md`)
- Login and signup → Auth state: updates auth state (evidence: `README.md`)
- Auth state → Authentication: uses (evidence: `README.md`)
- Authentication → Firebase services: authenticates (evidence: `README.md`)
- User → App navigation: navigates (evidence: `README.md`)
- App navigation → Product entry: opens intake (evidence: `README.md`)
- User → Product entry: scans or enters (evidence: `README.md`)
- Product entry → Barcode lookup: looks up barcode (evidence: `README.md`)
- Barcode lookup → Product databases: queries fallbacks (evidence: `README.md`)
- Product entry → Product details: populates details (evidence: `README.md`)
- Product entry → Duplicate warning: warns on duplicate (evidence: `README.md`)
- App navigation → Vanity dashboard: opens shelf (evidence: `README.md`)
- Vanity dashboard → Shelf management: manages shelf (evidence: `README.md`)
- Shelf management → Shelf item lifecycle: tracks lifecycle (evidence: `README.md`)
- Shelf management → Local and cloud data: persists shelf (evidence: `README.md`)
- Local and cloud data → Firebase services: syncs optionally (evidence: `README.md`)
- Vanity dashboard → Product details and edit: opens item details (evidence: `README.md`)
- Vanity dashboard → Shelf item display: displays items (evidence: `README.md`)
- Shelf management → Expiry reminders: schedules expiry alerts (evidence: `README.md`)
- Expiry reminders → Reminder payload: uses payload (evidence: `README.md`)
- Expiry reminders → Local notifications: schedules reminders (evidence: `README.md`)
- App navigation → Empties journal: opens archive (evidence: `README.md`)
- Empties journal → Repurchase ratings: records ratings (evidence: `README.md`)
- App navigation → Budget analytics: opens analytics (evidence: `README.md`)
- Budget analytics → Shelf management: summarizes shelf
