How agnare/waretwin works
WareTwin is a warehouse digital twin: a Python simulator updates warehouse operations, FastAPI exposes snapshots and events, and a React/Three.js client presents live operations. The main workflow runs from the simulation tick through persisted state and a WebSocket snapshot to the dashboard. Distinct product branches include shipment and inbound operations, inventory and analytics, alerts/events, authentication, and synthetic-camera data generation with CV detection. Relationships are limited to those shown in the excerpts, SOURCE INDEX, or README; unsampled subsystems are represented by their exact tree paths.
Main entry points: App.tsx Dashboard router · main.py FastAPI services · cv.py Detection endpoints · CaptureApp.tsx Camera capture screen
Components 27
Warehouse operations
- Warehouse simulator
backend/app/sim/engine.py - Warehouse domain model
backend/app/models.py
Backend services
- SQL database
backend/app/db.py - FastAPI services
backend/app/main.py - State and event API
backend/app/api/routes.py - Actions and alerts
backend/app/api - Authentication and users
backend/app/api/auth.py - Roles and tokens
backend/app/auth.py
Dashboard and 3D
- Shipment operations
frontend/src/pages/Shipments.tsx - Inbound operations
frontend/src/pages/Inbound.tsx - Inventory
frontend/src/pages/Inventory.tsx - KPIs and analytics
frontend/src/pages/Analytics.tsx - Alerts and event log
frontend/src/pages - Site comparison
frontend/src/pages/Sites.tsx - Login and user admin
frontend/src/auth.ts - Dashboard router
frontend/src/App.tsx - Live state subscription
frontend/src/useTwin.ts - HTTP and WS client
frontend/src/api.ts - Warehouse 3D scene
frontend/src/scene
Camera and vision
- Camera capture screen
frontend/src/capture/CaptureApp.tsx - Dataset endpoints
backend/app/api/dataset.py - Detection endpoints
backend/app/api/cv.py - Object detector
backend/app/cv/detector.py - Dock zone matching
backend/app/cv/zones.py - Object tracking
backend/app/cv/tracker.py
Other components
- Warehouse operator
- Browser
Connections 32
- Warehouse operator → Dashboard router: uses
README.md - Dashboard router → Live state subscription: subscribes through
frontend/src/App.tsx - Live state subscription → HTTP and WS client: uses URLs
frontend/src/useTwin.ts - Live state subscription → FastAPI services: loads snapshots
frontend/src/useTwin.ts - FastAPI services → Live state subscription: broadcasts snapshots
backend/app/main.py - FastAPI services → Warehouse simulator: ticks and snapshots
backend/app/main.py - Warehouse simulator → Warehouse domain model: updates state
backend/app/sim/engine.py - SQL database → Warehouse domain model: maps entities
backend/app/db.py - State and event API → Warehouse simulator: builds snapshots
backend/app/api/routes.py - State and event API → SQL database: queries state
backend/app/api/routes.py - Actions and alerts → SQL database: reads and writes
backend/app/api/actions.py - Authentication and users → Roles and tokens: uses token roles
backend/app/api/auth.py - Authentication and users → SQL database: manages users
backend/app/api/auth.py - Dashboard router → Shipment operations: routes to
frontend/src/App.tsx - Dashboard router → Inbound operations: routes to
frontend/src/App.tsx - Dashboard router → Inventory: routes to
frontend/src/App.tsx - Dashboard router → KPIs and analytics: routes to
frontend/src/App.tsx - Dashboard router → Alerts and event log: routes to
frontend/src/App.tsx - Dashboard router → Site comparison: routes to
frontend/src/App.tsx - Dashboard router → Login and user admin: checks session
frontend/src/App.tsx - Shipment operations → FastAPI services: requests operations
- Inbound operations → FastAPI services: requests operations
- Warehouse 3D scene → FastAPI services: renders snapshots
README.md - Camera capture screen → Warehouse 3D scene: renders scene objects
frontend/src/capture/CaptureApp.tsx - Camera capture screen → Live state subscription: reads live state
frontend/src/capture/CaptureApp.tsx - Camera capture screen → Dataset endpoints: saves labeled frames
README.md - Camera capture screen → Detection endpoints: requests detection
README.md - Detection endpoints → Object detector: runs inference
backend/app/api/cv.py - Detection endpoints → Dock zone matching: matches dock zones
backend/app/api/cv.py - Detection endpoints → Object tracking: uses tracking
backend/app/api/cv.py - Detection endpoints → SQL database: logs events
backend/app/api/cv.py - Browser → Camera capture screen: opens camera mode
README.md