# wingtm-lang/machine-asset-location architecture

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

- Interactive diagram: https://gitdiagram.com/wingtm-lang/machine-asset-location
- Repository: https://github.com/wingtm-lang/machine-asset-location

## Overview

PT.WINNERS Machine Asset Location Tracker is a multi-site sewing-machine asset management app. Users sign in, then navigate from the main app to inventory, movement, transfers, stocktaking, history, reports, administration, or WH2 rack mapping; the views use shared services to read and update server-backed asset data. The graph includes the documented Supabase authentication and storage layers, plus the rack-map and user-management paths. Some view-to-service edges rely on the SOURCE INDEX import references; unsampled implementation details and backend schema are not inferred.

Main entry points: [`src/App.tsx`](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/App.tsx) (App navigation), [`src/services/storage.ts`](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/services/storage.ts) (Asset data service), [`src/views/RackMapView.tsx`](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/RackMapView.tsx) (Rack map view), [`src/components/MachineDetailModal.tsx`](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/components/MachineDetailModal.tsx) (Machine details)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application shell"]
  node_app["App navigation<br/>[App.tsx]"]
  node_home["Home<br/>[HomeView.tsx]"]
end

subgraph group_identity["Identity and access"]
  node_login["Login<br/>[LoginPage.tsx]"]
  node_authctx["Auth context<br/>[authContext.tsx]"]
  node_authsvc["Supabase auth<br/>[authService.ts]"]
  node_useradmin["User management"]
  node_adminfn["Admin users function<br/>[index.ts]"]
end

subgraph group_assets["Asset operations"]
  node_dashboard["Dashboard<br/>[DashboardView.tsx]"]
  node_machines["Machine inventory"]
  node_move["Move machines<br/>[MoveView.tsx]"]
  node_transfers["Site transfers<br/>[TransfersView.tsx]"]
  node_opname["Stocktaking<br/>[OpnameView.tsx]"]
  node_history["Movement history<br/>[HistoryView.tsx]"]
  node_reports["Reports<br/>[ReportsView.tsx]"]
  node_admin["Administration<br/>[AdminView.tsx]"]
  node_scanner["Barcode scanner<br/>[ScannerModal.tsx]"]
  node_detail["Machine details"]
end

subgraph group_warehouse["Warehouse mapping"]
  node_rackview["Rack map view<br/>[RackMapView.tsx]"]
  node_roommap["Room map<br/>[RoomMap.tsx]"]
  node_rackdetail["Rack detail<br/>[RackDetail.tsx]"]
  node_slotpanel["Rack slot panel<br/>[SlotPanel.tsx]"]
  node_rackservice["Rack map service<br/>[rackMapService.ts]"]
end

subgraph group_platform["Shared services"]
  node_storage["Asset data service<br/>[storage.ts]"]
  node_supabase[("Supabase<br/>[supabase.ts]")]
  node_gasauth["User/admin service<br/>[gasAuthService.ts]"]
  node_exporter["Data exporter<br/>[gasExporter.ts]"]
  node_pagination["Pagination<br/>[Pagination.tsx]"]
  node_sound["Sound feedback<br/>[sound.ts]"]
  node_translations["Translations<br/>[translations.ts]"]
  node_machineutil["Machine labels<br/>[machineName.ts]"]
end

node_user(("User"))

node_user -->|"signs in"| node_login
node_login -->|"uses session"| node_authctx
node_authctx -->|"restores session"| node_authsvc
node_authsvc -->|"authenticates"| node_supabase
node_app -->|"checks access"| node_authctx
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_machines
node_app -->|"routes to"| node_move
node_app -->|"routes to"| node_transfers
node_app -->|"routes to"| node_opname
node_app -->|"routes to"| node_history
node_app -->|"routes to"| node_reports
node_app -->|"routes to"| node_admin
node_app -->|"routes to"| node_rackview
node_app -->|"opens scanner"| node_scanner
node_app -->|"opens details"| node_detail
node_useradmin -->|"uses access context"| node_authctx
node_useradmin -->|"manages accounts"| node_gasauth
node_gasauth -->|"invokes function"| node_adminfn
node_dashboard -->|"reads assets"| node_storage
node_machines -->|"reads assets"| node_storage
node_move -->|"moves assets"| node_storage
node_transfers -->|"updates transfers"| node_storage
node_opname -->|"records counts"| node_storage
node_history -->|"loads history"| node_gasauth
node_reports -->|"reads records"| node_storage
node_admin -->|"manages data"| node_storage
node_admin -->|"exports data"| node_exporter
node_storage -->|"reads and writes"| node_supabase
node_storage -->|"signals auth failure"| node_authsvc
node_rackview -->|"loads rack data"| node_rackservice
node_rackview -->|"renders"| node_roommap
node_rackview -->|"renders"| node_rackdetail
node_rackview -->|"renders"| node_slotpanel
node_roommap -->|"reads map data"| node_rackservice
node_rackdetail -->|"reads rack data"| node_rackservice
node_slotpanel -->|"uses rack detail"| node_rackdetail
node_rackservice -->|"moves machine"| node_storage
node_detail -->|"formats labels"| node_machineutil
node_detail -->|"reads machine records"| node_storage
node_detail -->|"uses pagination"| node_pagination
node_scanner -->|"looks up assets"| node_storage
node_scanner -->|"plays feedback"| node_sound
node_transfers -->|"localizes labels"| node_translations
node_opname -->|"plays feedback"| node_sound

