# jak60/mantrana architecture

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

- Interactive diagram: https://gitdiagram.com/jak60/mantrana
- Repository: https://github.com/jak60/mantrana

## Overview

This is a maritime operations frontend combining geospatial awareness with ship-maintenance analysis and mission planning. The principal workflow is to explore operational map data and enrich map locations with environmental and seabed information; other product branches support ship queries, mission-reliability evaluation, and historical imagery comparison. The map hook’s enrichment calls and the query view’s result rendering are visible in sampled source. Several other screens and their wiring are evident only from the file tree, so uncertain links are omitted.

Main entry points: [`frontend/hooks/useGlobeMapEngine.ts`](https://github.com/jak60/mantrana/blob/main/frontend/hooks/useGlobeMapEngine.ts) (Map engine), [`frontend/components/ship/views/QueryView.tsx`](https://github.com/jak60/mantrana/blob/main/frontend/components/ship/views/QueryView.tsx) (Ship query), [`frontend/components/map/route/RouteCompareView.tsx`](https://github.com/jak60/mantrana/blob/main/frontend/components/map/route/RouteCompareView.tsx) (Route comparison), [`frontend/lib/map/popupEnrichmentBathymetric.ts`](https://github.com/jak60/mantrana/blob/main/frontend/lib/map/popupEnrichmentBathymetric.ts) (Location enrichment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_map["Maritime map"]
  node_atlas["Atlas map<br/>[AtlasMap.tsx]"]
  node_mapengine["Map engine"]
  node_geolayers["Geo layers<br/>[baseGeoLayers.ts]"]
  node_gridutils["Grid features<br/>[mapUtils.ts]"]
  node_enrichment["Location enrichment"]
  node_imagery["Historical imagery"]
  node_imagerycompare["Imagery comparison<br/>[CompareViewer.tsx]"]
end

subgraph group_routes["Route analysis"]
  node_routecompare["Route comparison"]
  node_routesstate["Route state<br/>[useMultiRoot.ts]"]
  node_risklookup["Route risk<br/>[risklookup.ts]"]
end

subgraph group_fleet["Fleet and missions"]
  node_shipquery["Ship query<br/>[QueryView.tsx]"]
  node_queryclass["Query classification<br/>[classifyQuery.ts]"]
  node_sensorresults["Sensor results<br/>[SensorChart.tsx]"]
  node_rulresults["Life estimates<br/>[RulView.tsx]"]
  node_reliability["Reliability results"]
  node_missionbuilder["Mission builder"]
  node_sitrep["Situation reports<br/>[useSitrepReader.ts]"]
end

subgraph group_services["API and integrations"]
  node_proxy["Data proxy<br/>[route.ts]"]
  node_missionapi["Mission recommendation<br/>[route.ts]"]
  node_ollamaapi["Generation endpoint<br/>[route.ts]"]
  node_shipapi["Ship data endpoint<br/>[route.ts]"]
end

node_operator(("Operator"))
node_home["Application<br/>[page.tsx]"]
node_marineapis(("Marine data services"))
node_reliabilityservice(("Reliability service"))
node_ollama(("Ollama"))

node_operator -->|"opens"| node_home
node_mapengine -->|"builds grid"| node_gridutils
node_mapengine -->|"adds layers"| node_geolayers
node_mapengine -->|"fetches enrichment"| node_enrichment
node_mapengine -.->|"requests data"| node_marineapis
node_routecompare -->|"fetches enrichment"| node_enrichment
node_routecompare -->|"deduplicates grid"| node_risklookup
node_shipquery -->|"renders sensor data"| node_sensorresults
node_shipquery -->|"renders life estimates"| node_rulresults
node_shipquery -->|"renders builder"| node_missionbuilder
node_shipquery -->|"renders results"| node_reliability
node_proxy -->|"fetches allowed hosts"| node_marineapis
node_missionapi -->|"submits configuration"| node_reliabilityservice
node_ollamaapi -->|"forwards request"| node_ollama

click node_home "https://github.com/jak60/mantrana/blob/main/frontend/app/page.tsx"
click node_atlas "https://github.com/jak60/mantrana/blob/main/frontend/components/map/AtlasMap.tsx"
click node_mapengine "https://github.com/jak60/mantrana/blob/main/frontend/hooks/useGlobeMapEngine.ts"
click node_geolayers "https://github.com/jak60/mantrana/blob/main/frontend/lib/map/baseGeoLayers.ts"
click node_gridutils "https://github.com/jak60/mantrana/blob/main/frontend/lib/map/mapUtils.ts"
click node_enrichment "https://github.com/jak60/mantrana/blob/main/frontend/lib/map/popupEnrichmentBathymetric.ts"
click node_imagery "https://github.com/jak60/mantrana/blob/main/frontend/hooks/useHistoricalImagery.ts"
click node_imagerycompare "https://github.com/jak60/mantrana/blob/main/frontend/components/map/historyMaps/CompareViewer.tsx"
click node_routecompare "https://github.com/jak60/mantrana/blob/main/frontend/components/map/route/RouteCompareView.tsx"
click node_routesstate "https://github.com/jak60/mantrana/blob/main/frontend/hooks/useMultiRoot.ts"
click node_risklookup "https://github.com/jak60/mantrana/blob/main/frontend/utils/route/risklookup.ts"
click node_shipquery "https://github.com/jak60/mantrana/blob/main/frontend/components/ship/views/QueryView.tsx"
click node_queryclass "https://github.com/jak60/mantrana/blob/main/frontend/lib/classifyQuery.ts"
click node_sensorresults "https://github.com/jak60/mantrana/blob/main/frontend/components/ship/views/SensorChart.tsx"
click node_rulresults "https://github.com/jak60/mantrana/blob/main/frontend/components/ship/views/RulView.tsx"
click node_reliability "https://github.com/jak60/mantrana/blob/main/frontend/components/mission/views/ReliabilityResultView.tsx"
click node_missionbuilder "https://github.com/jak60/mantrana/blob/main/frontend/components/mission/MissionConfigDashboard.tsx"
click node_sitrep "https://github.com/jak60/mantrana/blob/main/frontend/hooks/useSitrepReader.ts"
click node_proxy "https://github.com/jak60/mantrana/blob/main/frontend/app/api/app/route.ts"
click node_missionapi "https://github.com/jak60/mantrana/blob/main/frontend/app/api/mission-recommend/route.ts"
click node_ollamaapi "https://github.com/jak60/mantrana/blob/main/frontend/app/api/ollama/route.ts"
click node_shipapi "https://github.com/jak60/mantrana/blob/main/frontend/app/api/ships/%5Bslug%5D/route.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_atlas,node_mapengine,node_geolayers,node_gridutils,node_enrichment,node_imagery,node_imagerycompare toneBlue
class node_routecompare,node_routesstate,node_risklookup toneAmber
class node_shipquery,node_queryclass,node_sensorresults,node_rulresults,node_reliability,node_missionbuilder,node_sitrep toneMint
class node_proxy,node_missionapi,node_ollamaapi,node_shipapi toneRose
class node_operator,node_marineapis,node_reliabilityservice,node_ollama toneIndigo
class node_home toneTeal
```

## Components

### Maritime map

- [Atlas map](https://github.com/jak60/mantrana/blob/main/frontend/components/map/AtlasMap.tsx): `frontend/components/map/AtlasMap.tsx`
- [Map engine](https://github.com/jak60/mantrana/blob/main/frontend/hooks/useGlobeMapEngine.ts): `frontend/hooks/useGlobeMapEngine.ts`
- [Geo layers](https://github.com/jak60/mantrana/blob/main/frontend/lib/map/baseGeoLayers.ts): `frontend/lib/map/baseGeoLayers.ts`
- [Grid features](https://github.com/jak60/mantrana/blob/main/frontend/lib/map/mapUtils.ts): `frontend/lib/map/mapUtils.ts`
- [Location enrichment](https://github.com/jak60/mantrana/blob/main/frontend/lib/map/popupEnrichmentBathymetric.ts): `frontend/lib/map/popupEnrichmentBathymetric.ts`
- [Historical imagery](https://github.com/jak60/mantrana/blob/main/frontend/hooks/useHistoricalImagery.ts): `frontend/hooks/useHistoricalImagery.ts`
- [Imagery comparison](https://github.com/jak60/mantrana/blob/main/frontend/components/map/historyMaps/CompareViewer.tsx): `frontend/components/map/historyMaps/CompareViewer.tsx`

### Route analysis

- [Route comparison](https://github.com/jak60/mantrana/blob/main/frontend/components/map/route/RouteCompareView.tsx): `frontend/components/map/route/RouteCompareView.tsx`
- [Route state](https://github.com/jak60/mantrana/blob/main/frontend/hooks/useMultiRoot.ts): `frontend/hooks/useMultiRoot.ts`
- [Route risk](https://github.com/jak60/mantrana/blob/main/frontend/utils/route/risklookup.ts): `frontend/utils/route/risklookup.ts`

### Fleet and missions

- [Ship query](https://github.com/jak60/mantrana/blob/main/frontend/components/ship/views/QueryView.tsx): `frontend/components/ship/views/QueryView.tsx`
- [Query classification](https://github.com/jak60/mantrana/blob/main/frontend/lib/classifyQuery.ts): `frontend/lib/classifyQuery.ts`
- [Sensor results](https://github.com/jak60/mantrana/blob/main/frontend/components/ship/views/SensorChart.tsx): `frontend/components/ship/views/SensorChart.tsx`
- [Life estimates](https://github.com/jak60/mantrana/blob/main/frontend/components/ship/views/RulView.tsx): `frontend/components/ship/views/RulView.tsx`
- [Reliability results](https://github.com/jak60/mantrana/blob/main/frontend/components/mission/views/ReliabilityResultView.tsx): `frontend/components/mission/views/ReliabilityResultView.tsx`
- [Mission builder](https://github.com/jak60/mantrana/blob/main/frontend/components/mission/MissionConfigDashboard.tsx): `frontend/components/mission/MissionConfigDashboard.tsx`
- [Situation reports](https://github.com/jak60/mantrana/blob/main/frontend/hooks/useSitrepReader.ts): `frontend/hooks/useSitrepReader.ts`

### API and integrations

- [Data proxy](https://github.com/jak60/mantrana/blob/main/frontend/app/api/app/route.ts): `frontend/app/api/app/route.ts`
- [Mission recommendation](https://github.com/jak60/mantrana/blob/main/frontend/app/api/mission-recommend/route.ts): `frontend/app/api/mission-recommend/route.ts`
- [Generation endpoint](https://github.com/jak60/mantrana/blob/main/frontend/app/api/ollama/route.ts): `frontend/app/api/ollama/route.ts`
- [Ship data endpoint](https://github.com/jak60/mantrana/blob/main/frontend/app/api/ships/%5Bslug%5D/route.ts): `frontend/app/api/ships/[slug]/route.ts`

### Other components

- **Operator**
- [Application](https://github.com/jak60/mantrana/blob/main/frontend/app/page.tsx): `frontend/app/page.tsx`
- **Marine data services**
- **Reliability service**
- **Ollama**

## Connections

- Operator → Application: opens
- Map engine → Grid features: builds grid
- Map engine → Geo layers: adds layers
- Map engine → Location enrichment: fetches enrichment
- Map engine → Marine data services: requests data
- Route comparison → Location enrichment: fetches enrichment
- Route comparison → Route risk: deduplicates grid
- Ship query → Sensor results: renders sensor data
- Ship query → Life estimates: renders life estimates
- Ship query → Mission builder: renders builder
- Ship query → Reliability results: renders results
- Data proxy → Marine data services: fetches allowed hosts
- Mission recommendation → Reliability service: submits configuration
- Generation endpoint → Ollama: forwards request
