# airuxph/freshkeep architecture

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

## Overview

FreshKeep is an offline Flutter grocery-inventory app. The main workflow is entering grocery batches, storing them locally, and managing stock and printed-date information; dashboard, waste reporting, guidance, reminders, backup, photos, and label scanning are complementary capabilities. The graph follows documented user flows and capabilities; implementation-level connections are limited because the sampled Dart source was not provided.

Main entry points: [`lib/app_shell.dart`](https://github.com/airuxph/freshkeep/blob/main/lib/app_shell.dart) (App navigation), [`lib/add_groceries_dialog.dart`](https://github.com/airuxph/freshkeep/blob/main/lib/add_groceries_dialog.dart) (Grocery entry), [`lib/ocr/scan_label_screen.dart`](https://github.com/airuxph/freshkeep/blob/main/lib/ocr/scan_label_screen.dart) (Label scanner), [`lib/backup_screen.dart`](https://github.com/airuxph/freshkeep/blob/main/lib/backup_screen.dart) (Backup interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inventory["Inventory &amp; batches"]
  node_shell["App navigation<br/>[app_shell.dart]"]
  node_inventory_ui["Inventory view"]
  node_entry["Grocery entry"]
  node_batch_detail["Batch details"]
  node_stock_actions["Stock actions"]
  node_inventory_domain["Inventory queries"]
  node_database[("Local inventory store")]
end

subgraph group_insights["Guidance &amp; reports"]
  node_dashboard["Dashboard"]
  node_waste["Waste reporting<br/>[report_screen.dart]"]
  node_guidance["Storage guidance"]
  node_guidance_catalog["Guidance catalog"]
end

subgraph group_integrations["Device features"]
  node_reminders["Reminder settings"]
  node_reminder_controller["Reminder planning"]
  node_notifications["Device notifications"]
  node_photo["Food photos"]
  node_scanner["Label scanner"]
  node_ocr_service["On-device OCR<br/>[ocr_service.dart]"]
end

subgraph group_backup["Backup &amp; restore"]
  node_backup_ui["Backup interface<br/>[backup_screen.dart]"]
  node_backup_export["Backup export"]
  node_backup_import["Backup import"]
  node_json_file["Local JSON file"]
end

node_user(("Grocery keeper"))
node_device(("Device / OS"))

node_user -->|"opens app"| node_shell
node_shell -->|"navigates to"| node_inventory_ui
node_user -->|"enters groceries"| node_entry
node_entry -->|"saves batches"| node_database
node_inventory_ui -->|"filters inventory"| node_inventory_domain
node_inventory_domain -->|"queries records"| node_database
node_user -->|"opens batch"| node_batch_detail
node_batch_detail -->|"edits stock"| node_stock_actions
node_stock_actions -->|"records action"| node_database
node_shell -->|"shows dashboard"| node_dashboard
node_shell -->|"opens waste"| node_waste
node_shell -->|"opens guidance"| node_guidance
node_guidance -->|"browses sources"| node_guidance_catalog
node_shell -->|"opens reminders"| node_reminders
node_reminders -->|"saves settings"| node_reminder_controller
node_reminder_controller -.->|"schedules alerts"| node_notifications
node_entry -->|"adds photo"| node_photo
node_user -->|"scans label"| node_scanner
node_scanner -->|"recognizes text"| node_ocr_service
node_scanner -->|"creates review draft"| node_entry
node_shell -->|"opens backup"| node_backup_ui
node_backup_ui -->|"exports data"| node_backup_export
node_backup_export -->|"writes JSON"| node_json_file
node_backup_ui -->|"imports backup"| node_backup_import
node_json_file -->|"provides JSON"| node_backup_import
node_device -.->|"delivers alerts"| node_notifications

click node_shell "https://github.com/airuxph/freshkeep/blob/main/lib/app_shell.dart"
click node_inventory_ui "https://github.com/airuxph/freshkeep/blob/main/lib/inventory_screen.dart"
click node_entry "https://github.com/airuxph/freshkeep/blob/main/lib/add_groceries_dialog.dart"
click node_batch_detail "https://github.com/airuxph/freshkeep/blob/main/lib/batch_details_screen.dart"
click node_stock_actions "https://github.com/airuxph/freshkeep/blob/main/lib/stock_action_dialog.dart"
click node_inventory_domain "https://github.com/airuxph/freshkeep/blob/main/lib/domain/inventory_query.dart"
click node_database "https://github.com/airuxph/freshkeep/blob/main/lib/data/inventory_database.dart"
click node_dashboard "https://github.com/airuxph/freshkeep/blob/main/lib/domain/dashboard_summary.dart"
click node_waste "https://github.com/airuxph/freshkeep/blob/main/lib/report_screen.dart"
click node_guidance "https://github.com/airuxph/freshkeep/blob/main/lib/guidance_screen.dart"
click node_guidance_catalog "https://github.com/airuxph/freshkeep/blob/main/lib/data/guidance_catalog.dart"
click node_reminders "https://github.com/airuxph/freshkeep/blob/main/lib/reminder_screen.dart"
click node_reminder_controller "https://github.com/airuxph/freshkeep/blob/main/lib/reminders/reminder_controller.dart"
click node_notifications "https://github.com/airuxph/freshkeep/blob/main/lib/reminders/notification_service.dart"
click node_photo "https://github.com/airuxph/freshkeep/blob/main/lib/widgets/photo_picker/pick_food_photo_from_source.dart"
click node_scanner "https://github.com/airuxph/freshkeep/blob/main/lib/ocr/scan_label_screen.dart"
click node_ocr_service "https://github.com/airuxph/freshkeep/blob/main/lib/ocr/ocr_service.dart"
click node_backup_ui "https://github.com/airuxph/freshkeep/blob/main/lib/backup_screen.dart"
click node_backup_export "https://github.com/airuxph/freshkeep/blob/main/lib/data/backup/export_database_backup.dart"
click node_backup_import "https://github.com/airuxph/freshkeep/blob/main/lib/data/backup/import_database_backup.dart"
click node_json_file "https://github.com/airuxph/freshkeep/blob/main/lib/backup/backup_file_io.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_shell,node_inventory_ui,node_entry,node_batch_detail,node_stock_actions,node_inventory_domain,node_database toneBlue
class node_dashboard,node_waste,node_guidance,node_guidance_catalog toneAmber
class node_reminders,node_reminder_controller,node_notifications,node_photo,node_scanner,node_ocr_service toneMint
class node_backup_ui,node_backup_export,node_backup_import,node_json_file toneRose
class node_user,node_device toneIndigo
```

## Components

### Inventory & batches

- [App navigation](https://github.com/airuxph/freshkeep/blob/main/lib/app_shell.dart): `lib/app_shell.dart`
- [Inventory view](https://github.com/airuxph/freshkeep/blob/main/lib/inventory_screen.dart): `lib/inventory_screen.dart`
- [Grocery entry](https://github.com/airuxph/freshkeep/blob/main/lib/add_groceries_dialog.dart): `lib/add_groceries_dialog.dart`
- [Batch details](https://github.com/airuxph/freshkeep/blob/main/lib/batch_details_screen.dart): `lib/batch_details_screen.dart`
- [Stock actions](https://github.com/airuxph/freshkeep/blob/main/lib/stock_action_dialog.dart): `lib/stock_action_dialog.dart`
- [Inventory queries](https://github.com/airuxph/freshkeep/blob/main/lib/domain/inventory_query.dart): `lib/domain/inventory_query.dart`
- [Local inventory store](https://github.com/airuxph/freshkeep/blob/main/lib/data/inventory_database.dart): `lib/data/inventory_database.dart`

### Guidance & reports

- [Dashboard](https://github.com/airuxph/freshkeep/blob/main/lib/domain/dashboard_summary.dart): `lib/domain/dashboard_summary.dart`
- [Waste reporting](https://github.com/airuxph/freshkeep/blob/main/lib/report_screen.dart): `lib/report_screen.dart`
- [Storage guidance](https://github.com/airuxph/freshkeep/blob/main/lib/guidance_screen.dart): `lib/guidance_screen.dart`
- [Guidance catalog](https://github.com/airuxph/freshkeep/blob/main/lib/data/guidance_catalog.dart): `lib/data/guidance_catalog.dart`

### Device features

- [Reminder settings](https://github.com/airuxph/freshkeep/blob/main/lib/reminder_screen.dart): `lib/reminder_screen.dart`
- [Reminder planning](https://github.com/airuxph/freshkeep/blob/main/lib/reminders/reminder_controller.dart): `lib/reminders/reminder_controller.dart`
- [Device notifications](https://github.com/airuxph/freshkeep/blob/main/lib/reminders/notification_service.dart): `lib/reminders/notification_service.dart`
- [Food photos](https://github.com/airuxph/freshkeep/blob/main/lib/widgets/photo_picker/pick_food_photo_from_source.dart): `lib/widgets/photo_picker/pick_food_photo_from_source.dart`
- [Label scanner](https://github.com/airuxph/freshkeep/blob/main/lib/ocr/scan_label_screen.dart): `lib/ocr/scan_label_screen.dart`
- [On-device OCR](https://github.com/airuxph/freshkeep/blob/main/lib/ocr/ocr_service.dart): `lib/ocr/ocr_service.dart`

### Backup & restore

- [Backup interface](https://github.com/airuxph/freshkeep/blob/main/lib/backup_screen.dart): `lib/backup_screen.dart`
- [Backup export](https://github.com/airuxph/freshkeep/blob/main/lib/data/backup/export_database_backup.dart): `lib/data/backup/export_database_backup.dart`
- [Backup import](https://github.com/airuxph/freshkeep/blob/main/lib/data/backup/import_database_backup.dart): `lib/data/backup/import_database_backup.dart`
- [Local JSON file](https://github.com/airuxph/freshkeep/blob/main/lib/backup/backup_file_io.dart): `lib/backup/backup_file_io.dart`

### Other components

- **Grocery keeper**
- **Device / OS**

## Connections

- Grocery keeper → App navigation: opens app (evidence: `README.md`)
- App navigation → Inventory view: navigates to (evidence: `README.md`)
- Grocery keeper → Grocery entry: enters groceries (evidence: `README.md`)
- Grocery entry → Local inventory store: saves batches (evidence: `README.md`)
- Inventory view → Inventory queries: filters inventory (evidence: `README.md`)
- Inventory queries → Local inventory store: queries records (evidence: `README.md`)
- Grocery keeper → Batch details: opens batch (evidence: `README.md`)
- Batch details → Stock actions: edits stock (evidence: `README.md`)
- Stock actions → Local inventory store: records action (evidence: `README.md`)
- App navigation → Dashboard: shows dashboard (evidence: `README.md`)
- App navigation → Waste reporting: opens waste (evidence: `README.md`)
- App navigation → Storage guidance: opens guidance (evidence: `README.md`)
- Storage guidance → Guidance catalog: browses sources (evidence: `README.md`)
- App navigation → Reminder settings: opens reminders (evidence: `README.md`)
- Reminder settings → Reminder planning: saves settings (evidence: `README.md`)
- Reminder planning → Device notifications: schedules alerts (evidence: `README.md`)
- Grocery entry → Food photos: adds photo (evidence: `README.md`)
- Grocery keeper → Label scanner: scans label (evidence: `README.md`)
- Label scanner → On-device OCR: recognizes text (evidence: `README.md`)
- Label scanner → Grocery entry: creates review draft (evidence: `README.md`)
- App navigation → Backup interface: opens backup (evidence: `README.md`)
- Backup interface → Backup export: exports data (evidence: `README.md`)
- Backup export → Local JSON file: writes JSON (evidence: `README.md`)
- Backup interface → Backup import: imports backup (evidence: `README.md`)
- Local JSON file → Backup import: provides JSON (evidence: `README.md`)
- Device / OS → Device notifications: delivers alerts (evidence: `README.md`)
