# rajiv9595/astroworld architecture

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

- Interactive diagram: https://gitdiagram.com/rajiv9595/astroworld
- Repository: https://github.com/rajiv9595/astroworld

## Overview

AstroWorld is a Vedic astrology platform combining a React client, deterministic chart computation, and AI-assisted consultation. The user workflow begins with birth details, computes canonical chart and timing facts, then synthesizes them with astrological rules and retrieved knowledge into grounded guidance and visualizations. Major capabilities also include career reasoning, dynamic research retrieval, persistent conversations, and printable reports. The README documents the high-level consultation flow; source excerpts and the index support selected internal links, so unsampled implementation details are not expanded into asserted call chains.

Main entry points: [`backend/src/ai/agent/consultAgent.ts`](https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/agent/consultAgent.ts) (Consultation agent), [`backend/src/ai/rag/dynamicRagEngine.ts`](https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/rag/dynamicRagEngine.ts) (Dynamic retrieval), [`shared/index.ts`](https://github.com/rajiv9595/astroworld/blob/main/shared/index.ts) (Shared engine exports), [`frontend/src/App.tsx`](https://github.com/rajiv9595/astroworld/blob/main/frontend/src/App.tsx) (Web application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client Experience"]
  node_app["Web application<br/>[App.tsx]"]
  node_chartui["Chart views<br/>[OverviewView.tsx]"]
  node_chatui["AI consultation UI"]
  node_report["Report compiler<br/>[reportEngine.ts]"]
  node_api["Backend API<br/>[server.ts]"]
end

subgraph group_kernel["Symbolic Astrology"]
  node_birth["Birth profile schema<br/>[birthProfile.ts]"]
  node_shared["Shared engine exports<br/>[index.ts]"]
  node_astronomy["Astronomical computation<br/>[astronomy.ts]"]
  node_ephemeris["Ephemeris calculations<br/>[ephemeris.ts]"]
  node_vargas["Divisional charts<br/>[vargas.ts]"]
  node_special["Sensitive points<br/>[specialPoints.ts]"]
end

subgraph group_consult["Consultation Intelligence"]
  node_tools["Astrology tools<br/>[astrologyTools.ts]"]
  node_council["Consultation agent<br/>[consultAgent.ts]"]
  node_reasoning["Astrology reasoning"]
  node_career["Career reasoning"]
  node_claims["Grounding firewall"]
  node_narrator["Consultation narrator<br/>[geminiNarrator.ts]"]
end

subgraph group_knowledge["Knowledge and Memory"]
  node_rag["Dynamic retrieval"]
  node_corpus[("Astrology knowledge corpus<br/>[knowledgeBase.ts]")]
  node_mastercorpus[("Master knowledge corpus")]
  node_techcorpus[("Specialization corpus")]
  node_research[("Research rules")]
  node_ingest["Document ingestion"]
  node_conversation["Conversation state"]
  node_memory["Persistent memory"]
  node_storage[("Supabase service<br/>[supabaseService.ts]")]
end

node_user(("AstroWorld user"))

node_user -->|"enters birth details"| node_app
node_app -->|"shows chart"| node_chartui
node_app -.->|"requests services"| node_api
node_chatui -.->|"sends consultation"| node_api
node_app -.->|"compiles report"| node_report
node_api -.->|"routes consultation"| node_council
node_birth -->|"validates profile"| node_tools
node_tools -->|"uses calculations"| node_shared
node_shared -->|"exports"| node_astronomy
node_shared -->|"exports"| node_ephemeris
node_shared -->|"exports"| node_vargas
node_shared -->|"exports"| node_special
node_council -.->|"requests chart facts"| node_tools
node_council -.->|"synthesizes analysis"| node_reasoning
node_council -.->|"supports career advice"| node_career
node_council -.->|"retrieves evidence"| node_rag
node_council -.->|"checks claims"| node_claims
node_claims -.->|"grounds narration"| node_narrator
node_rag -->|"loads records"| node_corpus
node_rag -->|"loads records"| node_mastercorpus
node_rag -->|"loads records"| node_techcorpus
node_ingest -->|"adds documents"| node_rag
node_rag -.->|"retrieves rules"| node_research
node_council -.->|"uses conversation context"| node_conversation
node_council -.->|"uses persistent memory"| node_memory
node_memory -.->|"persists memory"| node_storage

click node_app "https://github.com/rajiv9595/astroworld/blob/main/frontend/src/App.tsx"
click node_chartui "https://github.com/rajiv9595/astroworld/blob/main/frontend/src/views/OverviewView.tsx"
click node_chatui "https://github.com/rajiv9595/astroworld/blob/main/frontend/src/views/AIAstrologerView.tsx"
click node_report "https://github.com/rajiv9595/astroworld/blob/main/frontend/src/report/reportEngine.ts"
click node_api "https://github.com/rajiv9595/astroworld/blob/main/backend/src/server.ts"
click node_birth "https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/schemas/birthProfile.ts"
click node_shared "https://github.com/rajiv9595/astroworld/blob/main/shared/index.ts"
click node_astronomy "https://github.com/rajiv9595/astroworld/blob/main/shared/engine/astronomy.ts"
click node_ephemeris "https://github.com/rajiv9595/astroworld/blob/main/shared/engine/ephemeris.ts"
click node_vargas "https://github.com/rajiv9595/astroworld/blob/main/shared/engine/vargas.ts"
click node_special "https://github.com/rajiv9595/astroworld/blob/main/shared/engine/specialPoints.ts"
click node_tools "https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/tools/astrologyTools.ts"
click node_council "https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/agent/consultAgent.ts"
click node_reasoning "https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/reasoning/astrologyReasoner.ts"
click node_career "https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/career/careerReasoningEngine.ts"
click node_claims "https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/claims/groundingFirewall.ts"
click node_narrator "https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/narrator/geminiNarrator.ts"
click node_rag "https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/rag/dynamicRagEngine.ts"
click node_corpus "https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/rag/knowledgeBase.ts"
click node_mastercorpus "https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/rag/masterKnowledgeCorpus.ts"
click node_techcorpus "https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/rag/specializationTechCorpus.ts"
click node_research "https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/research/researchRuleCorpus.ts"
click node_ingest "https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/rag/documentIngestionService.ts"
click node_conversation "https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/conversation/conversationState.ts"
click node_memory "https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/memory/userMemoryService.ts"
click node_storage "https://github.com/rajiv9595/astroworld/blob/main/backend/src/services/supabaseService.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_chartui,node_chatui,node_report,node_api,node_user toneBlue
class node_birth,node_shared,node_astronomy,node_ephemeris,node_vargas,node_special toneAmber
class node_tools,node_council,node_reasoning,node_career,node_claims,node_narrator toneMint
class node_rag,node_corpus,node_mastercorpus,node_techcorpus,node_research,node_ingest,node_conversation,node_memory,node_storage toneRose
```

## Components

### Client Experience

- [Web application](https://github.com/rajiv9595/astroworld/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Chart views](https://github.com/rajiv9595/astroworld/blob/main/frontend/src/views/OverviewView.tsx): `frontend/src/views/OverviewView.tsx`
- [AI consultation UI](https://github.com/rajiv9595/astroworld/blob/main/frontend/src/views/AIAstrologerView.tsx): `frontend/src/views/AIAstrologerView.tsx`
- [Report compiler](https://github.com/rajiv9595/astroworld/blob/main/frontend/src/report/reportEngine.ts): `frontend/src/report/reportEngine.ts`
- [Backend API](https://github.com/rajiv9595/astroworld/blob/main/backend/src/server.ts): `backend/src/server.ts`

### Symbolic Astrology

- [Birth profile schema](https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/schemas/birthProfile.ts): `backend/src/ai/schemas/birthProfile.ts`
- [Shared engine exports](https://github.com/rajiv9595/astroworld/blob/main/shared/index.ts): `shared/index.ts`
- [Astronomical computation](https://github.com/rajiv9595/astroworld/blob/main/shared/engine/astronomy.ts): `shared/engine/astronomy.ts`
- [Ephemeris calculations](https://github.com/rajiv9595/astroworld/blob/main/shared/engine/ephemeris.ts): `shared/engine/ephemeris.ts`
- [Divisional charts](https://github.com/rajiv9595/astroworld/blob/main/shared/engine/vargas.ts): `shared/engine/vargas.ts`
- [Sensitive points](https://github.com/rajiv9595/astroworld/blob/main/shared/engine/specialPoints.ts): `shared/engine/specialPoints.ts`

### Consultation Intelligence

- [Astrology tools](https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/tools/astrologyTools.ts): `backend/src/ai/tools/astrologyTools.ts`
- [Consultation agent](https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/agent/consultAgent.ts): `backend/src/ai/agent/consultAgent.ts`
- [Astrology reasoning](https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/reasoning/astrologyReasoner.ts): `backend/src/ai/reasoning/astrologyReasoner.ts`
- [Career reasoning](https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/career/careerReasoningEngine.ts): `backend/src/ai/career/careerReasoningEngine.ts`
- [Grounding firewall](https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/claims/groundingFirewall.ts): `backend/src/ai/claims/groundingFirewall.ts`
- [Consultation narrator](https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/narrator/geminiNarrator.ts): `backend/src/ai/narrator/geminiNarrator.ts`

### Knowledge and Memory

- [Dynamic retrieval](https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/rag/dynamicRagEngine.ts): `backend/src/ai/rag/dynamicRagEngine.ts`
- [Astrology knowledge corpus](https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/rag/knowledgeBase.ts): `backend/src/ai/rag/knowledgeBase.ts`
- [Master knowledge corpus](https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/rag/masterKnowledgeCorpus.ts): `backend/src/ai/rag/masterKnowledgeCorpus.ts`
- [Specialization corpus](https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/rag/specializationTechCorpus.ts): `backend/src/ai/rag/specializationTechCorpus.ts`
- [Research rules](https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/research/researchRuleCorpus.ts): `backend/src/ai/research/researchRuleCorpus.ts`
- [Document ingestion](https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/rag/documentIngestionService.ts): `backend/src/ai/rag/documentIngestionService.ts`
- [Conversation state](https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/conversation/conversationState.ts): `backend/src/ai/conversation/conversationState.ts`
- [Persistent memory](https://github.com/rajiv9595/astroworld/blob/main/backend/src/ai/memory/userMemoryService.ts): `backend/src/ai/memory/userMemoryService.ts`
- [Supabase service](https://github.com/rajiv9595/astroworld/blob/main/backend/src/services/supabaseService.ts): `backend/src/services/supabaseService.ts`

### Other components

- **AstroWorld user**

## Connections

- AstroWorld user → Web application: enters birth details (evidence: `frontend/src/App.tsx`)
- Web application → Chart views: shows chart (evidence: `frontend/src/App.tsx`)
- Web application → Backend API: requests services (evidence: `README.md`)
- AI consultation UI → Backend API: sends consultation (evidence: `README.md`)
- Web application → Report compiler: compiles report
- Backend API → Consultation agent: routes consultation (evidence: `README.md`)
- Birth profile schema → Astrology tools: validates profile (evidence: `backend/src/ai/tools/astrologyTools.ts`)
- Astrology tools → Shared engine exports: uses calculations (evidence: `backend/src/ai/tools/astrologyTools.ts`)
- Shared engine exports → Astronomical computation: exports (evidence: `shared/index.ts`)
- Shared engine exports → Ephemeris calculations: exports (evidence: `shared/index.ts`)
- Shared engine exports → Divisional charts: exports (evidence: `shared/index.ts`)
- Shared engine exports → Sensitive points: exports (evidence: `shared/index.ts`)
- Consultation agent → Astrology tools: requests chart facts (evidence: `README.md`)
- Consultation agent → Astrology reasoning: synthesizes analysis (evidence: `README.md`)
- Consultation agent → Career reasoning: supports career advice
- Consultation agent → Dynamic retrieval: retrieves evidence (evidence: `README.md`)
- Consultation agent → Grounding firewall: checks claims (evidence: `README.md`)
- Grounding firewall → Consultation narrator: grounds narration (evidence: `README.md`)
- Dynamic retrieval → Astrology knowledge corpus: loads records (evidence: `backend/src/ai/rag/dynamicRagEngine.ts`)
- Dynamic retrieval → Master knowledge corpus: loads records (evidence: `backend/src/ai/rag/dynamicRagEngine.ts`)
- Dynamic retrieval → Specialization corpus: loads records (evidence: `backend/src/ai/rag/dynamicRagEngine.ts`)
- Document ingestion → Dynamic retrieval: adds documents (evidence: `backend/src/ai/rag/documentIngestionService.ts`)
- Dynamic retrieval → Research rules: retrieves rules
- Consultation agent → Conversation state: uses conversation context
- Consultation agent → Persistent memory: uses persistent memory
- Persistent memory → Supabase service: persists memory
