# upc-hub/inventory-sync architecture

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

- Interactive diagram: https://gitdiagram.com/upc-hub/inventory-sync
- Repository: https://github.com/upc-hub/inventory-sync

## Overview

This is a bicycle and motorbike shop inventory app. A shop user logs in, browses and filters stock by vehicle and part section, then adds, edits, sells, or deletes items; the app also shows stock levels and can generate Burmese item descriptions with Gemini. App.tsx owns inventory state and API requests, while the modal and cards provide the main interaction surfaces. The excerpts show the API calls but not their exact endpoint or server implementation; the README gives no additional product capability details.

Main entry points: [`App.tsx`](https://github.com/upc-hub/inventory-sync/blob/main/App.tsx) (Inventory state), [`components/AddItemModal.tsx`](https://github.com/upc-hub/inventory-sync/blob/main/components/AddItemModal.tsx) (Item editor), [`components/InventoryCard.tsx`](https://github.com/upc-hub/inventory-sync/blob/main/components/InventoryCard.tsx) (Inventory card), [`components/LoginScreen.tsx`](https://github.com/upc-hub/inventory-sync/blob/main/components/LoginScreen.tsx) (Login screen)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Inventory app"]
  node_app["Inventory state<br/>[App.tsx]"]
  node_number_utils["Burmese numbers<br/>[utils.ts]"]
  node_item_types["Inventory types<br/>[types.ts]"]
end

subgraph group_ui["User interface"]
  node_login["Login screen<br/>[LoginScreen.tsx]"]
  node_bike_visual["Bike selector<br/>[BikeVisual.tsx]"]
  node_inventory_card["Inventory card<br/>[InventoryCard.tsx]"]
  node_item_modal["Item editor<br/>[AddItemModal.tsx]"]
end

subgraph group_ai["AI assistance"]
  node_gemini_service["Description generator<br/>[geminiService.ts]"]
end

subgraph group_persistence["Inventory persistence"]
  node_inventory_api["Inventory API"]
  node_inventory_data[("Inventory data<br/>[db.json]")]
end

node_shop_user(("Shop user"))
node_gemini["Google Gemini"]

node_shop_user -->|"enters credentials"| node_login
node_shop_user -->|"uses inventory"| node_app
node_app -->|"renders"| node_login
node_login -->|"submits credentials"| node_app
node_app -->|"renders selector"| node_bike_visual
node_bike_visual -->|"selects section"| node_app
node_app -->|"renders items"| node_inventory_card
node_inventory_card -->|"sends item actions"| node_app
node_app -->|"renders editor"| node_item_modal
node_item_modal -->|"submits item changes"| node_app
node_item_modal -->|"requests suggestions"| node_gemini_service
node_gemini_service -->|"generates details"| node_gemini
node_app -->|"reads and writes stock"| node_inventory_api
node_inventory_api -->|"serves JSON data"| node_inventory_data
node_app -->|"formats counts"| node_number_utils
node_item_modal -->|"converts form values"| node_number_utils
node_inventory_card -->|"formats stock values"| node_number_utils

click node_app "https://github.com/upc-hub/inventory-sync/blob/main/App.tsx"
click node_login "https://github.com/upc-hub/inventory-sync/blob/main/components/LoginScreen.tsx"
click node_bike_visual "https://github.com/upc-hub/inventory-sync/blob/main/components/BikeVisual.tsx"
click node_inventory_card "https://github.com/upc-hub/inventory-sync/blob/main/components/InventoryCard.tsx"
click node_item_modal "https://github.com/upc-hub/inventory-sync/blob/main/components/AddItemModal.tsx"
click node_number_utils "https://github.com/upc-hub/inventory-sync/blob/main/utils.ts"
click node_item_types "https://github.com/upc-hub/inventory-sync/blob/main/types.ts"
click node_gemini_service "https://github.com/upc-hub/inventory-sync/blob/main/services/geminiService.ts"
click node_inventory_data "https://github.com/upc-hub/inventory-sync/blob/main/db.json"

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_number_utils,node_item_types,node_shop_user toneBlue
class node_login,node_bike_visual,node_inventory_card,node_item_modal toneAmber
class node_gemini_service toneMint
class node_inventory_api,node_inventory_data toneRose
class node_gemini toneIndigo
```

## Components

### Inventory app

- [Inventory state](https://github.com/upc-hub/inventory-sync/blob/main/App.tsx): `App.tsx`
- [Burmese numbers](https://github.com/upc-hub/inventory-sync/blob/main/utils.ts): `utils.ts`
- [Inventory types](https://github.com/upc-hub/inventory-sync/blob/main/types.ts): `types.ts`

### User interface

- [Login screen](https://github.com/upc-hub/inventory-sync/blob/main/components/LoginScreen.tsx): `components/LoginScreen.tsx`
- [Bike selector](https://github.com/upc-hub/inventory-sync/blob/main/components/BikeVisual.tsx): `components/BikeVisual.tsx`
- [Inventory card](https://github.com/upc-hub/inventory-sync/blob/main/components/InventoryCard.tsx): `components/InventoryCard.tsx`
- [Item editor](https://github.com/upc-hub/inventory-sync/blob/main/components/AddItemModal.tsx): `components/AddItemModal.tsx`

### AI assistance

- [Description generator](https://github.com/upc-hub/inventory-sync/blob/main/services/geminiService.ts): `services/geminiService.ts`

### Inventory persistence

- **Inventory API**
- [Inventory data](https://github.com/upc-hub/inventory-sync/blob/main/db.json): `db.json`

### Other components

- **Shop user**
- **Google Gemini**

## Connections

- Shop user → Login screen: enters credentials (evidence: `components/LoginScreen.tsx`)
- Shop user → Inventory state: uses inventory (evidence: `App.tsx`)
- Inventory state → Login screen: renders (evidence: `App.tsx`)
- Login screen → Inventory state: submits credentials (evidence: `components/LoginScreen.tsx`)
- Inventory state → Bike selector: renders selector (evidence: `App.tsx`)
- Bike selector → Inventory state: selects section (evidence: `App.tsx`)
- Inventory state → Inventory card: renders items (evidence: `App.tsx`)
- Inventory card → Inventory state: sends item actions (evidence: `App.tsx`)
- Inventory state → Item editor: renders editor (evidence: `App.tsx`)
- Item editor → Inventory state: submits item changes (evidence: `App.tsx`)
- Item editor → Description generator: requests suggestions (evidence: `components/AddItemModal.tsx`)
- Description generator → Google Gemini: generates details (evidence: `services/geminiService.ts`)
- Inventory state → Inventory API: reads and writes stock (evidence: `App.tsx`)
- Inventory API → Inventory data: serves JSON data
- Inventory state → Burmese numbers: formats counts (evidence: `App.tsx`)
- Item editor → Burmese numbers: converts form values (evidence: `components/AddItemModal.tsx`)
- Inventory card → Burmese numbers: formats stock values (evidence: `components/InventoryCard.tsx`)
