# hanamanth-28/heritage-guide architecture

> Architecture diagram of the GitHub repository hanamanth-28/heritage-guide, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hanamanth-28/heritage-guide
- Repository: https://github.com/hanamanth-28/heritage-guide

## Overview

This is a monument-discovery and heritage-guide web application: visitors can explore monument information and images, compare sites, identify monuments from images, and use multilingual translation, audio, and conversational guidance. The main user journey is represented from discovery through monument information, with recognition and language/audio as distinct capability branches. Source excerpts establish several internal calls, but do not show most page-to-component wiring; those connections are omitted or marked unverified. The README is empty, so capability coverage relies on the supplied file tree and source excerpts.

Main entry points: [`ki/app/api/chat/route.ts`](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/app/api/chat/route.ts) (Chat API), [`ki/lib/image-recognition.ts`](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/lib/image-recognition.ts) (Recognition engine), [`ki/lib/monument-data.ts`](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/lib/monument-data.ts) (Monument catalog), [`ki/app/api/monument-images/route.ts`](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/app/api/monument-images/route.ts) (Monument image API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Visitor experience"]
  node_home["Discovery home<br/>[page.tsx]"]
  node_monument_page["Monument detail<br/>[page.tsx]"]
  node_comparison["Monument comparison"]
  node_image_gallery["Image gallery"]
  node_image_api["Monument image API<br/>[route.ts]"]
  node_wikipedia_images["Wikipedia image search"]
end

subgraph group_content["Monument content"]
  node_monument_api["Monument lookup API<br/>[route.ts]"]
  node_monument_store[("Monument catalog<br/>[monument-data.ts]")]
end

subgraph group_recognition["Image recognition"]
  node_recognition_ui["Image upload<br/>[image-uploader.tsx]"]
  node_recognition_api["Recognition API<br/>[route.ts]"]
  node_recognition_engine["Recognition engine"]
  node_manual_override["Manual overrides"]
end

subgraph group_language["Language and audio"]
  node_translation_preview["Language preview"]
  node_translation_api["Translation API<br/>[route.ts]"]
  node_tts_voice_api["Voice RSS speech<br/>[route.ts]"]
  node_voice_rss["Voice RSS service"]
  node_tts_gtts_api["gTTS API<br/>[route.ts]"]
  node_tts_component["Speech controls<br/>[text-to-speech.tsx]"]
  node_flask_tts["Flask gTTS service<br/>[app.py]"]
  node_gtts_service["gTTS"]
end

subgraph group_guidance["Conversational guide"]
  node_chat_ui["Chat interface<br/>[chat-interface.tsx]"]
  node_chat_api["Chat API<br/>[route.ts]"]
  node_historical_guide["Historical characters"]
  node_openai["OpenAI"]
end

node_visitor(("Visitor"))

node_visitor -.->|"opens"| node_home
node_home -.->|"navigates"| node_monument_page
node_visitor -.->|"uploads image"| node_recognition_ui
node_visitor -.->|"compares sites"| node_comparison
node_visitor -.->|"selects language"| node_translation_preview
node_monument_api -->|"looks up"| node_monument_store
node_recognition_engine -->|"loads catalog"| node_monument_store
node_recognition_engine -->|"checks override"| node_manual_override
node_image_api -->|"searches images"| node_wikipedia_images
node_image_api -->|"generates fallback"| node_wikipedia_images
node_chat_api -->|"gets monument"| node_monument_store
node_chat_api -->|"gets character"| node_historical_guide
node_chat_api -->|"generates reply"| node_historical_guide
node_chat_api -->|"generates text"| node_openai
node_tts_voice_api -->|"requests audio"| node_voice_rss
node_flask_tts -->|"creates speech"| node_gtts_service
node_recognition_ui -.->|"submits image"| node_recognition_api
node_recognition_api -.->|"runs recognition"| node_recognition_engine
node_translation_preview -.->|"requests translation"| node_translation_api
node_tts_component -.->|"requests speech"| node_tts_gtts_api

click node_home "https://github.com/hanamanth-28/heritage-guide/blob/main/ki/app/page.tsx"
click node_monument_page "https://github.com/hanamanth-28/heritage-guide/blob/main/ki/app/monument/%5Bid%5D/page.tsx"
click node_comparison "https://github.com/hanamanth-28/heritage-guide/blob/main/ki/components/monument-comparison.tsx"
click node_image_gallery "https://github.com/hanamanth-28/heritage-guide/blob/main/ki/components/monument-image-gallery.tsx"
click node_image_api "https://github.com/hanamanth-28/heritage-guide/blob/main/ki/app/api/monument-images/route.ts"
click node_wikipedia_images "https://github.com/hanamanth-28/heritage-guide/blob/main/ki/lib/wikipedia-images.ts"
click node_monument_api "https://github.com/hanamanth-28/heritage-guide/blob/main/ki/app/api/monument/%5Bid%5D/route.ts"
click node_monument_store "https://github.com/hanamanth-28/heritage-guide/blob/main/ki/lib/monument-data.ts"
click node_recognition_ui "https://github.com/hanamanth-28/heritage-guide/blob/main/ki/components/image-uploader.tsx"
click node_recognition_api "https://github.com/hanamanth-28/heritage-guide/blob/main/ki/app/api/image-recognition/route.ts"
click node_recognition_engine "https://github.com/hanamanth-28/heritage-guide/blob/main/ki/lib/image-recognition.ts"
click node_manual_override "https://github.com/hanamanth-28/heritage-guide/blob/main/ki/lib/manual-recognition-override.ts"
click node_translation_preview "https://github.com/hanamanth-28/heritage-guide/blob/main/ki/components/language-preview.tsx"
click node_translation_api "https://github.com/hanamanth-28/heritage-guide/blob/main/ki/app/api/translate/route.ts"
click node_tts_voice_api "https://github.com/hanamanth-28/heritage-guide/blob/main/ki/app/api/tts-voicerss/route.ts"
click node_tts_gtts_api "https://github.com/hanamanth-28/heritage-guide/blob/main/ki/app/api/tts-gtts/route.ts"
click node_tts_component "https://github.com/hanamanth-28/heritage-guide/blob/main/ki/components/text-to-speech.tsx"
click node_flask_tts "https://github.com/hanamanth-28/heritage-guide/blob/main/ki/backend/app.py"
click node_chat_ui "https://github.com/hanamanth-28/heritage-guide/blob/main/ki/components/chat-interface.tsx"
click node_chat_api "https://github.com/hanamanth-28/heritage-guide/blob/main/ki/app/api/chat/route.ts"
click node_historical_guide "https://github.com/hanamanth-28/heritage-guide/blob/main/ki/lib/historical-characters.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_home,node_monument_page,node_comparison,node_image_gallery,node_image_api,node_wikipedia_images toneBlue
class node_monument_api,node_monument_store toneAmber
class node_recognition_ui,node_recognition_api,node_recognition_engine,node_manual_override toneMint
class node_translation_preview,node_translation_api,node_tts_voice_api,node_voice_rss,node_tts_gtts_api,node_tts_component,node_flask_tts,node_gtts_service toneRose
class node_chat_ui,node_chat_api,node_historical_guide,node_openai,node_visitor toneIndigo
```

## Components

### Visitor experience

- [Discovery home](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/app/page.tsx): `ki/app/page.tsx`
- [Monument detail](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/app/monument/%5Bid%5D/page.tsx): `ki/app/monument/[id]/page.tsx`
- [Monument comparison](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/components/monument-comparison.tsx): `ki/components/monument-comparison.tsx`
- [Image gallery](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/components/monument-image-gallery.tsx): `ki/components/monument-image-gallery.tsx`
- [Monument image API](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/app/api/monument-images/route.ts): `ki/app/api/monument-images/route.ts`
- [Wikipedia image search](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/lib/wikipedia-images.ts): `ki/lib/wikipedia-images.ts`

### Monument content

- [Monument lookup API](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/app/api/monument/%5Bid%5D/route.ts): `ki/app/api/monument/[id]/route.ts`
- [Monument catalog](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/lib/monument-data.ts): `ki/lib/monument-data.ts`

### Image recognition

- [Image upload](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/components/image-uploader.tsx): `ki/components/image-uploader.tsx`
- [Recognition API](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/app/api/image-recognition/route.ts): `ki/app/api/image-recognition/route.ts`
- [Recognition engine](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/lib/image-recognition.ts): `ki/lib/image-recognition.ts`
- [Manual overrides](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/lib/manual-recognition-override.ts): `ki/lib/manual-recognition-override.ts`

### Language and audio

- [Language preview](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/components/language-preview.tsx): `ki/components/language-preview.tsx`
- [Translation API](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/app/api/translate/route.ts): `ki/app/api/translate/route.ts`
- [Voice RSS speech](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/app/api/tts-voicerss/route.ts): `ki/app/api/tts-voicerss/route.ts`
- **Voice RSS service**
- [gTTS API](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/app/api/tts-gtts/route.ts): `ki/app/api/tts-gtts/route.ts`
- [Speech controls](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/components/text-to-speech.tsx): `ki/components/text-to-speech.tsx`
- [Flask gTTS service](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/backend/app.py): `ki/backend/app.py`
- **gTTS**

### Conversational guide

- [Chat interface](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/components/chat-interface.tsx): `ki/components/chat-interface.tsx`
- [Chat API](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/app/api/chat/route.ts): `ki/app/api/chat/route.ts`
- [Historical characters](https://github.com/hanamanth-28/heritage-guide/blob/main/ki/lib/historical-characters.ts): `ki/lib/historical-characters.ts`
- **OpenAI**

### Other components

- **Visitor**

## Connections

- Visitor → Discovery home: opens
- Discovery home → Monument detail: navigates
- Visitor → Image upload: uploads image
- Visitor → Monument comparison: compares sites
- Visitor → Language preview: selects language
- Monument lookup API → Monument catalog: looks up (evidence: `ki/app/api/monument/[id]/route.ts`)
- Recognition engine → Monument catalog: loads catalog (evidence: `ki/lib/image-recognition.ts`)
- Recognition engine → Manual overrides: checks override (evidence: `ki/lib/image-recognition.ts`)
- Monument image API → Wikipedia image search: searches images (evidence: `ki/app/api/monument-images/route.ts`)
- Monument image API → Wikipedia image search: generates fallback (evidence: `ki/app/api/monument-images/route.ts`)
- Chat API → Monument catalog: gets monument (evidence: `ki/app/api/chat/route.ts`)
- Chat API → Historical characters: gets character (evidence: `ki/app/api/chat/route.ts`)
- Chat API → Historical characters: generates reply (evidence: `ki/app/api/chat/route.ts`)
- Chat API → OpenAI: generates text (evidence: `ki/app/api/chat/route.ts`)
- Voice RSS speech → Voice RSS service: requests audio (evidence: `ki/app/api/tts-voicerss/route.ts`)
- Flask gTTS service → gTTS: creates speech (evidence: `ki/backend/app.py`)
- Image upload → Recognition API: submits image
- Recognition API → Recognition engine: runs recognition
- Language preview → Translation API: requests translation
- Speech controls → gTTS API: requests speech
