# mdarafath07/smartstock architecture

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

- Interactive diagram: https://gitdiagram.com/mdarafath07/smartstock
- Repository: https://github.com/mdarafath07/smartstock

## Overview

SmartStock is a cross-platform Flutter inventory and point-of-sale system for electronics retailers. The main workflow is maintaining product and serial-number stock, selecting available units for a sale, recording the transaction, and using dashboard and reports to monitor the business. Its feature-based architecture separates screens, providers, services, and repositories, with Firestore as the documented real-time backend. The README excerpt supports the main product flows and some layer relationships; most Dart sources were not sampled, so other connections are omitted rather than inferred.

Main entry points: [`functions/index.js`](https://github.com/mdarafath07/smartstock/blob/master/functions/index.js) (Callable functions), [`lib/core/routes`](https://github.com/mdarafath07/smartstock/tree/master/lib/core/routes) (Navigation), [`lib/features/products/screens`](https://github.com/mdarafath07/smartstock/tree/master/lib/features/products/screens) (Product catalog), [`lib/features/sales/screens/new_sale_screen.dart`](https://github.com/mdarafath07/smartstock/blob/master/lib/features/sales/screens/new_sale_screen.dart) (Point of sale)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App Shell"]
  node_routes["Navigation"]
end

subgraph group_stock["Stock Management"]
  node_products["Product catalog"]
  node_product_provider["Product state"]
  node_product_service["Product operations"]
  node_inventory["Inventory views"]
  node_inventory_service["Inventory operations"]
  node_categories["Categories"]
end

subgraph group_transactions["Sales and Service"]
  node_sales["Point of sale"]
  node_sale_provider["Sale state<br/>[sale_provider.dart]"]
  node_sale_service["Sale operations<br/>[sale_service.dart]"]
  node_customers["Customer records"]
  node_warranty["Warranty claims"]
  node_issues["Product issues"]
  node_replacements["Replacements"]
end

subgraph group_insights["Business Insights"]
  node_dashboard["Dashboard"]
  node_dash_provider["Dashboard state"]
  node_dash_service["Dashboard metrics"]
  node_reports["Reports and analytics"]
end

subgraph group_platform["Backend Integrations"]
  node_sheets["Sheets sync"]
  node_cloud_functions["Callable functions<br/>[index.js]"]
  node_firestore[("Cloud Firestore")]
end

node_operator(("Retail operator"))
node_google_sheets[("Google Sheets")]
node_email["Email service"]

node_operator -->|"uses"| node_routes
node_routes -->|"routes to"| node_dashboard
node_dashboard -->|"displays"| node_dash_provider
node_dash_provider -->|"requests metrics"| node_dash_service
node_dash_service -->|"queries"| node_firestore
node_operator -->|"manages products"| node_products
node_products -.->|"uses state"| node_product_provider
node_operator -->|"reviews stock"| node_inventory
node_operator -.->|"manages categories"| node_categories
node_operator -->|"records sale"| node_sales
node_sales -->|"submits records"| node_sale_provider
node_sale_provider -->|"bulk creates sales"| node_firestore
node_operator -.->|"manages customers"| node_customers
node_operator -->|"checks warranty"| node_warranty
node_operator -.->|"tracks issues"| node_issues
node_operator -.->|"handles replacements"| node_replacements
node_operator -->|"views analytics"| node_reports
node_operator -.->|"backs up data"| node_sheets
node_sheets -.->|"calls"| node_cloud_functions
node_cloud_functions -->|"writes sheets"| node_google_sheets
node_cloud_functions -->|"stores OTPs"| node_firestore
node_cloud_functions -->|"sends OTP"| node_email

click node_routes "https://github.com/mdarafath07/smartstock/tree/master/lib/core/routes"
click node_dashboard "https://github.com/mdarafath07/smartstock/blob/master/lib/features/dashboard/screens/dashboard_screen.dart"
click node_dash_provider "https://github.com/mdarafath07/smartstock/blob/master/lib/features/dashboard/providers/dashboard_provider.dart"
click node_dash_service "https://github.com/mdarafath07/smartstock/blob/master/lib/features/dashboard/services/dashboard_service.dart"
click node_products "https://github.com/mdarafath07/smartstock/tree/master/lib/features/products/screens"
click node_product_provider "https://github.com/mdarafath07/smartstock/blob/master/lib/features/products/providers/product_provider.dart"
click node_product_service "https://github.com/mdarafath07/smartstock/blob/master/lib/features/products/services/product_service.dart"
click node_inventory "https://github.com/mdarafath07/smartstock/tree/master/lib/features/inventory/screens"
click node_inventory_service "https://github.com/mdarafath07/smartstock/blob/master/lib/features/inventory/services/inventory_service.dart"
click node_categories "https://github.com/mdarafath07/smartstock/tree/master/lib/features/categories/screens"
click node_sales "https://github.com/mdarafath07/smartstock/blob/master/lib/features/sales/screens/new_sale_screen.dart"
click node_sale_provider "https://github.com/mdarafath07/smartstock/blob/master/lib/features/sales/providers/sale_provider.dart"
click node_sale_service "https://github.com/mdarafath07/smartstock/blob/master/lib/features/sales/services/sale_service.dart"
click node_customers "https://github.com/mdarafath07/smartstock/tree/master/lib/features/customers/screens"
click node_warranty "https://github.com/mdarafath07/smartstock/tree/master/lib/features/warranty/screens"
click node_issues "https://github.com/mdarafath07/smartstock/tree/master/lib/features/product_issues/screens"
click node_replacements "https://github.com/mdarafath07/smartstock/tree/master/lib/features/replacements/screens"
click node_reports "https://github.com/mdarafath07/smartstock/tree/master/lib/features/reports/screens"
click node_sheets "https://github.com/mdarafath07/smartstock/tree/master/lib/features/integrations/services"
click node_cloud_functions "https://github.com/mdarafath07/smartstock/blob/master/functions/index.js"

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_routes toneBlue
class node_products,node_product_provider,node_product_service,node_inventory,node_inventory_service,node_categories,node_google_sheets toneAmber
class node_sales,node_sale_provider,node_sale_service,node_customers,node_warranty,node_issues,node_replacements toneMint
class node_dashboard,node_dash_provider,node_dash_service,node_reports toneRose
class node_sheets,node_cloud_functions,node_firestore,node_operator,node_email toneIndigo
```

## Components

### App Shell

- [Navigation](https://github.com/mdarafath07/smartstock/tree/master/lib/core/routes): `lib/core/routes`

### Stock Management

- [Product catalog](https://github.com/mdarafath07/smartstock/tree/master/lib/features/products/screens): `lib/features/products/screens`
- [Product state](https://github.com/mdarafath07/smartstock/blob/master/lib/features/products/providers/product_provider.dart): `lib/features/products/providers/product_provider.dart`
- [Product operations](https://github.com/mdarafath07/smartstock/blob/master/lib/features/products/services/product_service.dart): `lib/features/products/services/product_service.dart`
- [Inventory views](https://github.com/mdarafath07/smartstock/tree/master/lib/features/inventory/screens): `lib/features/inventory/screens`
- [Inventory operations](https://github.com/mdarafath07/smartstock/blob/master/lib/features/inventory/services/inventory_service.dart): `lib/features/inventory/services/inventory_service.dart`
- [Categories](https://github.com/mdarafath07/smartstock/tree/master/lib/features/categories/screens): `lib/features/categories/screens`

### Sales and Service

- [Point of sale](https://github.com/mdarafath07/smartstock/blob/master/lib/features/sales/screens/new_sale_screen.dart): `lib/features/sales/screens/new_sale_screen.dart`
- [Sale state](https://github.com/mdarafath07/smartstock/blob/master/lib/features/sales/providers/sale_provider.dart): `lib/features/sales/providers/sale_provider.dart`
- [Sale operations](https://github.com/mdarafath07/smartstock/blob/master/lib/features/sales/services/sale_service.dart): `lib/features/sales/services/sale_service.dart`
- [Customer records](https://github.com/mdarafath07/smartstock/tree/master/lib/features/customers/screens): `lib/features/customers/screens`
- [Warranty claims](https://github.com/mdarafath07/smartstock/tree/master/lib/features/warranty/screens): `lib/features/warranty/screens`
- [Product issues](https://github.com/mdarafath07/smartstock/tree/master/lib/features/product_issues/screens): `lib/features/product_issues/screens`
- [Replacements](https://github.com/mdarafath07/smartstock/tree/master/lib/features/replacements/screens): `lib/features/replacements/screens`

### Business Insights

- [Dashboard](https://github.com/mdarafath07/smartstock/blob/master/lib/features/dashboard/screens/dashboard_screen.dart): `lib/features/dashboard/screens/dashboard_screen.dart`
- [Dashboard state](https://github.com/mdarafath07/smartstock/blob/master/lib/features/dashboard/providers/dashboard_provider.dart): `lib/features/dashboard/providers/dashboard_provider.dart`
- [Dashboard metrics](https://github.com/mdarafath07/smartstock/blob/master/lib/features/dashboard/services/dashboard_service.dart): `lib/features/dashboard/services/dashboard_service.dart`
- [Reports and analytics](https://github.com/mdarafath07/smartstock/tree/master/lib/features/reports/screens): `lib/features/reports/screens`

### Backend Integrations

- [Sheets sync](https://github.com/mdarafath07/smartstock/tree/master/lib/features/integrations/services): `lib/features/integrations/services`
- [Callable functions](https://github.com/mdarafath07/smartstock/blob/master/functions/index.js): `functions/index.js`
- **Cloud Firestore**

### Other components

- **Retail operator**
- **Google Sheets**
- **Email service**

## Connections

- Retail operator → Navigation: uses (evidence: `README.md`)
- Navigation → Dashboard: routes to (evidence: `README.md`)
- Dashboard → Dashboard state: displays (evidence: `README.md`)
- Dashboard state → Dashboard metrics: requests metrics (evidence: `README.md`)
- Dashboard metrics → Cloud Firestore: queries (evidence: `README.md`)
- Retail operator → Product catalog: manages products (evidence: `README.md`)
- Product catalog → Product state: uses state
- Retail operator → Inventory views: reviews stock (evidence: `README.md`)
- Retail operator → Categories: manages categories
- Retail operator → Point of sale: records sale (evidence: `README.md`)
- Point of sale → Sale state: submits records (evidence: `README.md`)
- Sale state → Cloud Firestore: bulk creates sales (evidence: `README.md`)
- Retail operator → Customer records: manages customers
- Retail operator → Warranty claims: checks warranty (evidence: `README.md`)
- Retail operator → Product issues: tracks issues
- Retail operator → Replacements: handles replacements
- Retail operator → Reports and analytics: views analytics (evidence: `README.md`)
- Retail operator → Sheets sync: backs up data (evidence: `README.md`)
- Sheets sync → Callable functions: calls
- Callable functions → Google Sheets: writes sheets (evidence: `functions/index.js`)
- Callable functions → Cloud Firestore: stores OTPs (evidence: `functions/index.js`)
- Callable functions → Email service: sends OTP (evidence: `functions/index.js`)
