# arjav1512/nakshatra-x architecture

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

- Interactive diagram: https://gitdiagram.com/arjav1512/nakshatra-x
- Repository: https://github.com/arjav1512/nakshatra-x

## Overview

NAKSHATRA-X is a hackathon decision-support prototype for manganese reserve prospectivity (Track A) and production-shortfall planning (Track B), presented through a dashboard. The principal workflow is dashboard interaction → product API → domain analysis → forecast, map, or recommendation results. The README documents the separate AI prospectivity pipeline and major capabilities. Several backend modules are indexed but unsampled; their links are included only where the excerpts or README support them.

Main entry points: [`backend/app/api/routes.py`](https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/api/routes.py) (FastAPI routes), [`backend/app/api/track_b.py`](https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/api/track_b.py) (Track B endpoints), [`frontend/src/components`](https://github.com/arjav1512/nakshatra-x/tree/main/frontend/src/components) (Dashboard UI), [`frontend/src/app/api/v1`](https://github.com/arjav1512/nakshatra-x/tree/main/frontend/src/app/api/v1) (Frontend API routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard"]
  node_dashboard_ui["Dashboard UI"]
  node_auth["Demo authentication<br/>[route.ts]"]
end

subgraph group_product_api["Product APIs"]
  node_frontend_api["Frontend API routes"]
  node_backend_api["FastAPI routes<br/>[routes.py]"]
  node_blend_api["Blending API<br/>[route.ts]"]
  node_mine_twin_api["Mine twin API<br/>[route.ts]"]
end

subgraph group_track_a["Track A"]
  node_prospectivity_model["Prospectivity model<br/>[prospectivity.py]"]
  node_map_layers["Map layers<br/>[map_layers.py]"]
  node_ai_dataset["AI dataset generation<br/>[01_make_dataset.py]"]
  node_ai_features["AI feature extraction"]
  node_ai_training["AI model training<br/>[03_train_model.py]"]
  node_ai_grid["AI grid prediction<br/>[04_predict_grid.py]"]
  node_ai_geojson["GeoJSON export"]
end

subgraph group_track_b["Track B"]
  node_track_b_api["Track B endpoints<br/>[track_b.py]"]
  node_forecaster["Production forecaster<br/>[forecaster.py]"]
  node_backtest["Forecast backtest<br/>[backtest.py]"]
  node_constraints["Action constraints<br/>[constraints.py]"]
  node_blending["Ore blending optimizer"]
end

subgraph group_data_layer["Data and provenance"]
  node_generator["Synthetic data generator<br/>[generator.py]"]
  node_forecast_store[("Forecast artifacts<br/>[forecast_store.py]")]
  node_mine_db[("Mine database<br/>[session.py]")]
  node_weather["Weather clients<br/>[nasa_power.py]"]
  node_satellite["Satellite metadata client<br/>[satellite.py]"]
  node_provenance["Response provenance"]
end

node_operator(("Mine user"))

node_operator -->|"uses"| node_dashboard_ui
node_dashboard_ui -->|"requests"| node_frontend_api
node_frontend_api -.->|"proxy requests"| node_backend_api
node_dashboard_ui -->|"authenticates"| node_auth
node_backend_api -->|"dispatches"| node_track_b_api
node_backend_api -->|"reads mines"| node_mine_db
node_backend_api -->|"fetches weather"| node_weather
node_backend_api -->|"queries scenes"| node_satellite
node_backend_api -->|"predicts points"| node_prospectivity_model
node_backend_api -->|"serves layers"| node_map_layers
node_backend_api -->|"stamps responses"| node_provenance
node_track_b_api -->|"forecasts production"| node_forecaster
node_track_b_api -->|"runs backtests"| node_backtest
node_track_b_api -->|"gates actions"| node_constraints
node_track_b_api -->|"loads forecasts"| node_forecast_store
node_forecast_store -->|"checks dataset identity"| node_generator
node_blend_api -.->|"optimizes blends"| node_blending
node_mine_twin_api -.->|"requests mine data"| node_backend_api
node_ai_dataset -->|"prepares data"| node_ai_features
node_ai_features -->|"provides features"| node_ai_training
node_ai_training -->|"supplies model"| node_ai_grid
node_ai_grid -->|"exports predictions"| node_ai_geojson

click node_dashboard_ui "https://github.com/arjav1512/nakshatra-x/tree/main/frontend/src/components"
click node_frontend_api "https://github.com/arjav1512/nakshatra-x/tree/main/frontend/src/app/api/v1"
click node_backend_api "https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/api/routes.py"
click node_blend_api "https://github.com/arjav1512/nakshatra-x/blob/main/frontend/src/app/api/v1/optimize-blending/route.ts"
click node_mine_twin_api "https://github.com/arjav1512/nakshatra-x/blob/main/frontend/src/app/api/v1/mine-twin/route.ts"
click node_auth "https://github.com/arjav1512/nakshatra-x/blob/main/frontend/src/app/api/auth/otp/route.ts"
click node_prospectivity_model "https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/ml/prospectivity.py"
click node_map_layers "https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/ml/map_layers.py"
click node_ai_dataset "https://github.com/arjav1512/nakshatra-x/blob/main/AI/scripts/01_make_dataset.py"
click node_ai_features "https://github.com/arjav1512/nakshatra-x/blob/main/AI/scripts/02_extract_features.py"
click node_ai_training "https://github.com/arjav1512/nakshatra-x/blob/main/AI/scripts/03_train_model.py"
click node_ai_grid "https://github.com/arjav1512/nakshatra-x/blob/main/AI/scripts/04_predict_grid.py"
click node_ai_geojson "https://github.com/arjav1512/nakshatra-x/blob/main/AI/scripts/05_export_geojson.py"
click node_track_b_api "https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/api/track_b.py"
click node_forecaster "https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/ml/forecaster.py"
click node_backtest "https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/ml/backtest.py"
click node_constraints "https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/ml/constraints.py"
click node_blending "https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/ml/blending_optimizer.py"
click node_generator "https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/ingestion/generator.py"
click node_forecast_store "https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/api/forecast_store.py"
click node_mine_db "https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/db/session.py"
click node_weather "https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/services/nasa_power.py"
click node_satellite "https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/services/satellite.py"
click node_provenance "https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/api/response_provenance.py"

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_dashboard_ui,node_auth,node_operator toneBlue
class node_frontend_api,node_backend_api,node_blend_api,node_mine_twin_api toneAmber
class node_prospectivity_model,node_map_layers,node_ai_dataset,node_ai_features,node_ai_training,node_ai_grid,node_ai_geojson toneMint
class node_track_b_api,node_forecaster,node_backtest,node_constraints,node_blending toneRose
class node_generator,node_forecast_store,node_mine_db,node_weather,node_satellite,node_provenance toneIndigo
```

## Components

### Dashboard

- [Dashboard UI](https://github.com/arjav1512/nakshatra-x/tree/main/frontend/src/components): `frontend/src/components`
- [Demo authentication](https://github.com/arjav1512/nakshatra-x/blob/main/frontend/src/app/api/auth/otp/route.ts): `frontend/src/app/api/auth/otp/route.ts`

### Product APIs

- [Frontend API routes](https://github.com/arjav1512/nakshatra-x/tree/main/frontend/src/app/api/v1): `frontend/src/app/api/v1`
- [FastAPI routes](https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/api/routes.py): `backend/app/api/routes.py`
- [Blending API](https://github.com/arjav1512/nakshatra-x/blob/main/frontend/src/app/api/v1/optimize-blending/route.ts): `frontend/src/app/api/v1/optimize-blending/route.ts`
- [Mine twin API](https://github.com/arjav1512/nakshatra-x/blob/main/frontend/src/app/api/v1/mine-twin/route.ts): `frontend/src/app/api/v1/mine-twin/route.ts`

### Track A

- [Prospectivity model](https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/ml/prospectivity.py): `backend/app/ml/prospectivity.py`
- [Map layers](https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/ml/map_layers.py): `backend/app/ml/map_layers.py`
- [AI dataset generation](https://github.com/arjav1512/nakshatra-x/blob/main/AI/scripts/01_make_dataset.py): `AI/scripts/01_make_dataset.py`
- [AI feature extraction](https://github.com/arjav1512/nakshatra-x/blob/main/AI/scripts/02_extract_features.py): `AI/scripts/02_extract_features.py`
- [AI model training](https://github.com/arjav1512/nakshatra-x/blob/main/AI/scripts/03_train_model.py): `AI/scripts/03_train_model.py`
- [AI grid prediction](https://github.com/arjav1512/nakshatra-x/blob/main/AI/scripts/04_predict_grid.py): `AI/scripts/04_predict_grid.py`
- [GeoJSON export](https://github.com/arjav1512/nakshatra-x/blob/main/AI/scripts/05_export_geojson.py): `AI/scripts/05_export_geojson.py`

### Track B

- [Track B endpoints](https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/api/track_b.py): `backend/app/api/track_b.py`
- [Production forecaster](https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/ml/forecaster.py): `backend/app/ml/forecaster.py`
- [Forecast backtest](https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/ml/backtest.py): `backend/app/ml/backtest.py`
- [Action constraints](https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/ml/constraints.py): `backend/app/ml/constraints.py`
- [Ore blending optimizer](https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/ml/blending_optimizer.py): `backend/app/ml/blending_optimizer.py`

### Data and provenance

- [Synthetic data generator](https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/ingestion/generator.py): `backend/app/ingestion/generator.py`
- [Forecast artifacts](https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/api/forecast_store.py): `backend/app/api/forecast_store.py`
- [Mine database](https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/db/session.py): `backend/app/db/session.py`
- [Weather clients](https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/services/nasa_power.py): `backend/app/services/nasa_power.py`
- [Satellite metadata client](https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/services/satellite.py): `backend/app/services/satellite.py`
- [Response provenance](https://github.com/arjav1512/nakshatra-x/blob/main/backend/app/api/response_provenance.py): `backend/app/api/response_provenance.py`

### Other components

- **Mine user**

## Connections

- Mine user → Dashboard UI: uses (evidence: `README.md`)
- Dashboard UI → Frontend API routes: requests (evidence: `README.md`)
- Frontend API routes → FastAPI routes: proxy requests
- Dashboard UI → Demo authentication: authenticates (evidence: `README.md`)
- FastAPI routes → Track B endpoints: dispatches (evidence: `backend/app/api/routes.py`)
- FastAPI routes → Mine database: reads mines (evidence: `backend/app/api/routes.py`)
- FastAPI routes → Weather clients: fetches weather (evidence: `backend/app/api/routes.py`)
- FastAPI routes → Satellite metadata client: queries scenes (evidence: `backend/app/api/routes.py`)
- FastAPI routes → Prospectivity model: predicts points (evidence: `backend/app/api/routes.py`)
- FastAPI routes → Map layers: serves layers (evidence: `backend/app/api/routes.py`)
- FastAPI routes → Response provenance: stamps responses (evidence: `backend/app/api/routes.py`)
- Track B endpoints → Production forecaster: forecasts production (evidence: `backend/app/api/track_b.py`)
- Track B endpoints → Forecast backtest: runs backtests (evidence: `backend/app/api/track_b.py`)
- Track B endpoints → Action constraints: gates actions (evidence: `backend/app/api/track_b.py`)
- Track B endpoints → Forecast artifacts: loads forecasts (evidence: `backend/app/api/track_b.py`)
- Forecast artifacts → Synthetic data generator: checks dataset identity (evidence: `backend/app/api/forecast_store.py`)
- Blending API → Ore blending optimizer: optimizes blends
- Mine twin API → FastAPI routes: requests mine data
- AI dataset generation → AI feature extraction: prepares data (evidence: `README.md`)
- AI feature extraction → AI model training: provides features (evidence: `README.md`)
- AI model training → AI grid prediction: supplies model (evidence: `README.md`)
- AI grid prediction → GeoJSON export: exports predictions (evidence: `README.md`)
