# lord-sampad/history-app architecture

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

- Interactive diagram: https://gitdiagram.com/lord-sampad/history-app
- Repository: https://github.com/lord-sampad/history-app

## Overview

This Expo app is a historical-learning and collecting experience: users browse historical events and reference material, ask AI-assisted questions, save discoveries, and build presentation boards or media vaults. The tree also shows distinct wiki, map, profile, and notification areas. The available excerpts confirm the archive’s saved-chat browsing, wiki search results, board persistence, authentication, and theme application; other feature branches are represented from their routes and component paths, but their runtime connections are not asserted where source was not shown.

Main entry points: [`src/app/today.tsx`](https://github.com/lord-sampad/history-app/blob/master/src/app/today.tsx) (Home and events), [`src/app/archive/index.tsx`](https://github.com/lord-sampad/history-app/blob/master/src/app/archive/index.tsx) (Archive hub), [`src/store/useAuthStore.ts`](https://github.com/lord-sampad/history-app/blob/master/src/store/useAuthStore.ts) (Authentication), [`src/context/ThemeContext.tsx`](https://github.com/lord-sampad/history-app/blob/master/src/context/ThemeContext.tsx) (Theme context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Historical discovery"]
  node_home["Home and events<br/>[today.tsx]"]
  node_archive["Archive hub<br/>[index.tsx]"]
  node_chat["Archive chat<br/>[chat.tsx]"]
  node_ai["AI responses<br/>[geminiService.ts]"]
  node_wiki["Wiki search<br/>[index.tsx]"]
  node_wikiarticle["Wiki articles<br/>[&#91;title&#93;.tsx]"]
  node_map["Historical map"]
  node_saved["Saved discoveries<br/>[saved.tsx]"]
  node_events[("Custom events")]
end

subgraph group_creation["Boards and vaults"]
  node_boards["Presentation boards"]
  node_paragraph["Narrative blocks<br/>[ParagraphBlock.tsx]"]
  node_exhibits["Exhibit browser"]
  node_vault[("Media vaults<br/>[useVaultStore.ts]")]
  node_museum["Museum sources"]
  node_images["Image search"]
  node_videos["Video archive<br/>[videos.tsx]"]
end

subgraph group_identity["Account and preferences"]
  node_profile["Profile settings"]
  node_auth[("Authentication<br/>[useAuthStore.ts]")]
end

subgraph group_shared["Shared services"]
  node_chatstate[("Chat sessions<br/>[useChatStore.ts]")]
  node_wikipedia["Wikipedia service<br/>[wikipedia.ts]"]
  node_boardstate[("Board state<br/>[useBoardStore.ts]")]
  node_supabase["Supabase<br/>[supabase.ts]"]
  node_themecontext["Theme context<br/>[ThemeContext.tsx]"]
  node_themeengine["Theme engine<br/>[themeEngine.ts]"]
  node_notifications["Notifications"]
end

node_visitor(("App user"))

node_visitor -.->|"browses"| node_home
node_visitor -.->|"opens"| node_archive
node_archive -->|"reads saved chats"| node_chatstate
node_archive -->|"opens article viewer"| node_wikiarticle
node_visitor -.->|"searches"| node_wiki
node_wiki -->|"searches pages"| node_wikipedia
node_visitor -.->|"creates boards"| node_boards
node_boards -.->|"loads and saves"| node_boardstate
node_paragraph -->|"updates block"| node_boardstate
node_visitor -.->|"browses media"| node_exhibits
node_exhibits -.->|"manages vaults"| node_vault
node_visitor -.->|"manages profile"| node_profile
node_profile -.->|"uses account state"| node_auth
node_auth -->|"authenticates and syncs"| node_supabase
node_themecontext -->|"reads preferences"| node_auth
node_themecontext -->|"applies theme"| node_themeengine
node_home -->|"loads historical entries"| node_wikipedia
node_home -.->|"shows custom events"| node_events

click node_home "https://github.com/lord-sampad/history-app/blob/master/src/app/today.tsx"
click node_archive "https://github.com/lord-sampad/history-app/blob/master/src/app/archive/index.tsx"
click node_chat "https://github.com/lord-sampad/history-app/blob/master/src/app/archive/chat.tsx"
click node_chatstate "https://github.com/lord-sampad/history-app/blob/master/src/store/useChatStore.ts"
click node_ai "https://github.com/lord-sampad/history-app/blob/master/src/services/geminiService.ts"
click node_wiki "https://github.com/lord-sampad/history-app/blob/master/src/app/wiki/index.tsx"
click node_wikiarticle "https://github.com/lord-sampad/history-app/blob/master/src/app/wiki/%5Btitle%5D.tsx"
click node_wikipedia "https://github.com/lord-sampad/history-app/blob/master/src/services/wikipedia.ts"
click node_map "https://github.com/lord-sampad/history-app/blob/master/src/components/map/HistoricalMapView.tsx"
click node_saved "https://github.com/lord-sampad/history-app/blob/master/src/app/saved.tsx"
click node_boards "https://github.com/lord-sampad/history-app/blob/master/src/components/board/BoardScreenContent.tsx"
click node_boardstate "https://github.com/lord-sampad/history-app/blob/master/src/store/useBoardStore.ts"
click node_paragraph "https://github.com/lord-sampad/history-app/blob/master/src/components/board/blocks/ParagraphBlock.tsx"
click node_exhibits "https://github.com/lord-sampad/history-app/blob/master/src/components/exhibits/ExhibitScreenContent.tsx"
click node_vault "https://github.com/lord-sampad/history-app/blob/master/src/store/useVaultStore.ts"
click node_museum "https://github.com/lord-sampad/history-app/blob/master/src/services/metMuseumService.ts"
click node_images "https://github.com/lord-sampad/history-app/blob/master/src/services/googleImageSearch.ts"
click node_videos "https://github.com/lord-sampad/history-app/blob/master/src/app/archive/videos.tsx"
click node_profile "https://github.com/lord-sampad/history-app/blob/master/src/components/profile/ProfileDashboard.tsx"
click node_auth "https://github.com/lord-sampad/history-app/blob/master/src/store/useAuthStore.ts"
click node_supabase "https://github.com/lord-sampad/history-app/blob/master/src/services/supabase.ts"
click node_themecontext "https://github.com/lord-sampad/history-app/blob/master/src/context/ThemeContext.tsx"
click node_themeengine "https://github.com/lord-sampad/history-app/blob/master/src/services/themeEngine.ts"
click node_events "https://github.com/lord-sampad/history-app/blob/master/src/store/useCustomEventStore.ts"
click node_notifications "https://github.com/lord-sampad/history-app/blob/master/src/services/notificationService.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_archive,node_chat,node_ai,node_wiki,node_wikiarticle,node_map,node_saved,node_events,node_visitor toneBlue
class node_boards,node_paragraph,node_exhibits,node_vault,node_museum,node_images,node_videos toneAmber
class node_profile,node_auth toneMint
class node_chatstate,node_wikipedia,node_boardstate,node_supabase,node_themecontext,node_themeengine,node_notifications toneRose
```

## Components

### Historical discovery

- [Home and events](https://github.com/lord-sampad/history-app/blob/master/src/app/today.tsx): `src/app/today.tsx`
- [Archive hub](https://github.com/lord-sampad/history-app/blob/master/src/app/archive/index.tsx): `src/app/archive/index.tsx`
- [Archive chat](https://github.com/lord-sampad/history-app/blob/master/src/app/archive/chat.tsx): `src/app/archive/chat.tsx`
- [AI responses](https://github.com/lord-sampad/history-app/blob/master/src/services/geminiService.ts): `src/services/geminiService.ts`
- [Wiki search](https://github.com/lord-sampad/history-app/blob/master/src/app/wiki/index.tsx): `src/app/wiki/index.tsx`
- [Wiki articles](https://github.com/lord-sampad/history-app/blob/master/src/app/wiki/%5Btitle%5D.tsx): `src/app/wiki/[title].tsx`
- [Historical map](https://github.com/lord-sampad/history-app/blob/master/src/components/map/HistoricalMapView.tsx): `src/components/map/HistoricalMapView.tsx`
- [Saved discoveries](https://github.com/lord-sampad/history-app/blob/master/src/app/saved.tsx): `src/app/saved.tsx`
- [Custom events](https://github.com/lord-sampad/history-app/blob/master/src/store/useCustomEventStore.ts): `src/store/useCustomEventStore.ts`

### Boards and vaults

- [Presentation boards](https://github.com/lord-sampad/history-app/blob/master/src/components/board/BoardScreenContent.tsx): `src/components/board/BoardScreenContent.tsx`
- [Narrative blocks](https://github.com/lord-sampad/history-app/blob/master/src/components/board/blocks/ParagraphBlock.tsx): `src/components/board/blocks/ParagraphBlock.tsx`
- [Exhibit browser](https://github.com/lord-sampad/history-app/blob/master/src/components/exhibits/ExhibitScreenContent.tsx): `src/components/exhibits/ExhibitScreenContent.tsx`
- [Media vaults](https://github.com/lord-sampad/history-app/blob/master/src/store/useVaultStore.ts): `src/store/useVaultStore.ts`
- [Museum sources](https://github.com/lord-sampad/history-app/blob/master/src/services/metMuseumService.ts): `src/services/metMuseumService.ts`
- [Image search](https://github.com/lord-sampad/history-app/blob/master/src/services/googleImageSearch.ts): `src/services/googleImageSearch.ts`
- [Video archive](https://github.com/lord-sampad/history-app/blob/master/src/app/archive/videos.tsx): `src/app/archive/videos.tsx`

### Account and preferences

- [Profile settings](https://github.com/lord-sampad/history-app/blob/master/src/components/profile/ProfileDashboard.tsx): `src/components/profile/ProfileDashboard.tsx`
- [Authentication](https://github.com/lord-sampad/history-app/blob/master/src/store/useAuthStore.ts): `src/store/useAuthStore.ts`

### Shared services

- [Chat sessions](https://github.com/lord-sampad/history-app/blob/master/src/store/useChatStore.ts): `src/store/useChatStore.ts`
- [Wikipedia service](https://github.com/lord-sampad/history-app/blob/master/src/services/wikipedia.ts): `src/services/wikipedia.ts`
- [Board state](https://github.com/lord-sampad/history-app/blob/master/src/store/useBoardStore.ts): `src/store/useBoardStore.ts`
- [Supabase](https://github.com/lord-sampad/history-app/blob/master/src/services/supabase.ts): `src/services/supabase.ts`
- [Theme context](https://github.com/lord-sampad/history-app/blob/master/src/context/ThemeContext.tsx): `src/context/ThemeContext.tsx`
- [Theme engine](https://github.com/lord-sampad/history-app/blob/master/src/services/themeEngine.ts): `src/services/themeEngine.ts`
- [Notifications](https://github.com/lord-sampad/history-app/blob/master/src/services/notificationService.ts): `src/services/notificationService.ts`

### Other components

- **App user**

## Connections

- App user → Home and events: browses
- App user → Archive hub: opens
- Archive hub → Chat sessions: reads saved chats (evidence: `src/app/archive/index.tsx`)
- Archive hub → Wiki articles: opens article viewer (evidence: `src/app/archive/index.tsx`)
- App user → Wiki search: searches
- Wiki search → Wikipedia service: searches pages (evidence: `src/app/wiki/index.tsx`)
- App user → Presentation boards: creates boards
- Presentation boards → Board state: loads and saves
- Narrative blocks → Board state: updates block (evidence: `src/components/board/blocks/ParagraphBlock.tsx`)
- App user → Exhibit browser: browses media
- Exhibit browser → Media vaults: manages vaults
- App user → Profile settings: manages profile
- Profile settings → Authentication: uses account state
- Authentication → Supabase: authenticates and syncs (evidence: `src/store/useAuthStore.ts`)
- Theme context → Authentication: reads preferences (evidence: `src/context/ThemeContext.tsx`)
- Theme context → Theme engine: applies theme (evidence: `src/context/ThemeContext.tsx`)
- Home and events → Wikipedia service: loads historical entries (evidence: `src/app/today.tsx`)
- Home and events → Custom events: shows custom events