click node_app "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/App.tsx"
click node_login "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/components/LoginPage.tsx"
click node_authctx "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/services/authContext.tsx"
click node_authsvc "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/services/authService.ts"
click node_useradmin "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/UserManagementView.tsx"
click node_adminfn "https://github.com/wingtm-lang/machine-asset-location/blob/main/supabase/functions/admin-users/index.ts"
click node_home "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/HomeView.tsx"
click node_dashboard "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/DashboardView.tsx"
click node_machines "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/MachinesListView.tsx"
click node_move "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/MoveView.tsx"
click node_transfers "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/TransfersView.tsx"
click node_opname "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/OpnameView.tsx"
click node_history "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/HistoryView.tsx"
click node_reports "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/ReportsView.tsx"
click node_admin "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/AdminView.tsx"
click node_scanner "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/components/ScannerModal.tsx"
click node_detail "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/components/MachineDetailModal.tsx"
click node_rackview "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/RackMapView.tsx"
click node_roommap "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/components/rackmap/RoomMap.tsx"
click node_rackdetail "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/components/rackmap/RackDetail.tsx"
click node_slotpanel "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/components/rackmap/SlotPanel.tsx"
click node_rackservice "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/services/rackMapService.ts"
click node_storage "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/services/storage.ts"
click node_supabase "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/services/supabase.ts"
click node_gasauth "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/services/gasAuthService.ts"
click node_exporter "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/services/gasExporter.ts"
click node_pagination "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/components/Pagination.tsx"
click node_sound "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/services/sound.ts"
click node_translations "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/services/translations.ts"
click node_machineutil "https://github.com/wingtm-lang/machine-asset-location/blob/main/src/utils/machineName.ts"

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_home,node_user toneBlue
class node_login,node_authctx,node_authsvc,node_useradmin,node_adminfn toneAmber
class node_dashboard,node_machines,node_move,node_transfers,node_opname,node_history,node_reports,node_admin,node_scanner,node_detail toneMint
class node_rackview,node_roommap,node_rackdetail,node_slotpanel,node_rackservice toneRose
class node_storage,node_supabase,node_gasauth,node_exporter,node_pagination,node_sound,node_translations,node_machineutil toneIndigo
```

## Components

### Application shell

- [App navigation](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/App.tsx): `src/App.tsx`
- [Home](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/HomeView.tsx): `src/views/HomeView.tsx`

### Identity and access

- [Login](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/components/LoginPage.tsx): `src/components/LoginPage.tsx`
- [Auth context](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/services/authContext.tsx): `src/services/authContext.tsx`
- [Supabase auth](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/services/authService.ts): `src/services/authService.ts`
- [User management](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/UserManagementView.tsx): `src/views/UserManagementView.tsx`
- [Admin users function](https://github.com/wingtm-lang/machine-asset-location/blob/main/supabase/functions/admin-users/index.ts): `supabase/functions/admin-users/index.ts`

### Asset operations

- [Dashboard](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/DashboardView.tsx): `src/views/DashboardView.tsx`
- [Machine inventory](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/MachinesListView.tsx): `src/views/MachinesListView.tsx`
- [Move machines](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/MoveView.tsx): `src/views/MoveView.tsx`
- [Site transfers](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/TransfersView.tsx): `src/views/TransfersView.tsx`
- [Stocktaking](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/OpnameView.tsx): `src/views/OpnameView.tsx`
- [Movement history](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/HistoryView.tsx): `src/views/HistoryView.tsx`
- [Reports](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/ReportsView.tsx): `src/views/ReportsView.tsx`
- [Administration](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/AdminView.tsx): `src/views/AdminView.tsx`
- [Barcode scanner](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/components/ScannerModal.tsx): `src/components/ScannerModal.tsx`
- [Machine details](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/components/MachineDetailModal.tsx): `src/components/MachineDetailModal.tsx`

### Warehouse mapping

- [Rack map view](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/views/RackMapView.tsx): `src/views/RackMapView.tsx`
- [Room map](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/components/rackmap/RoomMap.tsx): `src/components/rackmap/RoomMap.tsx`
- [Rack detail](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/components/rackmap/RackDetail.tsx): `src/components/rackmap/RackDetail.tsx`
- [Rack slot panel](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/components/rackmap/SlotPanel.tsx): `src/components/rackmap/SlotPanel.tsx`
- [Rack map service](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/services/rackMapService.ts): `src/services/rackMapService.ts`

### Shared services

- [Asset data service](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/services/storage.ts): `src/services/storage.ts`
- [Supabase](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/services/supabase.ts): `src/services/supabase.ts`
- [User/admin service](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/services/gasAuthService.ts): `src/services/gasAuthService.ts`
- [Data exporter](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/services/gasExporter.ts): `src/services/gasExporter.ts`
- [Pagination](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/components/Pagination.tsx): `src/components/Pagination.tsx`
- [Sound feedback](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/services/sound.ts): `src/services/sound.ts`
- [Translations](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/services/translations.ts): `src/services/translations.ts`
- [Machine labels](https://github.com/wingtm-lang/machine-asset-location/blob/main/src/utils/machineName.ts): `src/utils/machineName.ts`

### Other components

- **User**

## Connections

- User → Login: signs in
- Login → Auth context: uses session (evidence: `src/components/LoginPage.tsx`)
- Auth context → Supabase auth: restores session (evidence: `src/services/authContext.tsx`)
- Supabase auth → Supabase: authenticates (evidence: `src/services/authService.ts`)
- App navigation → Auth context: checks access (evidence: `src/App.tsx`)
- App navigation → Home: routes to (evidence: `src/App.tsx`)
- App navigation → Dashboard: routes to (evidence: `src/App.tsx`)
- App navigation → Machine inventory: routes to (evidence: `src/App.tsx`)
- App navigation → Move machines: routes to (evidence: `src/App.tsx`)
- App navigation → Site transfers: routes to (evidence: `src/App.tsx`)
- App navigation → Stocktaking: routes to (evidence: `src/App.tsx`)
- App navigation → Movement history: routes to (evidence: `src/App.tsx`)
- App navigation → Reports: routes to (evidence: `src/App.tsx`)
- App navigation → Administration: routes to (evidence: `src/App.tsx`)
- App navigation → Rack map view: routes to (evidence: `src/App.tsx`)
- App navigation → Barcode scanner: opens scanner (evidence: `src/App.tsx`)
- App navigation → Machine details: opens details (evidence: `src/App.tsx`)
- User management → Auth context: uses access context (evidence: `src/views/UserManagementView.tsx`)
- User management → User/admin service: manages accounts (evidence: `src/views/UserManagementView.tsx`)
- User/admin service → Admin users function: invokes function (evidence: `src/services/gasAuthService.ts`)
- Dashboard → Asset data service: reads assets (evidence: `src/views/DashboardView.tsx`)
- Machine inventory → Asset data service: reads assets (evidence: `src/views/MachinesListView.tsx`)
- Move machines → Asset data service: moves assets (evidence: `src/views/MoveView.tsx`)
- Site transfers → Asset data service: updates transfers (evidence: `src/views/TransfersView.tsx`)
- Stocktaking → Asset data service: records counts (evidence: `src/views/OpnameView.tsx`)
- Movement history → User/admin service: loads history (evidence: `src/views/HistoryView.tsx`)
- Reports → Asset data service: reads records (evidence: `src/views/ReportsView.tsx`)
- Administration → Asset data service: manages data (evidence: `src/views/AdminView.tsx`)
- Administration → Data exporter: exports data (evidence: `src/views/AdminView.tsx`)
- Asset data service → Supabase: reads and writes (evidence: `src/services/storage.ts`)
- Asset data service → Supabase auth: signals auth failure (evidence: `src/services/storage.ts`)
- Rack map view → Rack map service: loads rack data (evidence: `src/views/RackMapView.tsx`)
- Rack map view → Room map: renders (evidence: `src/views/RackMapView.tsx`)
- Rack map view → Rack detail: renders (evidence: `src/views/RackMapView.tsx`)
- Rack map view → Rack slot panel: renders (evidence: `src/views/RackMapView.tsx`)
- Room map → Rack map service: reads map data (evidence: `src/components/rackmap/RoomMap.tsx`)
- Rack detail → Rack map service: reads rack data (evidence: `src/components/rackmap/RackDetail.tsx`)
- Rack slot panel → Rack detail: uses rack detail (evidence: `src/components/rackmap/SlotPanel.tsx`)
- Rack map service → Asset data service: moves machine (evidence: `src/services/rackMapService.ts`)
- Machine details → Machine labels: formats labels (evidence: `src/components/MachineDetailModal.tsx`)
- Machine details → Asset data service: reads machine records (evidence: `src/components/MachineDetailModal.tsx`)
- Machine details → Pagination: uses pagination (evidence: `src/components/MachineDetailModal.tsx`)
- Barcode scanner → Asset data service: looks up assets (evidence: `src/components/ScannerModal.tsx`)
- Barcode scanner → Sound feedback: plays feedback (evidence: `src/components/ScannerModal.tsx`)
- Site transfers → Translations: localizes labels (evidence: `src/views/TransfersView.tsx`)
- Stocktaking → Sound feedback: plays feedback (evidence: `src/views/OpnameView.tsx`)
