# sripathi13/marudhamx architecture

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

- Interactive diagram: https://gitdiagram.com/sripathi13/marudhamx
- Repository: https://github.com/sripathi13/marudhamx

## Overview

MarudhamX is a perishable-produce transport planner: users enter crop, load, vehicle, origin, destination, and departure details; the backend evaluates routes and economic loss, then presents a recommendation and shipment record. The graph includes documented market, fleet, weather, carbon, calibration, and shipment-support capabilities. Some algorithm links are based on the server.ts reference list rather than inspected call sites; those links indicate backend use, not a verified call sequence.

Main entry points: [`server.ts`](https://github.com/sripathi13/marudhamx/blob/main/server.ts) (Express API), [`src/pages/ResultsPage.tsx`](https://github.com/sripathi13/marudhamx/blob/main/src/pages/ResultsPage.tsx) (Route results), [`src/services/api.ts`](https://github.com/sripathi13/marudhamx/blob/main/src/services/api.ts) (REST client), [`src/pages/PlanPage.tsx`](https://github.com/sripathi13/marudhamx/blob/main/src/pages/PlanPage.tsx) (Shipment planning)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_planning["Planning workflow"]
  node_plan["Shipment planning<br/>[PlanPage.tsx]"]
  node_api_client["REST client<br/>[api.ts]"]
  node_backend["Express API<br/>[server.ts]"]
  node_results["Route results<br/>[ResultsPage.tsx]"]
end

subgraph group_optimization["Optimization services"]
  node_routing["Road routing"]
  node_weather_api["Weather service"]
  node_weather["Weather spoilage<br/>[weatherSpoilage.ts]"]
  node_traffic["Traffic segments<br/>[trafficSegments.ts]"]
  node_cost_loss["Cost and loss<br/>[costLoss.ts]"]
  node_fleet["Fleet allocation<br/>[vrp.ts]"]
  node_markets["Market intelligence<br/>[mandi.ts]"]
  node_departure["Departure optimizer"]
  node_backhaul["Backhaul planning<br/>[backhaul.ts]"]
  node_calibration["Spoilage calibration<br/>[calibration.ts]"]
  node_carbon["Carbon estimates<br/>[carbon.ts]"]
end

subgraph group_shipment["Shipment operations"]
  node_history["Shipment history<br/>[HistoryPage.tsx]"]
  node_settings["App settings<br/>[SettingsPage.tsx]"]
  node_shipment_timeline["Shipment timeline"]
  node_shipment_store[("Shipment records")]
end

subgraph group_experience["User experience"]
  node_map["Route map<br/>[LeafletMap.tsx]"]
  node_speed["Speed advisory"]
  node_cold_chain["Cold-chain advice<br/>[ColdChainCard.tsx]"]
  node_carbon_card["Carbon display"]
  node_localization["Localization<br/>[i18n.ts]"]
end

node_grower(("Planner"))

node_grower -->|"enters shipment"| node_plan
node_plan -->|"submits plan"| node_api_client
node_api_client -->|"sends REST request"| node_backend
node_backend -->|"requests routes"| node_routing
node_backend -->|"generates segments"| node_traffic
node_backend -->|"fetches weather"| node_weather_api
node_backend -->|"calculates spoilage"| node_weather
node_backend -->|"uses cost model"| node_cost_loss
node_backend -->|"uses routing allocation"| node_fleet
node_backend -->|"uses market model"| node_markets
node_backend -->|"uses optimizer"| node_departure
node_backend -->|"uses backhaul model"| node_backhaul
node_backend -->|"uses calibration"| node_calibration
node_backend -->|"uses carbon model"| node_carbon
node_results -->|"loads shipment"| node_api_client
node_results -->|"renders routes"| node_map
node_results -->|"shows advisory"| node_speed
node_history -->|"loads history"| node_api_client
node_settings -->|"reads settings"| node_api_client
node_backend -.->|"persists records"| node_shipment_store
node_results -.->|"shows timeline"| node_shipment_timeline
node_results -.->|"shows cold-chain advice"| node_cold_chain
node_results -->|"shows carbon estimate"| node_carbon_card
node_carbon_card -->|"reads estimate"| node_carbon
node_speed -->|"uses interpolation"| node_traffic
node_plan -->|"translates interface"| node_localization
node_settings -->|"sets language"| node_localization
node_backend -->|"requests forecasts"| node_weather_api

click node_plan "https://github.com/sripathi13/marudhamx/blob/main/src/pages/PlanPage.tsx"
click node_api_client "https://github.com/sripathi13/marudhamx/blob/main/src/services/api.ts"
click node_backend "https://github.com/sripathi13/marudhamx/blob/main/server.ts"
click node_weather "https://github.com/sripathi13/marudhamx/blob/main/src/algorithms/weatherSpoilage.ts"
click node_traffic "https://github.com/sripathi13/marudhamx/blob/main/src/utils/trafficSegments.ts"
click node_cost_loss "https://github.com/sripathi13/marudhamx/blob/main/src/algorithms/costLoss.ts"
click node_fleet "https://github.com/sripathi13/marudhamx/blob/main/src/algorithms/vrp.ts"
click node_markets "https://github.com/sripathi13/marudhamx/blob/main/src/algorithms/mandi.ts"
click node_departure "https://github.com/sripathi13/marudhamx/blob/main/src/algorithms/departureOptimizer.ts"
click node_backhaul "https://github.com/sripathi13/marudhamx/blob/main/src/algorithms/backhaul.ts"
click node_calibration "https://github.com/sripathi13/marudhamx/blob/main/src/algorithms/calibration.ts"
click node_carbon "https://github.com/sripathi13/marudhamx/blob/main/src/algorithms/carbon.ts"
click node_results "https://github.com/sripathi13/marudhamx/blob/main/src/pages/ResultsPage.tsx"
click node_map "https://github.com/sripathi13/marudhamx/blob/main/src/components/LeafletMap.tsx"
click node_speed "https://github.com/sripathi13/marudhamx/blob/main/src/components/SpeedAdvisoryCard.tsx"
click node_history "https://github.com/sripathi13/marudhamx/blob/main/src/pages/HistoryPage.tsx"
click node_settings "https://github.com/sripathi13/marudhamx/blob/main/src/pages/SettingsPage.tsx"
click node_shipment_timeline "https://github.com/sripathi13/marudhamx/blob/main/src/components/ShipmentTimelineCard.tsx"
click node_cold_chain "https://github.com/sripathi13/marudhamx/blob/main/src/components/ColdChainCard.tsx"
click node_carbon_card "https://github.com/sripathi13/marudhamx/blob/main/src/components/CarbonEstimateCard.tsx"
click node_localization "https://github.com/sripathi13/marudhamx/blob/main/src/i18n.ts"
click node_shipment_store "https://github.com/sripathi13/marudhamx/blob/main/shipments_store.json"

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_plan,node_api_client,node_backend,node_results toneBlue
class node_routing,node_weather_api,node_weather,node_traffic,node_cost_loss,node_fleet,node_markets,node_departure,node_backhaul,node_calibration,node_carbon toneAmber
class node_history,node_settings,node_shipment_timeline,node_shipment_store toneMint
class node_map,node_speed,node_cold_chain,node_carbon_card,node_localization toneRose
class node_grower toneIndigo
```

## Components

### Planning workflow

- [Shipment planning](https://github.com/sripathi13/marudhamx/blob/main/src/pages/PlanPage.tsx): `src/pages/PlanPage.tsx`
- [REST client](https://github.com/sripathi13/marudhamx/blob/main/src/services/api.ts): `src/services/api.ts`
- [Express API](https://github.com/sripathi13/marudhamx/blob/main/server.ts): `server.ts`
- [Route results](https://github.com/sripathi13/marudhamx/blob/main/src/pages/ResultsPage.tsx): `src/pages/ResultsPage.tsx`

### Optimization services

- **Road routing**
- **Weather service**
- [Weather spoilage](https://github.com/sripathi13/marudhamx/blob/main/src/algorithms/weatherSpoilage.ts): `src/algorithms/weatherSpoilage.ts`
- [Traffic segments](https://github.com/sripathi13/marudhamx/blob/main/src/utils/trafficSegments.ts): `src/utils/trafficSegments.ts`
- [Cost and loss](https://github.com/sripathi13/marudhamx/blob/main/src/algorithms/costLoss.ts): `src/algorithms/costLoss.ts`
- [Fleet allocation](https://github.com/sripathi13/marudhamx/blob/main/src/algorithms/vrp.ts): `src/algorithms/vrp.ts`
- [Market intelligence](https://github.com/sripathi13/marudhamx/blob/main/src/algorithms/mandi.ts): `src/algorithms/mandi.ts`
- [Departure optimizer](https://github.com/sripathi13/marudhamx/blob/main/src/algorithms/departureOptimizer.ts): `src/algorithms/departureOptimizer.ts`
- [Backhaul planning](https://github.com/sripathi13/marudhamx/blob/main/src/algorithms/backhaul.ts): `src/algorithms/backhaul.ts`
- [Spoilage calibration](https://github.com/sripathi13/marudhamx/blob/main/src/algorithms/calibration.ts): `src/algorithms/calibration.ts`
- [Carbon estimates](https://github.com/sripathi13/marudhamx/blob/main/src/algorithms/carbon.ts): `src/algorithms/carbon.ts`

### Shipment operations

- [Shipment history](https://github.com/sripathi13/marudhamx/blob/main/src/pages/HistoryPage.tsx): `src/pages/HistoryPage.tsx`
- [App settings](https://github.com/sripathi13/marudhamx/blob/main/src/pages/SettingsPage.tsx): `src/pages/SettingsPage.tsx`
- [Shipment timeline](https://github.com/sripathi13/marudhamx/blob/main/src/components/ShipmentTimelineCard.tsx): `src/components/ShipmentTimelineCard.tsx`
- [Shipment records](https://github.com/sripathi13/marudhamx/blob/main/shipments_store.json): `shipments_store.json`

### User experience

- [Route map](https://github.com/sripathi13/marudhamx/blob/main/src/components/LeafletMap.tsx): `src/components/LeafletMap.tsx`
- [Speed advisory](https://github.com/sripathi13/marudhamx/blob/main/src/components/SpeedAdvisoryCard.tsx): `src/components/SpeedAdvisoryCard.tsx`
- [Cold-chain advice](https://github.com/sripathi13/marudhamx/blob/main/src/components/ColdChainCard.tsx): `src/components/ColdChainCard.tsx`
- [Carbon display](https://github.com/sripathi13/marudhamx/blob/main/src/components/CarbonEstimateCard.tsx): `src/components/CarbonEstimateCard.tsx`
- [Localization](https://github.com/sripathi13/marudhamx/blob/main/src/i18n.ts): `src/i18n.ts`

### Other components

- **Planner**

## Connections

- Planner → Shipment planning: enters shipment (evidence: `README.md`)
- Shipment planning → REST client: submits plan (evidence: `src/pages/PlanPage.tsx`)
- REST client → Express API: sends REST request (evidence: `src/services/api.ts`)
- Express API → Road routing: requests routes (evidence: `README.md`)
- Express API → Traffic segments: generates segments (evidence: `server.ts`)
- Express API → Weather service: fetches weather (evidence: `server.ts`)
- Express API → Weather spoilage: calculates spoilage (evidence: `server.ts`)
- Express API → Cost and loss: uses cost model (evidence: `server.ts`)
- Express API → Fleet allocation: uses routing allocation (evidence: `server.ts`)
- Express API → Market intelligence: uses market model (evidence: `server.ts`)
- Express API → Departure optimizer: uses optimizer (evidence: `server.ts`)
- Express API → Backhaul planning: uses backhaul model (evidence: `server.ts`)
- Express API → Spoilage calibration: uses calibration (evidence: `server.ts`)
- Express API → Carbon estimates: uses carbon model (evidence: `server.ts`)
- Route results → REST client: loads shipment (evidence: `src/pages/ResultsPage.tsx`)
- Route results → Route map: renders routes (evidence: `src/pages/ResultsPage.tsx`)
- Route results → Speed advisory: shows advisory (evidence: `src/pages/ResultsPage.tsx`)
- Shipment history → REST client: loads history (evidence: `src/pages/HistoryPage.tsx`)
- App settings → REST client: reads settings (evidence: `src/pages/SettingsPage.tsx`)
- Express API → Shipment records: persists records
- Route results → Shipment timeline: shows timeline
- Route results → Cold-chain advice: shows cold-chain advice
- Route results → Carbon display: shows carbon estimate (evidence: `src/components/CarbonEstimateCard.tsx`)
- Carbon display → Carbon estimates: reads estimate (evidence: `src/components/CarbonEstimateCard.tsx`)
- Speed advisory → Traffic segments: uses interpolation
- Shipment planning → Localization: translates interface (evidence: `src/pages/PlanPage.tsx`)
- App settings → Localization: sets language (evidence: `src/pages/SettingsPage.tsx`)
- Express API → Weather service: requests forecasts (evidence: `README.md`)
