# namrathado123-bit/smartbizz architecture

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

- Interactive diagram: https://gitdiagram.com/namrathado123-bit/smartbizz
- Repository: https://github.com/namrathado123-bit/smartbizz

## Overview

SmartBiz AI is a shop-management web app for inventory, point-of-sale billing, customer records, analytics, and restocking. A shopkeeper signs in, manages products, checks out a customer bill, and reviews business performance; checkout is documented to update stock and customer history. The app routes authenticated users to these workflows, with shared auth, data, and draft contexts. Firebase/Firestore is the documented persistence platform. Source excerpts confirm checkout and profile persistence; several page and data-context implementations were not sampled, so their internal links are omitted where unverified.

Main entry points: [`src/App.tsx`](https://github.com/namrathado123-bit/smartbizz/blob/main/src/App.tsx) (App router), [`src/services/firestoreService.ts`](https://github.com/namrathado123-bit/smartbizz/blob/main/src/services/firestoreService.ts) (Firestore operations), [`src/pages/BillingPage.tsx`](https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/BillingPage.tsx) (POS checkout), [`src/pages/UploadDataPage.tsx`](https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/UploadDataPage.tsx) (Product import)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and access"]
  node_app["App router<br/>[App.tsx]"]
  node_auth["Authentication<br/>[AuthContext.tsx]"]
  node_signin["Sign-in screen<br/>[SignInScreen.tsx]"]
  node_shell["App shell<br/>[AppShell.tsx]"]
  node_settings["Settings<br/>[SettingsPage.tsx]"]
end

subgraph group_operations["Shop operations"]
  node_inventory["Inventory management<br/>[InventoryPage.tsx]"]
  node_product_editor["Product entry<br/>[AddProductPage.tsx]"]
  node_product_edit["Product editing"]
  node_product_detail["Product details"]
  node_billing["POS checkout<br/>[BillingPage.tsx]"]
  node_billing_history["Billing history"]
  node_invoice["Invoice detail"]
  node_customers["Customer records<br/>[CustomersPage.tsx]"]
  node_upload["Product import<br/>[UploadDataPage.tsx]"]
  node_restock["Restock suggestions<br/>[RestockPage.tsx]"]
end

subgraph group_insights["Business insights"]
  node_dashboard["Dashboard<br/>[HomePage.tsx]"]
  node_analytics["Sales analytics"]
  node_insights["Business insights<br/>[InsightsPage.tsx]"]
  node_reports["Reports<br/>[ReportsPage.tsx]"]
end

subgraph group_platform["Shared platform"]
  node_data_context["Business data context<br/>[DataContext.tsx]"]
  node_drafts["Workflow drafts<br/>[DraftContext.tsx]"]
  node_navigation["Navigation state"]
  node_firestore_service["Firestore operations"]
  node_firestore[("Cloud Firestore")]
  node_firebase["Firebase setup<br/>[firebase.ts]"]
  node_types["Business data types<br/>[smartbiz.ts]"]
  node_empty_state["Empty-state component<br/>[EmptyStateCard.tsx]"]
  node_page_header["Page header<br/>[PageHeader.tsx]"]
end

node_shopkeeper(("Shopkeeper"))
node_supplier["IndiaMART"]

node_shopkeeper -->|"uses"| node_app
node_app -->|"provides"| node_auth
node_app -->|"routes unauthenticated users"| node_signin
node_app -->|"wraps routes"| node_shell
node_app -->|"provides"| node_data_context
node_app -->|"provides"| node_drafts
node_app -->|"provides"| node_navigation
node_app -->|"routes"| node_dashboard
node_app -->|"routes"| node_billing
node_app -->|"routes"| node_inventory
node_app -->|"routes"| node_product_editor
node_app -->|"routes"| node_product_edit
node_app -->|"routes"| node_product_detail
node_app -->|"routes"| node_billing_history
node_app -->|"routes"| node_invoice
node_app -->|"routes"| node_customers
node_app -->|"routes"| node_upload
node_app -->|"routes"| node_restock
node_app -->|"routes"| node_analytics
node_app -->|"routes"| node_insights
node_app -->|"routes"| node_reports
node_app -->|"routes"| node_settings
node_auth -->|"uses auth"| node_firebase
node_auth -->|"ensures profile"| node_firestore_service
node_billing -->|"reads products"| node_data_context
node_billing -->|"uses cart draft"| node_drafts
node_billing -->|"creates checkout"| node_firestore_service
node_upload -->|"saves products"| node_firestore_service
node_firestore_service -->|"reads and writes"| node_firestore
node_firestore_service -->|"uses database setup"| node_firebase
node_firestore_service -->|"uses business types"| node_types
node_dashboard -->|"renders"| node_empty_state
node_upload -->|"renders"| node_empty_state
node_upload -->|"renders"| node_page_header
node_restock -.->|"redirects to purchase"| node_supplier

click node_app "https://github.com/namrathado123-bit/smartbizz/blob/main/src/App.tsx"
click node_auth "https://github.com/namrathado123-bit/smartbizz/blob/main/src/contexts/AuthContext.tsx"
click node_signin "https://github.com/namrathado123-bit/smartbizz/blob/main/src/components/SignInScreen.tsx"
click node_shell "https://github.com/namrathado123-bit/smartbizz/blob/main/src/components/AppShell.tsx"
click node_dashboard "https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/HomePage.tsx"
click node_inventory "https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/InventoryPage.tsx"
click node_product_editor "https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/AddProductPage.tsx"
click node_product_edit "https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/EditProductPage.tsx"
click node_product_detail "https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/ProductDetailPage.tsx"
click node_billing "https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/BillingPage.tsx"
click node_billing_history "https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/BillingHistoryPage.tsx"
click node_invoice "https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/InvoiceDetailPage.tsx"
click node_customers "https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/CustomersPage.tsx"
click node_upload "https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/UploadDataPage.tsx"
click node_restock "https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/RestockPage.tsx"
click node_analytics "https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/AnalyticsInsightsPages.tsx"
click node_insights "https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/InsightsPage.tsx"
click node_reports "https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/ReportsPage.tsx"
click node_settings "https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/SettingsPage.tsx"
click node_data_context "https://github.com/namrathado123-bit/smartbizz/blob/main/src/contexts/DataContext.tsx"
click node_drafts "https://github.com/namrathado123-bit/smartbizz/blob/main/src/contexts/DraftContext.tsx"
click node_navigation "https://github.com/namrathado123-bit/smartbizz/blob/main/src/contexts/NavigationContext.tsx"
click node_firestore_service "https://github.com/namrathado123-bit/smartbizz/blob/main/src/services/firestoreService.ts"
click node_firebase "https://github.com/namrathado123-bit/smartbizz/blob/main/src/lib/firebase.ts"
click node_types "https://github.com/namrathado123-bit/smartbizz/blob/main/src/types/smartbiz.ts"
click node_empty_state "https://github.com/namrathado123-bit/smartbizz/blob/main/src/components/EmptyStateCard.tsx"
click node_page_header "https://github.com/namrathado123-bit/smartbizz/blob/main/src/components/PageHeader.tsx"

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,node_signin,node_shell,node_settings toneBlue
class node_inventory,node_product_editor,node_product_edit,node_product_detail,node_billing,node_billing_history,node_invoice,node_customers,node_upload,node_restock toneAmber
class node_dashboard,node_analytics,node_insights,node_reports toneMint
class node_data_context,node_drafts,node_navigation,node_firestore_service,node_firestore,node_firebase,node_types,node_empty_state,node_page_header toneRose
class node_shopkeeper,node_supplier toneIndigo
```

## Components

### App and access

- [App router](https://github.com/namrathado123-bit/smartbizz/blob/main/src/App.tsx): `src/App.tsx`
- [Authentication](https://github.com/namrathado123-bit/smartbizz/blob/main/src/contexts/AuthContext.tsx): `src/contexts/AuthContext.tsx`
- [Sign-in screen](https://github.com/namrathado123-bit/smartbizz/blob/main/src/components/SignInScreen.tsx): `src/components/SignInScreen.tsx`
- [App shell](https://github.com/namrathado123-bit/smartbizz/blob/main/src/components/AppShell.tsx): `src/components/AppShell.tsx`
- [Settings](https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/SettingsPage.tsx): `src/pages/SettingsPage.tsx`

### Shop operations

- [Inventory management](https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/InventoryPage.tsx): `src/pages/InventoryPage.tsx`
- [Product entry](https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/AddProductPage.tsx): `src/pages/AddProductPage.tsx`
- [Product editing](https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/EditProductPage.tsx): `src/pages/EditProductPage.tsx`
- [Product details](https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/ProductDetailPage.tsx): `src/pages/ProductDetailPage.tsx`
- [POS checkout](https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/BillingPage.tsx): `src/pages/BillingPage.tsx`
- [Billing history](https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/BillingHistoryPage.tsx): `src/pages/BillingHistoryPage.tsx`
- [Invoice detail](https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/InvoiceDetailPage.tsx): `src/pages/InvoiceDetailPage.tsx`
- [Customer records](https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/CustomersPage.tsx): `src/pages/CustomersPage.tsx`
- [Product import](https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/UploadDataPage.tsx): `src/pages/UploadDataPage.tsx`
- [Restock suggestions](https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/RestockPage.tsx): `src/pages/RestockPage.tsx`

### Business insights

- [Dashboard](https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/HomePage.tsx): `src/pages/HomePage.tsx`
- [Sales analytics](https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/AnalyticsInsightsPages.tsx): `src/pages/AnalyticsInsightsPages.tsx`
- [Business insights](https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/InsightsPage.tsx): `src/pages/InsightsPage.tsx`
- [Reports](https://github.com/namrathado123-bit/smartbizz/blob/main/src/pages/ReportsPage.tsx): `src/pages/ReportsPage.tsx`

### Shared platform

- [Business data context](https://github.com/namrathado123-bit/smartbizz/blob/main/src/contexts/DataContext.tsx): `src/contexts/DataContext.tsx`
- [Workflow drafts](https://github.com/namrathado123-bit/smartbizz/blob/main/src/contexts/DraftContext.tsx): `src/contexts/DraftContext.tsx`
- [Navigation state](https://github.com/namrathado123-bit/smartbizz/blob/main/src/contexts/NavigationContext.tsx): `src/contexts/NavigationContext.tsx`
- [Firestore operations](https://github.com/namrathado123-bit/smartbizz/blob/main/src/services/firestoreService.ts): `src/services/firestoreService.ts`
- **Cloud Firestore**
- [Firebase setup](https://github.com/namrathado123-bit/smartbizz/blob/main/src/lib/firebase.ts): `src/lib/firebase.ts`
- [Business data types](https://github.com/namrathado123-bit/smartbizz/blob/main/src/types/smartbiz.ts): `src/types/smartbiz.ts`
- [Empty-state component](https://github.com/namrathado123-bit/smartbizz/blob/main/src/components/EmptyStateCard.tsx): `src/components/EmptyStateCard.tsx`
- [Page header](https://github.com/namrathado123-bit/smartbizz/blob/main/src/components/PageHeader.tsx): `src/components/PageHeader.tsx`

### Other components

- **Shopkeeper**
- **IndiaMART**

## Connections

- Shopkeeper → App router: uses (evidence: `README.md`)
- App router → Authentication: provides (evidence: `src/App.tsx`)
- App router → Sign-in screen: routes unauthenticated users (evidence: `src/App.tsx`)
- App router → App shell: wraps routes (evidence: `src/App.tsx`)
- App router → Business data context: provides (evidence: `src/App.tsx`)
- App router → Workflow drafts: provides (evidence: `src/App.tsx`)
- App router → Navigation state: provides (evidence: `src/App.tsx`)
- App router → Dashboard: routes (evidence: `src/App.tsx`)
- App router → POS checkout: routes (evidence: `src/App.tsx`)
- App router → Inventory management: routes (evidence: `src/App.tsx`)
- App router → Product entry: routes (evidence: `src/App.tsx`)
- App router → Product editing: routes (evidence: `src/App.tsx`)
- App router → Product details: routes (evidence: `src/App.tsx`)
- App router → Billing history: routes (evidence: `src/App.tsx`)
- App router → Invoice detail: routes (evidence: `src/App.tsx`)
- App router → Customer records: routes (evidence: `src/App.tsx`)
- App router → Product import: routes (evidence: `src/App.tsx`)
- App router → Restock suggestions: routes (evidence: `src/App.tsx`)
- App router → Sales analytics: routes (evidence: `src/App.tsx`)
- App router → Business insights: routes (evidence: `src/App.tsx`)
- App router → Reports: routes (evidence: `src/App.tsx`)
- App router → Settings: routes (evidence: `src/App.tsx`)
- Authentication → Firebase setup: uses auth (evidence: `src/contexts/AuthContext.tsx`)
- Authentication → Firestore operations: ensures profile (evidence: `src/contexts/AuthContext.tsx`)
- POS checkout → Business data context: reads products (evidence: `src/pages/BillingPage.tsx`)
- POS checkout → Workflow drafts: uses cart draft (evidence: `src/pages/BillingPage.tsx`)
- POS checkout → Firestore operations: creates checkout (evidence: `src/pages/BillingPage.tsx`)
- Product import → Firestore operations: saves products (evidence: `src/pages/UploadDataPage.tsx`)
- Firestore operations → Cloud Firestore: reads and writes (evidence: `src/services/firestoreService.ts`)
- Firestore operations → Firebase setup: uses database setup (evidence: `src/services/firestoreService.ts`)
- Firestore operations → Business data types: uses business types (evidence: `src/services/firestoreService.ts`)
- Dashboard → Empty-state component: renders (evidence: `src/pages/HomePage.tsx`)
- Product import → Empty-state component: renders (evidence: `src/pages/UploadDataPage.tsx`)
- Product import → Page header: renders (evidence: `src/pages/UploadDataPage.tsx`)
- Restock suggestions → IndiaMART: redirects to purchase (evidence: `README.md`)
