# fbkfriend/store-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/fbkfriend/store-tracker
- Repository: https://github.com/fbkfriend/store-tracker

## Overview

My Sari-Sari Store is an offline-first Flutter app for neighborhood-store inventory, point-of-sale, customer credit (utang), and reporting. The principal workflow is selling stocked items, taking cash or partial payment, and recording any balance as customer credit; the app also tracks stock and preserves sales history. Separate branches cover inventory management, customer balances, reports and printable PDFs, plus local and optional Google Drive backups and device security. The excerpts contain no Dart source, so links between implementation components are limited to capabilities explicitly described in the README.

Main entry points: [`lib/data/repositories`](https://github.com/fbkfriend/store-tracker/tree/main/lib/data/repositories) (Store data access), [`lib/features/utang/utang_screen.dart`](https://github.com/fbkfriend/store-tracker/blob/main/lib/features/utang/utang_screen.dart) (Customer credit), [`lib/features/history/transaction_history_screen.dart`](https://github.com/fbkfriend/store-tracker/blob/main/lib/features/history/transaction_history_screen.dart) (Transaction history), [`lib/features/pos/cart_controller.dart`](https://github.com/fbkfriend/store-tracker/blob/main/lib/features/pos/cart_controller.dart) (Cart and payment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["App flow"]
  node_app["App entry<br/>[main.dart]"]
  node_shell["Startup and navigation"]
end

subgraph group_store["Store operations"]
  node_pos["Point of sale<br/>[pos_screen.dart]"]
  node_cart["Cart and payment"]
  node_inventory["Inventory management"]
  node_categories["Category management"]
  node_history["Transaction history"]
  node_credit["Customer credit<br/>[utang_screen.dart]"]
  node_customer_detail["Customer account history"]
  node_database[("Local store data<br/>[app_database.dart]")]
  node_repositories["Store data access"]
end

subgraph group_insights["Reports and documents"]
  node_reports["Dashboard and reports"]
  node_daily_report["End-of-day report"]
  node_pdf["Printable reports<br/>[pdf_reports.dart]"]
end

subgraph group_security["Security and settings"]
  node_pin["PIN and fingerprint"]
  node_settings["App settings"]
end

subgraph group_backup["Backup and restore"]
  node_backup_ui["Backup controls<br/>[backup_screen.dart]"]
  node_backup_service["Backup and restore"]
  node_local_backup["Phone backup file"]
  node_auto_backup["Automatic backups"]
  node_google_auth["Google sign-in"]
end

node_user(("Store user"))
node_drive[("Google Drive")]

node_user -.->|"uses"| node_app
node_app -.->|"starts"| node_shell
node_user -->|"records sales"| node_pos
node_pos -.->|"adds items"| node_cart
node_cart -->|"records sale"| node_repositories
node_cart -->|"records balance"| node_credit
node_inventory -->|"manages stock"| node_repositories
node_categories -->|"manages categories"| node_repositories
node_history -->|"reads and voids sales"| node_repositories
node_history -->|"restores stock"| node_inventory
node_history -->|"reverses credit"| node_credit
node_credit -->|"tracks balances"| node_repositories
node_customer_detail -->|"shows customer history"| node_credit
node_repositories -->|"uses local data"| node_database
node_reports -->|"summarizes store activity"| node_repositories
node_daily_report -->|"reports a day"| node_repositories
node_pdf -->|"prints inventory lists"| node_inventory
node_user -->|"unlocks app"| node_pin
node_user -.->|"configures app"| node_settings
node_user -->|"manages backups"| node_backup_ui
node_backup_ui -.->|"requests backup or restore"| node_backup_service
node_backup_service -->|"saves phone backup"| node_local_backup
node_auto_backup -->|"backs up daily"| node_drive
node_google_auth -->|"enables optional backups"| node_auto_backup

click node_app "https://github.com/fbkfriend/store-tracker/blob/main/lib/main.dart"
click node_shell "https://github.com/fbkfriend/store-tracker/tree/main/lib/features/shell"
click node_pos "https://github.com/fbkfriend/store-tracker/blob/main/lib/features/pos/pos_screen.dart"
click node_cart "https://github.com/fbkfriend/store-tracker/blob/main/lib/features/pos/cart_controller.dart"
click node_inventory "https://github.com/fbkfriend/store-tracker/blob/main/lib/features/inventory/inventory_screen.dart"
click node_categories "https://github.com/fbkfriend/store-tracker/blob/main/lib/features/inventory/category_manager.dart"
click node_history "https://github.com/fbkfriend/store-tracker/blob/main/lib/features/history/transaction_history_screen.dart"
click node_credit "https://github.com/fbkfriend/store-tracker/blob/main/lib/features/utang/utang_screen.dart"
click node_customer_detail "https://github.com/fbkfriend/store-tracker/blob/main/lib/features/utang/customer_detail_screen.dart"
click node_database "https://github.com/fbkfriend/store-tracker/blob/main/lib/data/app_database.dart"
click node_repositories "https://github.com/fbkfriend/store-tracker/tree/main/lib/data/repositories"
click node_reports "https://github.com/fbkfriend/store-tracker/blob/main/lib/features/reports/reports_screen.dart"
click node_daily_report "https://github.com/fbkfriend/store-tracker/blob/main/lib/features/reports/end_of_day_report_screen.dart"
click node_pdf "https://github.com/fbkfriend/store-tracker/blob/main/lib/features/reports/pdf_reports.dart"
click node_pin "https://github.com/fbkfriend/store-tracker/blob/main/lib/core/security/pin_controller.dart"
click node_settings "https://github.com/fbkfriend/store-tracker/blob/main/lib/features/settings/settings_screen.dart"
click node_backup_ui "https://github.com/fbkfriend/store-tracker/blob/main/lib/features/backup/backup_screen.dart"
click node_backup_service "https://github.com/fbkfriend/store-tracker/blob/main/lib/core/backup/backup_service.dart"
click node_local_backup "https://github.com/fbkfriend/store-tracker/blob/main/lib/core/backup/local_backup_file.dart"
click node_auto_backup "https://github.com/fbkfriend/store-tracker/blob/main/lib/core/backup/auto_backup_service.dart"
click node_google_auth "https://github.com/fbkfriend/store-tracker/blob/main/lib/core/auth/google_auth_service.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_shell,node_user toneBlue
class node_pos,node_cart,node_inventory,node_categories,node_history,node_credit,node_customer_detail,node_database,node_repositories,node_drive toneAmber
class node_reports,node_daily_report,node_pdf toneMint
class node_pin,node_settings toneRose
class node_backup_ui,node_backup_service,node_local_backup,node_auto_backup,node_google_auth toneIndigo
```

## Components

### App flow

- [App entry](https://github.com/fbkfriend/store-tracker/blob/main/lib/main.dart): `lib/main.dart`
- [Startup and navigation](https://github.com/fbkfriend/store-tracker/tree/main/lib/features/shell): `lib/features/shell`

### Store operations

- [Point of sale](https://github.com/fbkfriend/store-tracker/blob/main/lib/features/pos/pos_screen.dart): `lib/features/pos/pos_screen.dart`
- [Cart and payment](https://github.com/fbkfriend/store-tracker/blob/main/lib/features/pos/cart_controller.dart): `lib/features/pos/cart_controller.dart`
- [Inventory management](https://github.com/fbkfriend/store-tracker/blob/main/lib/features/inventory/inventory_screen.dart): `lib/features/inventory/inventory_screen.dart`
- [Category management](https://github.com/fbkfriend/store-tracker/blob/main/lib/features/inventory/category_manager.dart): `lib/features/inventory/category_manager.dart`
- [Transaction history](https://github.com/fbkfriend/store-tracker/blob/main/lib/features/history/transaction_history_screen.dart): `lib/features/history/transaction_history_screen.dart`
- [Customer credit](https://github.com/fbkfriend/store-tracker/blob/main/lib/features/utang/utang_screen.dart): `lib/features/utang/utang_screen.dart`
- [Customer account history](https://github.com/fbkfriend/store-tracker/blob/main/lib/features/utang/customer_detail_screen.dart): `lib/features/utang/customer_detail_screen.dart`
- [Local store data](https://github.com/fbkfriend/store-tracker/blob/main/lib/data/app_database.dart): `lib/data/app_database.dart`
- [Store data access](https://github.com/fbkfriend/store-tracker/tree/main/lib/data/repositories): `lib/data/repositories`

### Reports and documents

- [Dashboard and reports](https://github.com/fbkfriend/store-tracker/blob/main/lib/features/reports/reports_screen.dart): `lib/features/reports/reports_screen.dart`
- [End-of-day report](https://github.com/fbkfriend/store-tracker/blob/main/lib/features/reports/end_of_day_report_screen.dart): `lib/features/reports/end_of_day_report_screen.dart`
- [Printable reports](https://github.com/fbkfriend/store-tracker/blob/main/lib/features/reports/pdf_reports.dart): `lib/features/reports/pdf_reports.dart`

### Security and settings

- [PIN and fingerprint](https://github.com/fbkfriend/store-tracker/blob/main/lib/core/security/pin_controller.dart): `lib/core/security/pin_controller.dart`
- [App settings](https://github.com/fbkfriend/store-tracker/blob/main/lib/features/settings/settings_screen.dart): `lib/features/settings/settings_screen.dart`

### Backup and restore

- [Backup controls](https://github.com/fbkfriend/store-tracker/blob/main/lib/features/backup/backup_screen.dart): `lib/features/backup/backup_screen.dart`
- [Backup and restore](https://github.com/fbkfriend/store-tracker/blob/main/lib/core/backup/backup_service.dart): `lib/core/backup/backup_service.dart`
- [Phone backup file](https://github.com/fbkfriend/store-tracker/blob/main/lib/core/backup/local_backup_file.dart): `lib/core/backup/local_backup_file.dart`
- [Automatic backups](https://github.com/fbkfriend/store-tracker/blob/main/lib/core/backup/auto_backup_service.dart): `lib/core/backup/auto_backup_service.dart`
- [Google sign-in](https://github.com/fbkfriend/store-tracker/blob/main/lib/core/auth/google_auth_service.dart): `lib/core/auth/google_auth_service.dart`

### Other components

- **Store user**
- **Google Drive**

## Connections

- Store user → App entry: uses
- App entry → Startup and navigation: starts
- Store user → Point of sale: records sales (evidence: `README.md`)
- Point of sale → Cart and payment: adds items
- Cart and payment → Store data access: records sale (evidence: `README.md`)
- Cart and payment → Customer credit: records balance (evidence: `README.md`)
- Inventory management → Store data access: manages stock (evidence: `README.md`)
- Category management → Store data access: manages categories (evidence: `README.md`)
- Transaction history → Store data access: reads and voids sales (evidence: `README.md`)
- Transaction history → Inventory management: restores stock (evidence: `README.md`)
- Transaction history → Customer credit: reverses credit (evidence: `README.md`)
- Customer credit → Store data access: tracks balances (evidence: `README.md`)
- Customer account history → Customer credit: shows customer history (evidence: `README.md`)
- Store data access → Local store data: uses local data (evidence: `README.md`)
- Dashboard and reports → Store data access: summarizes store activity (evidence: `README.md`)
- End-of-day report → Store data access: reports a day (evidence: `README.md`)
- Printable reports → Inventory management: prints inventory lists (evidence: `README.md`)
- Store user → PIN and fingerprint: unlocks app (evidence: `README.md`)
- Store user → App settings: configures app
- Store user → Backup controls: manages backups (evidence: `README.md`)
- Backup controls → Backup and restore: requests backup or restore
- Backup and restore → Phone backup file: saves phone backup (evidence: `README.md`)
- Automatic backups → Google Drive: backs up daily (evidence: `README.md`)
- Google sign-in → Automatic backups: enables optional backups (evidence: `README.md`)
