# himanshumohanty-git24/gitaviswa architecture

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

- Interactive diagram: https://gitdiagram.com/himanshumohanty-git24/gitaviswa
- Repository: https://github.com/himanshumohanty-git24/gitaviswa

## Overview

GitaViśva is an offline-capable Bhagavad Gita study and reflection application. Users enter through the home view, then explore the knowledge graph, trace verse relationships, read verses and commentaries, listen to recitations, ask graph-grounded questions, or keep private reflections. The central data layer loads scripture and graph data, builds graph structures and search indexes, and supports both browser retrieval and an optional server-backed LLM path. Several view implementations are unsampled; their capabilities are documented in the README, so those branches are shown without speculative internal call edges.

Main entry points: [`src/app/page.tsx`](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/app/page.tsx) (Home and navigation), [`src/lib/graphrag/engine.ts`](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/graphrag/engine.ts) (Graph retrieval), [`src/lib/data/loader.ts`](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/data/loader.ts) (Scripture data loader), [`src/app/api/chat/route.ts`](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/app/api/chat/route.ts) (Chat API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Study experience"]
  node_reader["Home and navigation<br/>[page.tsx]"]
  node_explore["3D graph explore<br/>[CosmicGraph3D.tsx]"]
  node_lineage["Lineage view<br/>[LineageGraph2D.tsx]"]
  node_pathfinder["Path finder<br/>[pathfinder.ts]"]
  node_scripture["Verse reader<br/>[ChapterReader.tsx]"]
  node_commentaries["Commentary perspectives<br/>[Perspectives.tsx]"]
  node_audio["Recitation player<br/>[AudioDock.tsx]"]
  node_graphpreview["Home graph preview<br/>[GraphPreview.tsx]"]
  node_ask["Ask chatbot"]
end

subgraph group_knowledge["Knowledge and retrieval"]
  node_data["Scripture data loader<br/>[loader.ts]"]
  node_graphstore["Graph structures<br/>[graphStore.ts]"]
  node_graphstate["App graph state<br/>[useGitaStore.ts]"]
  node_search["Hybrid search index<br/>[search.ts]"]
  node_retrieval["Graph retrieval<br/>[engine.ts]"]
end

subgraph group_personal["Personal reflection"]
  node_reflection["Personal mind map"]
  node_thoughts[("Thought storage<br/>[personalStore.ts]")]
  node_drafts[("Draft storage<br/>[draftStore.ts]")]
end

subgraph group_services["Optional AI services"]
  node_settings[("BYOK settings<br/>[settingsStore.ts]")]
  node_chatapi["Chat API<br/>[route.ts]"]
  node_llmclient["LLM client<br/>[client.ts]"]
  node_llmprovider["LLM providers<br/>[providers.ts]"]
end

node_modelservice(("LLM service"))

node_reader -->|"opens"| node_explore
node_reader -->|"opens"| node_lineage
node_reader -->|"opens"| node_scripture
node_reader -->|"opens"| node_audio
node_reader -->|"opens"| node_ask
node_reader -->|"opens"| node_reflection
node_reader -->|"renders"| node_graphpreview
node_explore -->|"reads state"| node_graphstate
node_explore -->|"uses graph"| node_graphstore
node_explore -->|"loads data"| node_data
node_lineage -.->|"shows paths"| node_pathfinder
node_scripture -.->|"loads verses"| node_data
node_commentaries -->|"loads commentary"| node_data
node_graphpreview -->|"loads graph"| node_data
node_graphpreview -->|"uses graph"| node_graphstore
node_graphstate -->|"loads scripture"| node_data
node_graphstate -->|"builds graphs"| node_graphstore
node_graphstate -->|"builds index"| node_search
node_ask -->|"retrieves context"| node_retrieval
node_ask -->|"embeds query"| node_search
node_retrieval -->|"searches index"| node_search
node_retrieval -->|"traverses graph"| node_graphstore
node_reflection -->|"loads thoughts"| node_thoughts
node_reflection -->|"uses drafts"| node_drafts
node_reflection -->|"suggests links"| node_retrieval
node_chatapi -->|"retrieves context"| node_retrieval
node_chatapi -->|"opens stream"| node_llmclient
node_chatapi -->|"resolves provider"| node_llmprovider
node_llmclient -->|"uses registry"| node_llmprovider
node_llmclient -->|"sends requests"| node_modelservice
node_settings -->|"selects provider"| node_llmprovider
node_chatapi -.->|"generates answer"| node_modelservice

click node_reader "https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/app/page.tsx"
click node_explore "https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/components/graph/CosmicGraph3D.tsx"
click node_lineage "https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/components/graph/LineageGraph2D.tsx"
click node_pathfinder "https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/graph/pathfinder.ts"
click node_scripture "https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/components/reader/ChapterReader.tsx"
click node_commentaries "https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/components/reader/Perspectives.tsx"
click node_audio "https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/components/reader/AudioDock.tsx"
click node_graphpreview "https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/components/home/GraphPreview.tsx"
click node_data "https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/data/loader.ts"
click node_graphstore "https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/graph/graphStore.ts"
click node_graphstate "https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/store/useGitaStore.ts"
click node_search "https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/graphrag/search.ts"
click node_retrieval "https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/graphrag/engine.ts"
click node_ask "https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/components/chat/GraphRagChatbot.tsx"
click node_reflection "https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/components/manas/PersonalMindMapper.tsx"
click node_thoughts "https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/store/personalStore.ts"
click node_drafts "https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/store/draftStore.ts"
click node_settings "https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/store/settingsStore.ts"
click node_chatapi "https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/app/api/chat/route.ts"
click node_llmclient "https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/llm/client.ts"
click node_llmprovider "https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/llm/providers.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_reader,node_explore,node_lineage,node_pathfinder,node_scripture,node_commentaries,node_audio,node_graphpreview,node_ask toneBlue
class node_data,node_graphstore,node_graphstate,node_search,node_retrieval toneAmber
class node_reflection,node_thoughts,node_drafts toneMint
class node_settings,node_chatapi,node_llmclient,node_llmprovider toneRose
class node_modelservice toneIndigo
```

## Components

### Study experience

- [Home and navigation](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [3D graph explore](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/components/graph/CosmicGraph3D.tsx): `src/components/graph/CosmicGraph3D.tsx`
- [Lineage view](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/components/graph/LineageGraph2D.tsx): `src/components/graph/LineageGraph2D.tsx`
- [Path finder](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/graph/pathfinder.ts): `src/lib/graph/pathfinder.ts`
- [Verse reader](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/components/reader/ChapterReader.tsx): `src/components/reader/ChapterReader.tsx`
- [Commentary perspectives](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/components/reader/Perspectives.tsx): `src/components/reader/Perspectives.tsx`
- [Recitation player](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/components/reader/AudioDock.tsx): `src/components/reader/AudioDock.tsx`
- [Home graph preview](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/components/home/GraphPreview.tsx): `src/components/home/GraphPreview.tsx`
- [Ask chatbot](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/components/chat/GraphRagChatbot.tsx): `src/components/chat/GraphRagChatbot.tsx`

### Knowledge and retrieval

- [Scripture data loader](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/data/loader.ts): `src/lib/data/loader.ts`
- [Graph structures](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/graph/graphStore.ts): `src/lib/graph/graphStore.ts`
- [App graph state](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/store/useGitaStore.ts): `src/lib/store/useGitaStore.ts`
- [Hybrid search index](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/graphrag/search.ts): `src/lib/graphrag/search.ts`
- [Graph retrieval](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/graphrag/engine.ts): `src/lib/graphrag/engine.ts`

### Personal reflection

- [Personal mind map](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/components/manas/PersonalMindMapper.tsx): `src/components/manas/PersonalMindMapper.tsx`
- [Thought storage](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/store/personalStore.ts): `src/lib/store/personalStore.ts`
- [Draft storage](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/store/draftStore.ts): `src/lib/store/draftStore.ts`

### Optional AI services

- [BYOK settings](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/store/settingsStore.ts): `src/lib/store/settingsStore.ts`
- [Chat API](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/app/api/chat/route.ts): `src/app/api/chat/route.ts`
- [LLM client](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/llm/client.ts): `src/lib/llm/client.ts`
- [LLM providers](https://github.com/himanshumohanty-git24/gitaviswa/blob/main/src/lib/llm/providers.ts): `src/lib/llm/providers.ts`

### Other components

- **LLM service**

## Connections

- Home and navigation → 3D graph explore: opens (evidence: `src/app/page.tsx`)
- Home and navigation → Lineage view: opens (evidence: `src/app/page.tsx`)
- Home and navigation → Verse reader: opens (evidence: `src/app/page.tsx`)
- Home and navigation → Recitation player: opens (evidence: `src/app/page.tsx`)
- Home and navigation → Ask chatbot: opens (evidence: `src/app/page.tsx`)
- Home and navigation → Personal mind map: opens (evidence: `src/app/page.tsx`)
- Home and navigation → Home graph preview: renders (evidence: `src/app/page.tsx`)
- 3D graph explore → App graph state: reads state (evidence: `src/components/graph/CosmicGraph3D.tsx`)
- 3D graph explore → Graph structures: uses graph (evidence: `src/components/graph/CosmicGraph3D.tsx`)
- 3D graph explore → Scripture data loader: loads data (evidence: `src/components/graph/CosmicGraph3D.tsx`)
- Lineage view → Path finder: shows paths (evidence: `README.md`)
- Verse reader → Scripture data loader: loads verses (evidence: `README.md`)
- Commentary perspectives → Scripture data loader: loads commentary (evidence: `src/components/reader/Perspectives.tsx`)
- Home graph preview → Scripture data loader: loads graph (evidence: `src/components/home/GraphPreview.tsx`)
- Home graph preview → Graph structures: uses graph (evidence: `src/components/home/GraphPreview.tsx`)
- App graph state → Scripture data loader: loads scripture (evidence: `src/lib/store/useGitaStore.ts`)
- App graph state → Graph structures: builds graphs (evidence: `src/lib/store/useGitaStore.ts`)
- App graph state → Hybrid search index: builds index (evidence: `src/lib/store/useGitaStore.ts`)
- Ask chatbot → Graph retrieval: retrieves context (evidence: `src/components/chat/GraphRagChatbot.tsx`)
- Ask chatbot → Hybrid search index: embeds query (evidence: `src/components/chat/GraphRagChatbot.tsx`)
- Graph retrieval → Hybrid search index: searches index (evidence: `src/lib/graphrag/engine.ts`)
- Graph retrieval → Graph structures: traverses graph (evidence: `src/lib/graphrag/engine.ts`)
- Personal mind map → Thought storage: loads thoughts (evidence: `src/components/manas/PersonalMindMapper.tsx`)
- Personal mind map → Draft storage: uses drafts (evidence: `src/components/manas/PersonalMindMapper.tsx`)
- Personal mind map → Graph retrieval: suggests links (evidence: `src/components/manas/PersonalMindMapper.tsx`)
- Chat API → Graph retrieval: retrieves context (evidence: `src/app/api/chat/route.ts`)
- Chat API → LLM client: opens stream (evidence: `src/app/api/chat/route.ts`)
- Chat API → LLM providers: resolves provider (evidence: `src/app/api/chat/route.ts`)
- LLM client → LLM providers: uses registry (evidence: `src/lib/llm/client.ts`)
- LLM client → LLM service: sends requests (evidence: `src/lib/llm/client.ts`)
- BYOK settings → LLM providers: selects provider (evidence: `src/lib/store/settingsStore.ts`)
- Chat API → LLM service: generates answer
