# harigovind-2006/mainproject architecture

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

- Interactive diagram: https://gitdiagram.com/harigovind-2006/mainproject
- Repository: https://github.com/harigovind-2006/mainproject

## Overview

AgriTrack monitors autonomous farm rovers, compares telemetry with a planned route, estimates schedule drift, and returns speed corrections; users inspect fleet state and analytics in a protected dashboard. The backend owns route/progress calculations and per-vehicle digital twins, while a browser-based rover simulator provides a visual, physics-driven telemetry source. The README documents REST/WebSocket, authentication, database, and correction capabilities; some implementation details for unsampled modules are therefore shown only at subsystem level.

Main entry points: [`rover-simulator-sandbox/src/main.js`](https://github.com/harigovind-2006/mainproject/blob/main/rover-simulator-sandbox/src/main.js) (Simulator Application), [`frontend/app/dashboard/page.tsx`](https://github.com/harigovind-2006/mainproject/blob/main/frontend/app/dashboard/page.tsx) (Fleet Dashboard), [`backend/main.py`](https://github.com/harigovind-2006/mainproject/blob/main/backend/main.py) (API and WebSocket), [`backend/connection_manager.py`](https://github.com/harigovind-2006/mainproject/blob/main/backend/connection_manager.py) (Connection Manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Dashboard"]
  node_store["Fleet Data Store<br/>[useFleetStore.ts]"]
  node_dashboard["Fleet Dashboard<br/>[page.tsx]"]
  node_fleetview["Fleet Table<br/>[FleetTable.tsx]"]
  node_routeview["Route Map<br/>[RouteMapSVG.tsx]"]
  node_telemetryview["Telemetry Charts"]
  node_twinview["Digital Twin Panel"]
  node_benchmarkview["Benchmark Panel<br/>[BenchmarkPanel.tsx]"]
  node_types["Fleet Data Types<br/>[types.ts]"]
end

subgraph group_backend["Fleet Backend"]
  node_api["API and WebSocket<br/>[main.py]"]
  node_manager["Connection Manager"]
  node_twin["Vehicle Twin<br/>[vehicle_twin.py]"]
  node_progress["Progress and ETA<br/>[progress_engine.py]"]
  node_route["Route Model<br/>[route_model.py]"]
  node_speed["Speed Correction"]
  node_trajectory["Trajectory Correction"]
  node_fleet_sim["Fleet Simulator<br/>[fleet_simulator.py]"]
  node_rover_client["Rover Client<br/>[rover_client.py]"]
end

subgraph group_simulation["Rover Simulation"]
  node_physics["Rover Physics<br/>[physicsEngine.js]"]
  node_sandbox["Simulator Application<br/>[main.js]"]
  node_sandbox_route["Sandbox Route<br/>[routeManager.js]"]
  node_rover_model["3D Rover Model<br/>[roverModel.js]"]
  node_environment["Field Environment"]
  node_camera["Camera Controls<br/>[cameraManager.js]"]
  node_hud["Simulator HUD<br/>[hudOverlay.js]"]
  node_audio["Simulator Audio<br/>[audio.js]"]
  node_bios["Boot Console<br/>[biosConsole.js]"]
  node_wsbridge["Telemetry Bridge<br/>[wsBridge.js]"]
end

subgraph group_identity["Identity and Storage"]
  node_login["Login and Register<br/>[page.tsx]"]
  node_auth["JWT Authentication<br/>[auth.py]"]
  node_database[("User Store<br/>[mongo_client.py]")]
end

node_operator(("Operator"))
node_mongodb[("MongoDB Atlas")]
node_vehicle(("Physical Rover"))

node_operator -->|"signs in"| node_login
node_login -->|"authenticates via REST"| node_api
node_api -->|"validates tokens"| node_auth
node_auth -->|"reads user records"| node_database
node_database -.->|"uses when configured"| node_mongodb
node_operator -->|"views fleet"| node_dashboard
node_dashboard -->|"uses fleet state"| node_store
node_store -->|"uses data types"| node_types
node_store -->|"fetches and streams"| node_api
node_dashboard -->|"renders"| node_fleetview
node_dashboard -->|"renders"| node_routeview
node_dashboard -->|"renders"| node_telemetryview
node_dashboard -->|"renders"| node_twinview
node_dashboard -->|"renders"| node_benchmarkview
node_api -->|"routes fleet operations"| node_manager
node_manager -->|"updates twin telemetry"| node_twin
node_twin -->|"computes progress"| node_progress
node_progress -->|"uses route estimates"| node_route
node_manager -->|"requests speed correction"| node_speed
node_manager -->|"applies trajectory correction"| node_trajectory
node_api -->|"controls simulation"| node_fleet_sim
node_fleet_sim -->|"submits telemetry"| node_manager
node_vehicle -.->|"provides telemetry"| node_wsbridge
node_sandbox -->|"sends telemetry"| node_wsbridge
node_wsbridge -->|"streams telemetry"| node_api
node_api -->|"returns corrections"| node_wsbridge
node_wsbridge -->|"delivers feedback"| node_physics
node_sandbox -->|"updates simulation"| node_physics
node_sandbox -->|"initializes route"| node_sandbox_route
node_sandbox -->|"creates rover model"| node_rover_model
node_sandbox -->|"creates field"| node_environment
node_sandbox -->|"initializes camera"| node_camera
node_sandbox -->|"initializes HUD"| node_hud
node_sandbox -->|"starts boot console"| node_bios
node_hud -->|"uses audio"| node_audio

click node_login "https://github.com/harigovind-2006/mainproject/blob/main/frontend/app/login/page.tsx"
click node_api "https://github.com/harigovind-2006/mainproject/blob/main/backend/main.py"
click node_auth "https://github.com/harigovind-2006/mainproject/blob/main/backend/auth.py"
click node_database "https://github.com/harigovind-2006/mainproject/blob/main/backend/db/mongo_client.py"
click node_store "https://github.com/harigovind-2006/mainproject/blob/main/frontend/lib/useFleetStore.ts"
click node_dashboard "https://github.com/harigovind-2006/mainproject/blob/main/frontend/app/dashboard/page.tsx"
click node_fleetview "https://github.com/harigovind-2006/mainproject/blob/main/frontend/app/components/FleetTable.tsx"
click node_routeview "https://github.com/harigovind-2006/mainproject/blob/main/frontend/app/components/RouteMapSVG.tsx"
click node_telemetryview "https://github.com/harigovind-2006/mainproject/blob/main/frontend/app/components/TelemetryChartSVG.tsx"
click node_twinview "https://github.com/harigovind-2006/mainproject/blob/main/frontend/app/components/DigitalTwinPanel.tsx"
click node_benchmarkview "https://github.com/harigovind-2006/mainproject/blob/main/frontend/app/components/BenchmarkPanel.tsx"
click node_types "https://github.com/harigovind-2006/mainproject/blob/main/frontend/lib/types.ts"
click node_manager "https://github.com/harigovind-2006/mainproject/blob/main/backend/connection_manager.py"
click node_twin "https://github.com/harigovind-2006/mainproject/blob/main/backend/vehicle_twin.py"
click node_progress "https://github.com/harigovind-2006/mainproject/blob/main/backend/progress_engine.py"
click node_route "https://github.com/harigovind-2006/mainproject/blob/main/backend/route_model.py"
click node_speed "https://github.com/harigovind-2006/mainproject/blob/main/backend/speed_correction.py"
click node_trajectory "https://github.com/harigovind-2006/mainproject/blob/main/backend/trajectory_correction.py"
click node_fleet_sim "https://github.com/harigovind-2006/mainproject/blob/main/backend/fleet_simulator.py"
click node_rover_client "https://github.com/harigovind-2006/mainproject/blob/main/backend/rover_client.py"
click node_physics "https://github.com/harigovind-2006/mainproject/blob/main/rover-simulator-sandbox/src/physicsEngine.js"
click node_sandbox "https://github.com/harigovind-2006/mainproject/blob/main/rover-simulator-sandbox/src/main.js"
click node_sandbox_route "https://github.com/harigovind-2006/mainproject/blob/main/rover-simulator-sandbox/src/routeManager.js"
click node_rover_model "https://github.com/harigovind-2006/mainproject/blob/main/rover-simulator-sandbox/src/roverModel.js"
click node_environment "https://github.com/harigovind-2006/mainproject/blob/main/rover-simulator-sandbox/src/fieldEnvironment.js"
click node_camera "https://github.com/harigovind-2006/mainproject/blob/main/rover-simulator-sandbox/src/cameraManager.js"
click node_hud "https://github.com/harigovind-2006/mainproject/blob/main/rover-simulator-sandbox/src/hudOverlay.js"
click node_audio "https://github.com/harigovind-2006/mainproject/blob/main/rover-simulator-sandbox/src/audio.js"
click node_bios "https://github.com/harigovind-2006/mainproject/blob/main/rover-simulator-sandbox/src/biosConsole.js"
click node_wsbridge "https://github.com/harigovind-2006/mainproject/blob/main/rover-simulator-sandbox/src/wsBridge.js"

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_store,node_dashboard,node_fleetview,node_routeview,node_telemetryview,node_twinview,node_benchmarkview,node_types toneBlue
class node_api,node_manager,node_twin,node_progress,node_route,node_speed,node_trajectory,node_fleet_sim,node_rover_client,node_mongodb toneAmber
class node_physics,node_sandbox,node_sandbox_route,node_rover_model,node_environment,node_camera,node_hud,node_audio,node_bios,node_wsbridge toneMint
class node_login,node_auth,node_database toneRose
class node_operator,node_vehicle toneIndigo
```

## Components

### Dashboard

- [Fleet Data Store](https://github.com/harigovind-2006/mainproject/blob/main/frontend/lib/useFleetStore.ts): `frontend/lib/useFleetStore.ts`
- [Fleet Dashboard](https://github.com/harigovind-2006/mainproject/blob/main/frontend/app/dashboard/page.tsx): `frontend/app/dashboard/page.tsx`
- [Fleet Table](https://github.com/harigovind-2006/mainproject/blob/main/frontend/app/components/FleetTable.tsx): `frontend/app/components/FleetTable.tsx`
- [Route Map](https://github.com/harigovind-2006/mainproject/blob/main/frontend/app/components/RouteMapSVG.tsx): `frontend/app/components/RouteMapSVG.tsx`
- [Telemetry Charts](https://github.com/harigovind-2006/mainproject/blob/main/frontend/app/components/TelemetryChartSVG.tsx): `frontend/app/components/TelemetryChartSVG.tsx`
- [Digital Twin Panel](https://github.com/harigovind-2006/mainproject/blob/main/frontend/app/components/DigitalTwinPanel.tsx): `frontend/app/components/DigitalTwinPanel.tsx`
- [Benchmark Panel](https://github.com/harigovind-2006/mainproject/blob/main/frontend/app/components/BenchmarkPanel.tsx): `frontend/app/components/BenchmarkPanel.tsx`
- [Fleet Data Types](https://github.com/harigovind-2006/mainproject/blob/main/frontend/lib/types.ts): `frontend/lib/types.ts`

### Fleet Backend

- [API and WebSocket](https://github.com/harigovind-2006/mainproject/blob/main/backend/main.py): `backend/main.py`
- [Connection Manager](https://github.com/harigovind-2006/mainproject/blob/main/backend/connection_manager.py): `backend/connection_manager.py`
- [Vehicle Twin](https://github.com/harigovind-2006/mainproject/blob/main/backend/vehicle_twin.py): `backend/vehicle_twin.py`
- [Progress and ETA](https://github.com/harigovind-2006/mainproject/blob/main/backend/progress_engine.py): `backend/progress_engine.py`
- [Route Model](https://github.com/harigovind-2006/mainproject/blob/main/backend/route_model.py): `backend/route_model.py`
- [Speed Correction](https://github.com/harigovind-2006/mainproject/blob/main/backend/speed_correction.py): `backend/speed_correction.py`
- [Trajectory Correction](https://github.com/harigovind-2006/mainproject/blob/main/backend/trajectory_correction.py): `backend/trajectory_correction.py`
- [Fleet Simulator](https://github.com/harigovind-2006/mainproject/blob/main/backend/fleet_simulator.py): `backend/fleet_simulator.py`
- [Rover Client](https://github.com/harigovind-2006/mainproject/blob/main/backend/rover_client.py): `backend/rover_client.py`

### Rover Simulation

- [Rover Physics](https://github.com/harigovind-2006/mainproject/blob/main/rover-simulator-sandbox/src/physicsEngine.js): `rover-simulator-sandbox/src/physicsEngine.js`
- [Simulator Application](https://github.com/harigovind-2006/mainproject/blob/main/rover-simulator-sandbox/src/main.js): `rover-simulator-sandbox/src/main.js`
- [Sandbox Route](https://github.com/harigovind-2006/mainproject/blob/main/rover-simulator-sandbox/src/routeManager.js): `rover-simulator-sandbox/src/routeManager.js`
- [3D Rover Model](https://github.com/harigovind-2006/mainproject/blob/main/rover-simulator-sandbox/src/roverModel.js): `rover-simulator-sandbox/src/roverModel.js`
- [Field Environment](https://github.com/harigovind-2006/mainproject/blob/main/rover-simulator-sandbox/src/fieldEnvironment.js): `rover-simulator-sandbox/src/fieldEnvironment.js`
- [Camera Controls](https://github.com/harigovind-2006/mainproject/blob/main/rover-simulator-sandbox/src/cameraManager.js): `rover-simulator-sandbox/src/cameraManager.js`
- [Simulator HUD](https://github.com/harigovind-2006/mainproject/blob/main/rover-simulator-sandbox/src/hudOverlay.js): `rover-simulator-sandbox/src/hudOverlay.js`
- [Simulator Audio](https://github.com/harigovind-2006/mainproject/blob/main/rover-simulator-sandbox/src/audio.js): `rover-simulator-sandbox/src/audio.js`
- [Boot Console](https://github.com/harigovind-2006/mainproject/blob/main/rover-simulator-sandbox/src/biosConsole.js): `rover-simulator-sandbox/src/biosConsole.js`
- [Telemetry Bridge](https://github.com/harigovind-2006/mainproject/blob/main/rover-simulator-sandbox/src/wsBridge.js): `rover-simulator-sandbox/src/wsBridge.js`

### Identity and Storage

- [Login and Register](https://github.com/harigovind-2006/mainproject/blob/main/frontend/app/login/page.tsx): `frontend/app/login/page.tsx`
- [JWT Authentication](https://github.com/harigovind-2006/mainproject/blob/main/backend/auth.py): `backend/auth.py`
- [User Store](https://github.com/harigovind-2006/mainproject/blob/main/backend/db/mongo_client.py): `backend/db/mongo_client.py`

### Other components

- **Operator**
- **MongoDB Atlas**
- **Physical Rover**

## Connections

- Operator → Login and Register: signs in
- Login and Register → API and WebSocket: authenticates via REST
- API and WebSocket → JWT Authentication: validates tokens (evidence: `backend/main.py`)
- JWT Authentication → User Store: reads user records (evidence: `backend/auth.py`)
- User Store → MongoDB Atlas: uses when configured (evidence: `backend/db/mongo_client.py`)
- Operator → Fleet Dashboard: views fleet
- Fleet Dashboard → Fleet Data Store: uses fleet state (evidence: `frontend/app/dashboard/page.tsx`)
- Fleet Data Store → Fleet Data Types: uses data types (evidence: `frontend/lib/useFleetStore.ts`)
- Fleet Data Store → API and WebSocket: fetches and streams (evidence: `frontend/lib/useFleetStore.ts`)
- Fleet Dashboard → Fleet Table: renders (evidence: `frontend/app/dashboard/page.tsx`)
- Fleet Dashboard → Route Map: renders (evidence: `frontend/app/dashboard/page.tsx`)
- Fleet Dashboard → Telemetry Charts: renders (evidence: `frontend/app/dashboard/page.tsx`)
- Fleet Dashboard → Digital Twin Panel: renders (evidence: `frontend/app/dashboard/page.tsx`)
- Fleet Dashboard → Benchmark Panel: renders (evidence: `frontend/app/dashboard/page.tsx`)
- API and WebSocket → Connection Manager: routes fleet operations (evidence: `backend/main.py`)
- Connection Manager → Vehicle Twin: updates twin telemetry (evidence: `backend/connection_manager.py`)
- Vehicle Twin → Progress and ETA: computes progress (evidence: `backend/vehicle_twin.py`)
- Progress and ETA → Route Model: uses route estimates (evidence: `backend/progress_engine.py`)
- Connection Manager → Speed Correction: requests speed correction (evidence: `backend/connection_manager.py`)
- Connection Manager → Trajectory Correction: applies trajectory correction (evidence: `backend/connection_manager.py`)
- API and WebSocket → Fleet Simulator: controls simulation (evidence: `backend/main.py`)
- Fleet Simulator → Connection Manager: submits telemetry (evidence: `backend/fleet_simulator.py`)
- Physical Rover → Telemetry Bridge: provides telemetry
- Simulator Application → Telemetry Bridge: sends telemetry (evidence: `rover-simulator-sandbox/src/main.js`)
- Telemetry Bridge → API and WebSocket: streams telemetry
- API and WebSocket → Telemetry Bridge: returns corrections
- Telemetry Bridge → Rover Physics: delivers feedback (evidence: `rover-simulator-sandbox/src/physicsEngine.js`)
- Simulator Application → Rover Physics: updates simulation (evidence: `rover-simulator-sandbox/src/main.js`)
- Simulator Application → Sandbox Route: initializes route (evidence: `rover-simulator-sandbox/src/main.js`)
- Simulator Application → 3D Rover Model: creates rover model (evidence: `rover-simulator-sandbox/src/main.js`)
- Simulator Application → Field Environment: creates field (evidence: `rover-simulator-sandbox/src/main.js`)
- Simulator Application → Camera Controls: initializes camera (evidence: `rover-simulator-sandbox/src/main.js`)
- Simulator Application → Simulator HUD: initializes HUD (evidence: `rover-simulator-sandbox/src/main.js`)
- Simulator Application → Boot Console: starts boot console (evidence: `rover-simulator-sandbox/src/main.js`)
- Simulator HUD → Simulator Audio: uses audio (evidence: `rover-simulator-sandbox/src/hudOverlay.js`)
