# sinou3936/stockcontrol architecture

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

- Interactive diagram: https://gitdiagram.com/sinou3936/stockcontrol
- Repository: https://github.com/sinou3936/stockcontrol

## Overview

StockControl is a Flutter inventory app for a multi-store restaurant chain, with Windows and Android clients. A user enters through the app shell, then records or reviews store inventory; the app calculates stock from append-only movement records and persists locally before syncing. The README also documents authentication, store/staff administration, safety-stock alerts, purchase-order exports, and validated Excel imports. The source excerpts are native runner scaffolding, not Dart runtime code, so feature-to-data links below rely on README statements; uncertain implementation details are omitted.

Main entry points: [`lib/data/local/daos/stock_movement_dao.dart`](https://github.com/sinou3936/stockcontrol/blob/main/lib/data/local/daos/stock_movement_dao.dart) (Movement records), [`lib/core/shell/app_shell.dart`](https://github.com/sinou3936/stockcontrol/blob/main/lib/core/shell/app_shell.dart) (App shell), [`lib/features/stock_overview/stock_overview_screen.dart`](https://github.com/sinou3936/stockcontrol/blob/main/lib/features/stock_overview/stock_overview_screen.dart) (Inventory screens), [`lib/data/local/database.dart`](https://github.com/sinou3936/stockcontrol/blob/main/lib/data/local/database.dart) (Local database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App experience"]
  node_main["App startup<br/>[main.dart]"]
  node_shell["App shell<br/>[app_shell.dart]"]
  node_login["Login<br/>[login_screen.dart]"]
end

subgraph group_inventory["Inventory workflows"]
  node_inventory_ui["Inventory screens"]
  node_inbound["Inbound entry"]
  node_adjust["Stock adjustment"]
  node_count["Closing count<br/>[count_screen.dart]"]
  node_stock_domain["Stock calculations"]
  node_shortage["Safety-stock alerts"]
  node_purchase["Purchase orders"]
end

subgraph group_data["Data and sync"]
  node_movement["Movement records"]
  node_localdb[("Local database<br/>[database.dart]")]
  node_sync["Background sync"]
end

subgraph group_admin["Administration and files"]
  node_export["PDF and Excel export"]
  node_excel_ui["Excel import screen"]
  node_excel_service["Import validation"]
  node_stores["Store management"]
  node_staff["Staff management"]
end

subgraph group_native["Native hosts"]
  node_windows_host["Windows host<br/>[win32_window.cpp]"]
  node_windows_flutter["Windows Flutter view<br/>[flutter_window.h]"]
  node_windows_header["Windows window interface<br/>[win32_window.h]"]
  node_linux_host["Linux host interface<br/>[my_application.h]"]
  node_linux_plugins["Linux plugin registration"]
  node_windows_plugins["Windows plugin registration"]
end

node_user(("Store user"))
node_supabase[("Supabase")]

node_user -->|"uses"| node_shell
node_main -.->|"starts"| node_shell
node_shell -.->|"routes to"| node_login
node_shell -->|"presents"| node_inventory_ui
node_user -->|"records receipt"| node_inbound
node_user -->|"records adjustment"| node_adjust
node_user -->|"records count"| node_count
node_inventory_ui -->|"shows calculated stock"| node_stock_domain
node_stock_domain -->|"sums movements"| node_movement
node_inbound -->|"appends receipt"| node_movement
node_adjust -->|"appends adjustment"| node_movement
node_count -->|"records difference"| node_movement
node_movement -->|"persists locally"| node_localdb
node_localdb -->|"queues changes"| node_sync
node_sync -->|"sends and receives"| node_supabase
node_inventory_ui -->|"offers alerts"| node_shortage
node_shortage -->|"identifies reorder needs"| node_purchase
node_purchase -->|"creates order files"| node_export
node_user -->|"uploads workbook"| node_excel_ui
node_excel_ui -->|"previews and validates"| node_excel_service
node_excel_service -->|"registers imported data"| node_localdb
node_user -->|"manages stores"| node_stores
node_user -->|"manages staff"| node_staff
node_windows_host -->|"hosts view"| node_windows_flutter
node_windows_flutter -->|"inherits window"| node_windows_header
node_linux_host -.->|"launches Flutter app"| node_main
node_windows_plugins -.->|"registers plugins"| node_windows_flutter
node_linux_plugins -.->|"registers plugins"| node_linux_host

click node_main "https://github.com/sinou3936/stockcontrol/blob/main/lib/main.dart"
click node_shell "https://github.com/sinou3936/stockcontrol/blob/main/lib/core/shell/app_shell.dart"
click node_login "https://github.com/sinou3936/stockcontrol/blob/main/lib/features/auth/login_screen.dart"
click node_inventory_ui "https://github.com/sinou3936/stockcontrol/blob/main/lib/features/stock_overview/stock_overview_screen.dart"
click node_inbound "https://github.com/sinou3936/stockcontrol/blob/main/lib/features/inbound/inbound_form_screen.dart"
click node_adjust "https://github.com/sinou3936/stockcontrol/blob/main/lib/features/stock_adjustment/stock_adjustment_form_screen.dart"
click node_count "https://github.com/sinou3936/stockcontrol/blob/main/lib/features/count/count_screen.dart"
click node_stock_domain "https://github.com/sinou3936/stockcontrol/blob/main/lib/domain/stock_overview.dart"
click node_movement "https://github.com/sinou3936/stockcontrol/blob/main/lib/data/local/daos/stock_movement_dao.dart"
click node_localdb "https://github.com/sinou3936/stockcontrol/blob/main/lib/data/local/database.dart"
click node_sync "https://github.com/sinou3936/stockcontrol/blob/main/lib/data/repositories/sync_repository.dart"
click node_shortage "https://github.com/sinou3936/stockcontrol/blob/main/lib/features/shortage/shortage_screen.dart"
click node_purchase "https://github.com/sinou3936/stockcontrol/blob/main/lib/features/purchase_order/purchase_order_screen.dart"
click node_export "https://github.com/sinou3936/stockcontrol/blob/main/lib/data/export/purchase_order_exporter.dart"
click node_excel_ui "https://github.com/sinou3936/stockcontrol/blob/main/lib/features/excel_import/excel_import_screen.dart"
click node_excel_service "https://github.com/sinou3936/stockcontrol/blob/main/lib/data/import/excel_import_service.dart"
click node_stores "https://github.com/sinou3936/stockcontrol/blob/main/lib/features/store_management/store_management_screen.dart"
click node_staff "https://github.com/sinou3936/stockcontrol/blob/main/lib/features/auth/add_staff_screen.dart"
click node_windows_host "https://github.com/sinou3936/stockcontrol/blob/main/windows/runner/win32_window.cpp"
click node_windows_flutter "https://github.com/sinou3936/stockcontrol/blob/main/windows/runner/flutter_window.h"
click node_windows_header "https://github.com/sinou3936/stockcontrol/blob/main/windows/runner/win32_window.h"
click node_linux_host "https://github.com/sinou3936/stockcontrol/blob/main/linux/runner/my_application.h"
click node_linux_plugins "https://github.com/sinou3936/stockcontrol/blob/main/linux/flutter/generated_plugin_registrant.h"
click node_windows_plugins "https://github.com/sinou3936/stockcontrol/blob/main/windows/flutter/generated_plugin_registrant.h"

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_shell,node_login,node_user toneBlue
class node_inventory_ui,node_inbound,node_adjust,node_count,node_stock_domain,node_shortage,node_purchase,node_supabase toneAmber
class node_movement,node_localdb,node_sync toneMint
class node_export,node_excel_ui,node_excel_service,node_stores,node_staff toneRose
class node_windows_host,node_windows_flutter,node_windows_header,node_linux_host,node_linux_plugins,node_windows_plugins toneIndigo
```

## Components

### App experience

- [App startup](https://github.com/sinou3936/stockcontrol/blob/main/lib/main.dart): `lib/main.dart`
- [App shell](https://github.com/sinou3936/stockcontrol/blob/main/lib/core/shell/app_shell.dart): `lib/core/shell/app_shell.dart`
- [Login](https://github.com/sinou3936/stockcontrol/blob/main/lib/features/auth/login_screen.dart): `lib/features/auth/login_screen.dart`

### Inventory workflows

- [Inventory screens](https://github.com/sinou3936/stockcontrol/blob/main/lib/features/stock_overview/stock_overview_screen.dart): `lib/features/stock_overview/stock_overview_screen.dart`
- [Inbound entry](https://github.com/sinou3936/stockcontrol/blob/main/lib/features/inbound/inbound_form_screen.dart): `lib/features/inbound/inbound_form_screen.dart`
- [Stock adjustment](https://github.com/sinou3936/stockcontrol/blob/main/lib/features/stock_adjustment/stock_adjustment_form_screen.dart): `lib/features/stock_adjustment/stock_adjustment_form_screen.dart`
- [Closing count](https://github.com/sinou3936/stockcontrol/blob/main/lib/features/count/count_screen.dart): `lib/features/count/count_screen.dart`
- [Stock calculations](https://github.com/sinou3936/stockcontrol/blob/main/lib/domain/stock_overview.dart): `lib/domain/stock_overview.dart`
- [Safety-stock alerts](https://github.com/sinou3936/stockcontrol/blob/main/lib/features/shortage/shortage_screen.dart): `lib/features/shortage/shortage_screen.dart`
- [Purchase orders](https://github.com/sinou3936/stockcontrol/blob/main/lib/features/purchase_order/purchase_order_screen.dart): `lib/features/purchase_order/purchase_order_screen.dart`

### Data and sync

- [Movement records](https://github.com/sinou3936/stockcontrol/blob/main/lib/data/local/daos/stock_movement_dao.dart): `lib/data/local/daos/stock_movement_dao.dart`
- [Local database](https://github.com/sinou3936/stockcontrol/blob/main/lib/data/local/database.dart): `lib/data/local/database.dart`
- [Background sync](https://github.com/sinou3936/stockcontrol/blob/main/lib/data/repositories/sync_repository.dart): `lib/data/repositories/sync_repository.dart`

### Administration and files

- [PDF and Excel export](https://github.com/sinou3936/stockcontrol/blob/main/lib/data/export/purchase_order_exporter.dart): `lib/data/export/purchase_order_exporter.dart`
- [Excel import screen](https://github.com/sinou3936/stockcontrol/blob/main/lib/features/excel_import/excel_import_screen.dart): `lib/features/excel_import/excel_import_screen.dart`
- [Import validation](https://github.com/sinou3936/stockcontrol/blob/main/lib/data/import/excel_import_service.dart): `lib/data/import/excel_import_service.dart`
- [Store management](https://github.com/sinou3936/stockcontrol/blob/main/lib/features/store_management/store_management_screen.dart): `lib/features/store_management/store_management_screen.dart`
- [Staff management](https://github.com/sinou3936/stockcontrol/blob/main/lib/features/auth/add_staff_screen.dart): `lib/features/auth/add_staff_screen.dart`

### Native hosts

- [Windows host](https://github.com/sinou3936/stockcontrol/blob/main/windows/runner/win32_window.cpp): `windows/runner/win32_window.cpp`
- [Windows Flutter view](https://github.com/sinou3936/stockcontrol/blob/main/windows/runner/flutter_window.h): `windows/runner/flutter_window.h`
- [Windows window interface](https://github.com/sinou3936/stockcontrol/blob/main/windows/runner/win32_window.h): `windows/runner/win32_window.h`
- [Linux host interface](https://github.com/sinou3936/stockcontrol/blob/main/linux/runner/my_application.h): `linux/runner/my_application.h`
- [Linux plugin registration](https://github.com/sinou3936/stockcontrol/blob/main/linux/flutter/generated_plugin_registrant.h): `linux/flutter/generated_plugin_registrant.h`
- [Windows plugin registration](https://github.com/sinou3936/stockcontrol/blob/main/windows/flutter/generated_plugin_registrant.h): `windows/flutter/generated_plugin_registrant.h`

### Other components

- **Store user**
- **Supabase**

## Connections

- Store user → App shell: uses (evidence: `README.md`)
- App startup → App shell: starts
- App shell → Login: routes to
- App shell → Inventory screens: presents (evidence: `README.md`)
- Store user → Inbound entry: records receipt (evidence: `README.md`)
- Store user → Stock adjustment: records adjustment (evidence: `README.md`)
- Store user → Closing count: records count (evidence: `README.md`)
- Inventory screens → Stock calculations: shows calculated stock (evidence: `README.md`)
- Stock calculations → Movement records: sums movements (evidence: `README.md`)
- Inbound entry → Movement records: appends receipt (evidence: `README.md`)
- Stock adjustment → Movement records: appends adjustment (evidence: `README.md`)
- Closing count → Movement records: records difference (evidence: `README.md`)
- Movement records → Local database: persists locally (evidence: `README.md`)
- Local database → Background sync: queues changes (evidence: `README.md`)
- Background sync → Supabase: sends and receives (evidence: `README.md`)
- Inventory screens → Safety-stock alerts: offers alerts (evidence: `README.md`)
- Safety-stock alerts → Purchase orders: identifies reorder needs (evidence: `README.md`)
- Purchase orders → PDF and Excel export: creates order files (evidence: `README.md`)
- Store user → Excel import screen: uploads workbook (evidence: `README.md`)
- Excel import screen → Import validation: previews and validates (evidence: `README.md`)
- Import validation → Local database: registers imported data (evidence: `README.md`)
- Store user → Store management: manages stores (evidence: `README.md`)
- Store user → Staff management: manages staff (evidence: `README.md`)
- Windows host → Windows Flutter view: hosts view
- Windows Flutter view → Windows window interface: inherits window (evidence: `windows/runner/flutter_window.h`)
- Linux host interface → App startup: launches Flutter app
- Windows plugin registration → Windows Flutter view: registers plugins
- Linux plugin registration → Linux host interface: registers plugins
