How sk6594246/shelftrack works
Inventory Tracker is a mobile-friendly inventory PWA. Users browse and maintain products, scan configurable QR/barcodes to find or prefill products, and manage stock through receiving, picking, location mapping, and inventory documents. The sampled code confirms the routed app shell, product hook/store access, document posting effects, location/layout actions, and cloud API options. Several page implementations and the local/cloud selection logic were not sampled, so those links are omitted where their ownership cannot be verified.
Main entry points: App.tsx Route and shell · inventoryStore.ts Inventory store · Scan.tsx Scan workflow · documentsStore.ts Document operations
Components 29
App experience
- Route and shell
src/App.tsx - Dashboard
src/pages/Dashboard.tsx - Inventory list
src/pages/Inventory.tsx - Product detail
src/pages/ProductDetail.tsx - Product form
src/pages/ProductForm.tsx - Service worker
public/sw.js
QR workflow
- Camera scanner
src/components/scanner/QRScanner.tsx - Scan workflow
src/pages/Scan.tsx - QR interpretation
src/lib/qr.ts - QR field mapping
src/pages/settings/QRMapping.tsx - QR mapping hook
src/hooks/useQRMapping.ts
Stock operations
- Document detail
src/pages/documents/DocumentDetail.tsx - Document operations
src/store/documentsStore.ts - Receive dock
src/pages/ReceiveDock.tsx - Pick list
src/pages/PickList.tsx - Stock map
src/pages/StockMap.tsx - Master data
src/pages/masters/Masters.tsx
Data and sync
- Product hook
src/hooks/useProducts.ts - Inventory store
src/store/inventoryStore.ts - Stock batches
src/store/stockBatchStore.ts - Backend API client
src/lib/gasApi.ts - D1 API client
src/lib/d1Api.ts - D1 API worker
worker/src/index.ts - D1 database
worker/src/actions.ts
Other components
- Inventory user
- Configured cloud backend
- Device camera
Connections 35
- Inventory user → Route and shell: uses
- Route and shell → Dashboard: routes
- Route and shell → Inventory list: routes
- Route and shell → Product detail: routes
- Route and shell → Product form: routes
- Route and shell → Scan workflow: routes
- Route and shell → Receive dock: routes
- Route and shell → Pick list: routes
- Route and shell → Stock map: routes
- Route and shell → Document detail: routes
- Route and shell → Master data: routes
- Route and shell → Settings: routes
- Route and shell → Login: routes
- Inventory list → Product hook: loads products
- Product hook → Inventory store: reads and writes
- Scan workflow → Camera scanner: scans code
- Device camera → Camera scanner: provides image
- Scan workflow → QR interpretation: interprets payload
- Scan workflow → QR mapping hook: loads mapping
- QR mapping hook → Inventory store: reads and saves mapping
- QR field mapping → QR mapping hook: updates mapping
- Document detail → Document operations: manages documents
- Document operations → Inventory store: adjusts stock
- Document operations → Stock batches: receives batches
- Stock map → Inventory store: loads products
- Stock map → Stock batches: reads quantities
- Master data → Inventory store: loads products
- Receive dock → Document operations: creates receiving work
- Pick list → Document detail: opens pick workflow
- Settings → Backend API client: ensures tenant
- Backend API client → Configured cloud backend: requests backend
- D1 API client → D1 API worker: posts actions
- D1 API worker → D1 database: dispatches actions
- D1 API worker → Configured cloud backend: uses configured D1
- Route and shell → Service worker: registers