# t-mavlabs/sagar architecture

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

- Interactive diagram: https://gitdiagram.com/t-mavlabs/sagar
- Repository: https://github.com/t-mavlabs/sagar

## Overview

SAGAR is a marine-science analysis dashboard. Scientists enter through the project dashboard, open a project’s globe view, query marine data in natural language, and inspect the resulting analysis, maps, and charts; query history and project notes support follow-up work. Separate study modules cover taxonomy, otolith classification, and eDNA, while vessel telemetry and API/data-source views provide additional product capabilities. Relationships are limited to those shown in excerpts, the source index, or README; some README-described capabilities have unsampled implementations.

Main entry points: [`src/components/GlobeView.tsx`](https://github.com/t-mavlabs/sagar/blob/main/src/components/GlobeView.tsx) (Globe analysis view), [`src/App.tsx`](https://github.com/t-mavlabs/sagar/blob/main/src/App.tsx) (App routing), [`src/components/SearchResultsView.tsx`](https://github.com/t-mavlabs/sagar/blob/main/src/components/SearchResultsView.tsx) (Analysis results), [`src/services/supabaseClient.ts`](https://github.com/t-mavlabs/sagar/blob/main/src/services/supabaseClient.ts) (Supabase client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App and projects"]
  node_app["App routing<br/>[App.tsx]"]
  node_login["Login<br/>[Login.tsx]"]
  node_dashboard["Project dashboard<br/>[Dashboard.tsx]"]
end

subgraph group_analysis["Marine analysis"]
  node_globeview["Globe analysis view<br/>[GlobeView.tsx]"]
  node_globe["3D globe renderer<br/>[Globe.js]"]
  node_globeadapter["Globe adapter"]
  node_results["Analysis results"]
  node_worldmap["Results map"]
  node_historyui["Query history<br/>[QueryHistory.tsx]"]
  node_notes["Project notes"]
end

subgraph group_studies["Study modules"]
  node_taxonomy["Taxonomy module<br/>[taxonomyService.ts]"]
  node_otolith["Otolith module<br/>[otolithService.ts]"]
  node_edna["eDNA module<br/>[ednaService.ts]"]
  node_species["Species identification"]
end

subgraph group_services["Data services"]
  node_rag["Marine RAG service<br/>[ragService.ts]"]
  node_history["History service"]
  node_supabase["Supabase client<br/>[supabaseClient.ts]"]
  node_telemetry["Vessel telemetry service"]
  node_telemetrystore["Telemetry persistence"]
end

subgraph group_other["Other product areas"]
  node_datasources["Data source page<br/>[DataSourcePage.tsx]"]
  node_apidocs["API documentation"]
  node_vessel["Vessel login and telemetry<br/>[VesselLogin.tsx]"]
  node_quality["Quality report<br/>[QualityReport.tsx]"]
  node_pdf["PDF generator<br/>[pdfGenerator.ts]"]
end

node_scientist(("Scientist"))
node_ragapi["SagarManthan RAG API"]
node_database[("Supabase database")]

node_scientist -->|"opens"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_globeview
node_app -->|"routes to"| node_results
node_app -->|"routes to"| node_datasources
node_app -->|"routes to"| node_apidocs
node_app -->|"routes to"| node_vessel
node_dashboard -->|"reads projects"| node_supabase
node_globeview -->|"renders"| node_globeadapter
node_globeadapter -->|"renders"| node_globe
node_globeview -->|"submits queries"| node_rag
node_rag -->|"queries"| node_ragapi
node_rag -->|"returns results"| node_results
node_results -->|"renders map"| node_worldmap
node_globeview -->|"saves queries"| node_history
node_historyui -->|"loads and deletes"| node_history
node_history -->|"reads and writes"| node_supabase
node_historyui -->|"restores results"| node_results
node_globeview -->|"manages notes"| node_notes
node_results -->|"uses notes"| node_notes
node_notes -->|"reads and writes"| node_supabase
node_supabase -->|"connects"| node_database
node_globeview -->|"uses"| node_taxonomy
node_globeview -->|"uses"| node_otolith
node_globeview -->|"uses"| node_edna
node_globeview -->|"uses"| node_species
node_vessel -->|"uses"| node_telemetry
node_vessel -->|"uses"| node_telemetrystore
node_telemetrystore -->|"persists data"| node_supabase
node_vessel -->|"shows report"| node_quality
node_quality -->|"generates PDF"| node_pdf

click node_app "https://github.com/t-mavlabs/sagar/blob/main/src/App.tsx"
click node_login "https://github.com/t-mavlabs/sagar/blob/main/src/components/Login.tsx"
click node_dashboard "https://github.com/t-mavlabs/sagar/blob/main/src/components/Dashboard.tsx"
click node_globeview "https://github.com/t-mavlabs/sagar/blob/main/src/components/GlobeView.tsx"
click node_globe "https://github.com/t-mavlabs/sagar/blob/main/src/external/transpiled/Globe.js"
click node_globeadapter "https://github.com/t-mavlabs/sagar/blob/main/src/components/ReactGlobeComponent.tsx"
click node_results "https://github.com/t-mavlabs/sagar/blob/main/src/components/SearchResultsView.tsx"
click node_worldmap "https://github.com/t-mavlabs/sagar/blob/main/src/components/ui/search-world-map.tsx"
click node_rag "https://github.com/t-mavlabs/sagar/blob/main/src/services/ragService.ts"
click node_historyui "https://github.com/t-mavlabs/sagar/blob/main/src/components/QueryHistory.tsx"
click node_history "https://github.com/t-mavlabs/sagar/blob/main/src/services/queryHistoryService.ts"
click node_supabase "https://github.com/t-mavlabs/sagar/blob/main/src/services/supabaseClient.ts"
click node_notes "https://github.com/t-mavlabs/sagar/blob/main/src/services/studyNotesService.ts"
click node_taxonomy "https://github.com/t-mavlabs/sagar/blob/main/src/services/taxonomyService.ts"
click node_otolith "https://github.com/t-mavlabs/sagar/blob/main/src/services/otolithService.ts"
click node_edna "https://github.com/t-mavlabs/sagar/blob/main/src/services/ednaService.ts"
click node_species "https://github.com/t-mavlabs/sagar/blob/main/src/services/speciesIdentificationService.ts"
click node_datasources "https://github.com/t-mavlabs/sagar/blob/main/src/components/DataSourcePage.tsx"
click node_apidocs "https://github.com/t-mavlabs/sagar/blob/main/src/components/APIDocumentation.tsx"
click node_vessel "https://github.com/t-mavlabs/sagar/blob/main/src/components/VesselLogin.tsx"
click node_telemetry "https://github.com/t-mavlabs/sagar/blob/main/src/services/vesselTelemetryService.ts"
click node_telemetrystore "https://github.com/t-mavlabs/sagar/blob/main/src/services/vesselTelemetrySupabaseService.ts"
click node_quality "https://github.com/t-mavlabs/sagar/blob/main/src/components/QualityReport.tsx"
click node_pdf "https://github.com/t-mavlabs/sagar/blob/main/src/lib/pdfGenerator.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_app,node_login,node_dashboard toneBlue
class node_globeview,node_globe,node_globeadapter,node_results,node_worldmap,node_historyui,node_notes,node_database toneAmber
class node_taxonomy,node_otolith,node_edna,node_species,node_ragapi toneMint
class node_rag,node_history,node_supabase,node_telemetry,node_telemetrystore toneRose
class node_datasources,node_apidocs,node_vessel,node_quality,node_pdf,node_scientist toneIndigo
```

## Components

### App and projects

- [App routing](https://github.com/t-mavlabs/sagar/blob/main/src/App.tsx): `src/App.tsx`
- [Login](https://github.com/t-mavlabs/sagar/blob/main/src/components/Login.tsx): `src/components/Login.tsx`
- [Project dashboard](https://github.com/t-mavlabs/sagar/blob/main/src/components/Dashboard.tsx): `src/components/Dashboard.tsx`

### Marine analysis

- [Globe analysis view](https://github.com/t-mavlabs/sagar/blob/main/src/components/GlobeView.tsx): `src/components/GlobeView.tsx`
- [3D globe renderer](https://github.com/t-mavlabs/sagar/blob/main/src/external/transpiled/Globe.js): `src/external/transpiled/Globe.js`
- [Globe adapter](https://github.com/t-mavlabs/sagar/blob/main/src/components/ReactGlobeComponent.tsx): `src/components/ReactGlobeComponent.tsx`
- [Analysis results](https://github.com/t-mavlabs/sagar/blob/main/src/components/SearchResultsView.tsx): `src/components/SearchResultsView.tsx`
- [Results map](https://github.com/t-mavlabs/sagar/blob/main/src/components/ui/search-world-map.tsx): `src/components/ui/search-world-map.tsx`
- [Query history](https://github.com/t-mavlabs/sagar/blob/main/src/components/QueryHistory.tsx): `src/components/QueryHistory.tsx`
- [Project notes](https://github.com/t-mavlabs/sagar/blob/main/src/services/studyNotesService.ts): `src/services/studyNotesService.ts`

### Study modules

- [Taxonomy module](https://github.com/t-mavlabs/sagar/blob/main/src/services/taxonomyService.ts): `src/services/taxonomyService.ts`
- [Otolith module](https://github.com/t-mavlabs/sagar/blob/main/src/services/otolithService.ts): `src/services/otolithService.ts`
- [eDNA module](https://github.com/t-mavlabs/sagar/blob/main/src/services/ednaService.ts): `src/services/ednaService.ts`
- [Species identification](https://github.com/t-mavlabs/sagar/blob/main/src/services/speciesIdentificationService.ts): `src/services/speciesIdentificationService.ts`

### Data services

- [Marine RAG service](https://github.com/t-mavlabs/sagar/blob/main/src/services/ragService.ts): `src/services/ragService.ts`
- [History service](https://github.com/t-mavlabs/sagar/blob/main/src/services/queryHistoryService.ts): `src/services/queryHistoryService.ts`
- [Supabase client](https://github.com/t-mavlabs/sagar/blob/main/src/services/supabaseClient.ts): `src/services/supabaseClient.ts`
- [Vessel telemetry service](https://github.com/t-mavlabs/sagar/blob/main/src/services/vesselTelemetryService.ts): `src/services/vesselTelemetryService.ts`
- [Telemetry persistence](https://github.com/t-mavlabs/sagar/blob/main/src/services/vesselTelemetrySupabaseService.ts): `src/services/vesselTelemetrySupabaseService.ts`

### Other product areas

- [Data source page](https://github.com/t-mavlabs/sagar/blob/main/src/components/DataSourcePage.tsx): `src/components/DataSourcePage.tsx`
- [API documentation](https://github.com/t-mavlabs/sagar/blob/main/src/components/APIDocumentation.tsx): `src/components/APIDocumentation.tsx`
- [Vessel login and telemetry](https://github.com/t-mavlabs/sagar/blob/main/src/components/VesselLogin.tsx): `src/components/VesselLogin.tsx`
- [Quality report](https://github.com/t-mavlabs/sagar/blob/main/src/components/QualityReport.tsx): `src/components/QualityReport.tsx`
- [PDF generator](https://github.com/t-mavlabs/sagar/blob/main/src/lib/pdfGenerator.ts): `src/lib/pdfGenerator.ts`

### Other components

- **Scientist**
- **SagarManthan RAG API**
- **Supabase database**

## Connections

- Scientist → App routing: opens (evidence: `src/App.tsx`)
- App routing → Login: routes to (evidence: `src/App.tsx`)
- App routing → Project dashboard: routes to (evidence: `src/App.tsx`)
- App routing → Globe analysis view: routes to (evidence: `src/App.tsx`)
- App routing → Analysis results: routes to (evidence: `src/App.tsx`)
- App routing → Data source page: routes to (evidence: `src/App.tsx`)
- App routing → API documentation: routes to (evidence: `src/App.tsx`)
- App routing → Vessel login and telemetry: routes to (evidence: `src/App.tsx`)
- Project dashboard → Supabase client: reads projects (evidence: `src/components/Dashboard.tsx`)
- Globe analysis view → Globe adapter: renders (evidence: `src/components/GlobeView.tsx`)
- Globe adapter → 3D globe renderer: renders (evidence: `src/components/ReactGlobeComponent.tsx`)
- Globe analysis view → Marine RAG service: submits queries (evidence: `src/components/GlobeView.tsx`)
- Marine RAG service → SagarManthan RAG API: queries (evidence: `src/services/ragService.ts`)
- Marine RAG service → Analysis results: returns results (evidence: `src/services/ragService.ts`)
- Analysis results → Results map: renders map (evidence: `src/components/SearchResultsView.tsx`)
- Globe analysis view → History service: saves queries (evidence: `src/components/GlobeView.tsx`)
- Query history → History service: loads and deletes (evidence: `src/components/QueryHistory.tsx`)
- History service → Supabase client: reads and writes (evidence: `src/services/queryHistoryService.ts`)
- Query history → Analysis results: restores results (evidence: `src/components/QueryHistory.tsx`)
- Globe analysis view → Project notes: manages notes (evidence: `src/components/GlobeView.tsx`)
- Analysis results → Project notes: uses notes (evidence: `src/components/SearchResultsView.tsx`)
- Project notes → Supabase client: reads and writes (evidence: `src/services/studyNotesService.ts`)
- Supabase client → Supabase database: connects (evidence: `src/services/supabaseClient.ts`)
- Globe analysis view → Taxonomy module: uses (evidence: `src/components/GlobeView.tsx`)
- Globe analysis view → Otolith module: uses (evidence: `src/components/GlobeView.tsx`)
- Globe analysis view → eDNA module: uses (evidence: `src/components/GlobeView.tsx`)
- Globe analysis view → Species identification: uses (evidence: `src/components/GlobeView.tsx`)
- Vessel login and telemetry → Vessel telemetry service: uses (evidence: `src/components/VesselLogin.tsx`)
- Vessel login and telemetry → Telemetry persistence: uses (evidence: `src/components/VesselLogin.tsx`)
- Telemetry persistence → Supabase client: persists data (evidence: `src/services/vesselTelemetrySupabaseService.ts`)
- Vessel login and telemetry → Quality report: shows report (evidence: `src/components/VesselLogin.tsx`)
- Quality report → PDF generator: generates PDF (evidence: `src/components/QualityReport.tsx`)
