# kai-zze/km100-stock architecture

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

- Interactive diagram: https://gitdiagram.com/kai-zze/km100-stock
- Repository: https://github.com/kai-zze/km100-stock

## Overview

KM100 is a browser-based inventory manager for training facilities. Users navigate rooms or the all-rooms dashboard, search and filter inventory, then add or edit items and manage quantities; room and column schema management support that workflow. The app also provides Excel export, JSON backup/restore, sample-data reset, and persistent browser storage. The graph reflects documented features and indexed imports; implementation details for persistence and some actions were not sampled.

Main entry points: [`src/App.tsx`](https://github.com/kai-zze/km100-stock/blob/main/src/App.tsx) (App Controller), [`src/components/Header.tsx`](https://github.com/kai-zze/km100-stock/blob/main/src/components/Header.tsx) (Action Header), [`src/components/InventoryTable.tsx`](https://github.com/kai-zze/km100-stock/blob/main/src/components/InventoryTable.tsx) (Inventory Table), [`src/utils/excelExport.ts`](https://github.com/kai-zze/km100-stock/blob/main/src/utils/excelExport.ts) (Excel Exporter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application State"]
  node_app["App Controller<br/>[App.tsx]"]
  node_domain["Inventory Types<br/>[inventory.ts]"]
  node_defaults["Sample Catalog<br/>[defaultData.ts]"]
  node_storage[("Browser localStorage")]
  node_header["Action Header<br/>[Header.tsx]"]
end

subgraph group_rooms["Facility Views"]
  node_sidebar["Room Navigation<br/>[Sidebar.tsx]"]
  node_dashboard["Facility Dashboard"]
  node_roomform["Room Editor<br/>[RoomModal.tsx]"]
end

subgraph group_inventory["Inventory Management"]
  node_table["Inventory Table<br/>[InventoryTable.tsx]"]
  node_itemform["Item Editor<br/>[ItemModal.tsx]"]
  node_columns["Column Schema Builder"]
  node_condition["Condition Badge<br/>[ConditionBadge.tsx]"]
end

subgraph group_portability["Data Portability"]
  node_excel["Excel Exporter<br/>[excelExport.ts]"]
  node_xlsx["SheetJS"]
  node_backup["JSON Backup/Restore<br/>[App.tsx]"]
end

node_user(("Inventory User"))

node_user -->|"uses"| node_app
node_app -->|"uses types"| node_domain
node_app -->|"loads defaults"| node_defaults
node_app -->|"persists changes"| node_storage
node_app -->|"renders"| node_header
node_app -->|"renders"| node_sidebar
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_table
node_app -->|"renders"| node_itemform
node_app -->|"renders"| node_columns
node_app -->|"renders"| node_roomform
node_table -->|"renders"| node_condition
node_app -->|"calls export"| node_excel
node_excel -->|"builds workbook"| node_xlsx
node_header -->|"offers backup actions"| node_backup
node_user -->|"exports or imports"| node_backup
node_app -.->|"handles backup"| node_backup

click node_app "https://github.com/kai-zze/km100-stock/blob/main/src/App.tsx"
click node_domain "https://github.com/kai-zze/km100-stock/blob/main/src/types/inventory.ts"
click node_defaults "https://github.com/kai-zze/km100-stock/blob/main/src/data/defaultData.ts"
click node_header "https://github.com/kai-zze/km100-stock/blob/main/src/components/Header.tsx"
click node_sidebar "https://github.com/kai-zze/km100-stock/blob/main/src/components/Sidebar.tsx"
click node_dashboard "https://github.com/kai-zze/km100-stock/blob/main/src/components/OverviewDashboard.tsx"
click node_roomform "https://github.com/kai-zze/km100-stock/blob/main/src/components/RoomModal.tsx"
click node_table "https://github.com/kai-zze/km100-stock/blob/main/src/components/InventoryTable.tsx"
click node_itemform "https://github.com/kai-zze/km100-stock/blob/main/src/components/ItemModal.tsx"
click node_columns "https://github.com/kai-zze/km100-stock/blob/main/src/components/ColumnsSchemaModal.tsx"
click node_condition "https://github.com/kai-zze/km100-stock/blob/main/src/components/ConditionBadge.tsx"
click node_excel "https://github.com/kai-zze/km100-stock/blob/main/src/utils/excelExport.ts"
click node_backup "https://github.com/kai-zze/km100-stock/blob/main/src/App.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_domain,node_defaults,node_storage,node_header,node_user toneBlue
class node_sidebar,node_dashboard,node_roomform toneAmber
class node_table,node_itemform,node_columns,node_condition toneMint
class node_excel,node_xlsx,node_backup toneRose
```

## Components

### Application State

- [App Controller](https://github.com/kai-zze/km100-stock/blob/main/src/App.tsx): `src/App.tsx`
- [Inventory Types](https://github.com/kai-zze/km100-stock/blob/main/src/types/inventory.ts): `src/types/inventory.ts`
- [Sample Catalog](https://github.com/kai-zze/km100-stock/blob/main/src/data/defaultData.ts): `src/data/defaultData.ts`
- **Browser localStorage**
- [Action Header](https://github.com/kai-zze/km100-stock/blob/main/src/components/Header.tsx): `src/components/Header.tsx`

### Facility Views

- [Room Navigation](https://github.com/kai-zze/km100-stock/blob/main/src/components/Sidebar.tsx): `src/components/Sidebar.tsx`
- [Facility Dashboard](https://github.com/kai-zze/km100-stock/blob/main/src/components/OverviewDashboard.tsx): `src/components/OverviewDashboard.tsx`
- [Room Editor](https://github.com/kai-zze/km100-stock/blob/main/src/components/RoomModal.tsx): `src/components/RoomModal.tsx`

### Inventory Management

- [Inventory Table](https://github.com/kai-zze/km100-stock/blob/main/src/components/InventoryTable.tsx): `src/components/InventoryTable.tsx`
- [Item Editor](https://github.com/kai-zze/km100-stock/blob/main/src/components/ItemModal.tsx): `src/components/ItemModal.tsx`
- [Column Schema Builder](https://github.com/kai-zze/km100-stock/blob/main/src/components/ColumnsSchemaModal.tsx): `src/components/ColumnsSchemaModal.tsx`
- [Condition Badge](https://github.com/kai-zze/km100-stock/blob/main/src/components/ConditionBadge.tsx): `src/components/ConditionBadge.tsx`

### Data Portability

- [Excel Exporter](https://github.com/kai-zze/km100-stock/blob/main/src/utils/excelExport.ts): `src/utils/excelExport.ts`
- **SheetJS**
- [JSON Backup/Restore](https://github.com/kai-zze/km100-stock/blob/main/src/App.tsx): `src/App.tsx`

### Other components

- **Inventory User**

## Connections

- Inventory User → App Controller: uses (evidence: `README.md`)
- App Controller → Inventory Types: uses types (evidence: `src/App.tsx`)
- App Controller → Sample Catalog: loads defaults (evidence: `src/App.tsx`)
- App Controller → Browser localStorage: persists changes (evidence: `README.md`)
- App Controller → Action Header: renders (evidence: `src/App.tsx`)
- App Controller → Room Navigation: renders (evidence: `src/App.tsx`)
- App Controller → Facility Dashboard: renders (evidence: `src/App.tsx`)
- App Controller → Inventory Table: renders (evidence: `src/App.tsx`)
- App Controller → Item Editor: renders (evidence: `src/App.tsx`)
- App Controller → Column Schema Builder: renders (evidence: `src/App.tsx`)
- App Controller → Room Editor: renders (evidence: `src/App.tsx`)
- Inventory Table → Condition Badge: renders (evidence: `src/components/InventoryTable.tsx`)
- App Controller → Excel Exporter: calls export (evidence: `src/App.tsx`)
- Excel Exporter → SheetJS: builds workbook (evidence: `src/utils/excelExport.ts`)
- Action Header → JSON Backup/Restore: offers backup actions (evidence: `README.md`)
- Inventory User → JSON Backup/Restore: exports or imports (evidence: `README.md`)
- App Controller → JSON Backup/Restore: handles backup (evidence: `src/App.tsx`)
