# santhosh-python/navetra architecture

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

- Interactive diagram: https://gitdiagram.com/santhosh-python/navetra
- Repository: https://github.com/santhosh-python/navetra

## Overview

Navetra is a browser-based inventory-intelligence app for essential supplies, using synthetic demo data rather than a live backend. The principal workflow is to load inventory and delivery data, calculate stock risk and depletion estimates, then surface prioritized attention and reorder recommendations through the overview and item-focused pages. Users can also manage inventory, model what-if scenarios, inspect analytics and reports, and configure thresholds and notifications. The service layer supports demo operation and documents a planned API boundary; unsampled page internals are represented only where README capabilities establish them.

Main entry points: [`src/app/App.tsx`](https://github.com/santhosh-python/navetra/blob/main/src/app/App.tsx) (App routing), [`src/state/InventoryContext.tsx`](https://github.com/santhosh-python/navetra/blob/main/src/state/InventoryContext.tsx) (Inventory state), [`src/pages/InventoryPage.tsx`](https://github.com/santhosh-python/navetra/blob/main/src/pages/InventoryPage.tsx) (Inventory management), [`src/services/inventoryService.ts`](https://github.com/santhosh-python/navetra/blob/main/src/services/inventoryService.ts) (Inventory service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_router["App routing<br/>[App.tsx]"]
  node_overview["Overview<br/>[OverviewPage.tsx]"]
end

subgraph group_inventory["Inventory and data"]
  node_inventory_page["Inventory management<br/>[InventoryPage.tsx]"]
  node_item_detail["Item details<br/>[ItemDetailPage.tsx]"]
  node_inventory_context["Inventory state"]
  node_inventory_service["Inventory service"]
  node_demo_data["Synthetic inventory data<br/>[demoInventory.ts]"]
  node_history_data["Demo stock history<br/>[demoHistory.ts]"]
  node_query["Inventory filtering<br/>[inventoryQuery.ts]"]
end

subgraph group_intelligence["Risk and planning"]
  node_risk["Risk and stock analysis"]
  node_forecast["Shortage forecasts<br/>[ForecastsPage.tsx]"]
  node_forecast_engine["Forecast calculations<br/>[forecasting.ts]"]
  node_recommendations["Ranked recommendations"]
  node_simulator["What-if simulator<br/>[SimulatorPage.tsx]"]
end

subgraph group_insight["Analysis and reports"]
  node_analytics["Analytics charts<br/>[AnalyticsPage.tsx]"]
  node_reports["Reports and exports<br/>[ReportsPage.tsx]"]
end

subgraph group_controls["Settings and alerts"]
  node_settings["Settings<br/>[SettingsPage.tsx]"]
  node_notifications["Notifications"]
  node_settings_state["Settings state"]
end

node_user(("Clinic staff"))
node_api["Planned backend API"]

node_user -->|"opens app"| node_router
node_router -->|"routes to"| node_overview
node_router -->|"routes to"| node_inventory_page
node_router -->|"routes to"| node_item_detail
node_router -->|"routes to"| node_forecast
node_router -->|"routes to"| node_recommendations
node_router -->|"routes to"| node_simulator
node_router -->|"routes to"| node_analytics
node_router -->|"routes to"| node_reports
node_router -->|"routes to"| node_settings
node_inventory_context -->|"loads and mutates"| node_inventory_service
node_inventory_service -->|"uses demo items"| node_demo_data
node_inventory_context -->|"builds history from"| node_history_data
node_inventory_context -.->|"builds inventory rows"| node_risk
node_inventory_context -->|"builds ranked list"| node_recommendations
node_inventory_page -.->|"manages items"| node_inventory_context
node_inventory_page -.->|"filters and sorts"| node_query
node_query -->|"compares risk"| node_risk
node_forecast -.->|"shows estimates"| node_forecast_engine
node_simulator -.->|"models scenarios"| node_forecast_engine
node_settings -.->|"changes preferences"| node_settings_state
node_notifications -->|"reads inventory rows"| node_inventory_context
node_notifications -.->|"reads notification settings"| node_settings_state
node_inventory_service -.->|"optionally requests"| node_api

click node_router "https://github.com/santhosh-python/navetra/blob/main/src/app/App.tsx"
click node_overview "https://github.com/santhosh-python/navetra/blob/main/src/pages/OverviewPage.tsx"
click node_inventory_page "https://github.com/santhosh-python/navetra/blob/main/src/pages/InventoryPage.tsx"
click node_item_detail "https://github.com/santhosh-python/navetra/blob/main/src/pages/ItemDetailPage.tsx"
click node_inventory_context "https://github.com/santhosh-python/navetra/blob/main/src/state/InventoryContext.tsx"
click node_inventory_service "https://github.com/santhosh-python/navetra/blob/main/src/services/inventoryService.ts"
click node_demo_data "https://github.com/santhosh-python/navetra/blob/main/src/data/demoInventory.ts"
click node_history_data "https://github.com/santhosh-python/navetra/blob/main/src/data/demoHistory.ts"
click node_query "https://github.com/santhosh-python/navetra/blob/main/src/lib/inventoryQuery.ts"
click node_risk "https://github.com/santhosh-python/navetra/blob/main/src/lib/riskClassification.ts"
click node_forecast "https://github.com/santhosh-python/navetra/blob/main/src/pages/ForecastsPage.tsx"
click node_forecast_engine "https://github.com/santhosh-python/navetra/blob/main/src/lib/forecasting.ts"
click node_recommendations "https://github.com/santhosh-python/navetra/blob/main/src/pages/RecommendationsPage.tsx"
click node_simulator "https://github.com/santhosh-python/navetra/blob/main/src/pages/SimulatorPage.tsx"
click node_analytics "https://github.com/santhosh-python/navetra/blob/main/src/pages/AnalyticsPage.tsx"
click node_reports "https://github.com/santhosh-python/navetra/blob/main/src/pages/ReportsPage.tsx"
click node_settings "https://github.com/santhosh-python/navetra/blob/main/src/pages/SettingsPage.tsx"
click node_notifications "https://github.com/santhosh-python/navetra/blob/main/src/state/NotificationContext.tsx"
click node_settings_state "https://github.com/santhosh-python/navetra/blob/main/src/state/SettingsContext.tsx"

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_router,node_overview toneBlue
class node_inventory_page,node_item_detail,node_inventory_context,node_inventory_service,node_demo_data,node_history_data,node_query toneAmber
class node_risk,node_forecast,node_forecast_engine,node_recommendations,node_simulator,node_api toneMint
class node_analytics,node_reports toneRose
class node_settings,node_notifications,node_settings_state,node_user toneIndigo
```

## Components

### App experience

- [App routing](https://github.com/santhosh-python/navetra/blob/main/src/app/App.tsx): `src/app/App.tsx`
- [Overview](https://github.com/santhosh-python/navetra/blob/main/src/pages/OverviewPage.tsx): `src/pages/OverviewPage.tsx`

### Inventory and data

- [Inventory management](https://github.com/santhosh-python/navetra/blob/main/src/pages/InventoryPage.tsx): `src/pages/InventoryPage.tsx`
- [Item details](https://github.com/santhosh-python/navetra/blob/main/src/pages/ItemDetailPage.tsx): `src/pages/ItemDetailPage.tsx`
- [Inventory state](https://github.com/santhosh-python/navetra/blob/main/src/state/InventoryContext.tsx): `src/state/InventoryContext.tsx`
- [Inventory service](https://github.com/santhosh-python/navetra/blob/main/src/services/inventoryService.ts): `src/services/inventoryService.ts`
- [Synthetic inventory data](https://github.com/santhosh-python/navetra/blob/main/src/data/demoInventory.ts): `src/data/demoInventory.ts`
- [Demo stock history](https://github.com/santhosh-python/navetra/blob/main/src/data/demoHistory.ts): `src/data/demoHistory.ts`
- [Inventory filtering](https://github.com/santhosh-python/navetra/blob/main/src/lib/inventoryQuery.ts): `src/lib/inventoryQuery.ts`

### Risk and planning

- [Risk and stock analysis](https://github.com/santhosh-python/navetra/blob/main/src/lib/riskClassification.ts): `src/lib/riskClassification.ts`
- [Shortage forecasts](https://github.com/santhosh-python/navetra/blob/main/src/pages/ForecastsPage.tsx): `src/pages/ForecastsPage.tsx`
- [Forecast calculations](https://github.com/santhosh-python/navetra/blob/main/src/lib/forecasting.ts): `src/lib/forecasting.ts`
- [Ranked recommendations](https://github.com/santhosh-python/navetra/blob/main/src/pages/RecommendationsPage.tsx): `src/pages/RecommendationsPage.tsx`
- [What-if simulator](https://github.com/santhosh-python/navetra/blob/main/src/pages/SimulatorPage.tsx): `src/pages/SimulatorPage.tsx`

### Analysis and reports

- [Analytics charts](https://github.com/santhosh-python/navetra/blob/main/src/pages/AnalyticsPage.tsx): `src/pages/AnalyticsPage.tsx`
- [Reports and exports](https://github.com/santhosh-python/navetra/blob/main/src/pages/ReportsPage.tsx): `src/pages/ReportsPage.tsx`

### Settings and alerts

- [Settings](https://github.com/santhosh-python/navetra/blob/main/src/pages/SettingsPage.tsx): `src/pages/SettingsPage.tsx`
- [Notifications](https://github.com/santhosh-python/navetra/blob/main/src/state/NotificationContext.tsx): `src/state/NotificationContext.tsx`
- [Settings state](https://github.com/santhosh-python/navetra/blob/main/src/state/SettingsContext.tsx): `src/state/SettingsContext.tsx`

### Other components

- **Clinic staff**
- **Planned backend API**

## Connections

- Clinic staff → App routing: opens app (evidence: `README.md`)
- App routing → Overview: routes to (evidence: `src/app/App.tsx`)
- App routing → Inventory management: routes to (evidence: `src/app/App.tsx`)
- App routing → Item details: routes to (evidence: `src/app/App.tsx`)
- App routing → Shortage forecasts: routes to (evidence: `src/app/App.tsx`)
- App routing → Ranked recommendations: routes to (evidence: `src/app/App.tsx`)
- App routing → What-if simulator: routes to (evidence: `src/app/App.tsx`)
- App routing → Analytics charts: routes to (evidence: `src/app/App.tsx`)
- App routing → Reports and exports: routes to (evidence: `src/app/App.tsx`)
- App routing → Settings: routes to (evidence: `src/app/App.tsx`)
- Inventory state → Inventory service: loads and mutates (evidence: `src/state/InventoryContext.tsx`)
- Inventory service → Synthetic inventory data: uses demo items (evidence: `src/services/inventoryService.ts`)
- Inventory state → Demo stock history: builds history from (evidence: `src/state/InventoryContext.tsx`)
- Inventory state → Risk and stock analysis: builds inventory rows
- Inventory state → Ranked recommendations: builds ranked list (evidence: `src/state/InventoryContext.tsx`)
- Inventory management → Inventory state: manages items
- Inventory management → Inventory filtering: filters and sorts
- Inventory filtering → Risk and stock analysis: compares risk (evidence: `src/lib/inventoryQuery.ts`)
- Shortage forecasts → Forecast calculations: shows estimates
- What-if simulator → Forecast calculations: models scenarios
- Settings → Settings state: changes preferences
- Notifications → Inventory state: reads inventory rows (evidence: `src/state/NotificationContext.tsx`)
- Notifications → Settings state: reads notification settings
- Inventory service → Planned backend API: optionally requests (evidence: `src/services/inventoryService.ts`)
