# rpavani1998/memoiary architecture

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

- Interactive diagram: https://gitdiagram.com/rpavani1998/memoiary
- Repository: https://github.com/rpavani1998/memoiary

## Overview

Memoiary is a personal journaling app backed by an autobiographical memory engine. The main workflow is capturing text or media, analyzing it with Gemini, saving and reconciling memory data, then finding or reflecting on those memories. The README also documents timeline, collections, people/places, events, intentions, graph, and storyboard capabilities. Some routes and UI components were not sampled, so uncertain wiring is omitted; documented features are shown without asserting unverified calls.

Main entry points: [`app/page.tsx`](https://github.com/rpavani1998/memoiary/blob/main/app/page.tsx) (Journal app), [`app/api/gemini/analyze/route.ts`](https://github.com/rpavani1998/memoiary/blob/main/app/api/gemini/analyze/route.ts) (Capture analysis), [`lib/memory-engine/store.ts`](https://github.com/rpavani1998/memoiary/blob/main/lib/memory-engine/store.ts) (Memory store), [`lib/gemini.ts`](https://github.com/rpavani1998/memoiary/blob/main/lib/gemini.ts) (Gemini AI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Journal experience"]
  node_app["Journal app<br/>[page.tsx]"]
  node_timeline["Timeline views<br/>[TimelineView.tsx]"]
  node_recaps["Storyboards and recaps"]
  node_collections["Collections and graph"]
  node_elements["People, events, wishes"]
  node_chatui["Reflection chat"]
end

subgraph group_capture["Capture and analysis"]
  node_captureui["Text and voice capture"]
  node_mediahook["Media recording<br/>[useMediaCapture.ts]"]
  node_captureapi["Capture endpoint<br/>[route.ts]"]
  node_mediaapi["Media analysis<br/>[route.ts]"]
  node_analyze["Capture analysis<br/>[route.ts]"]
end

subgraph group_memory["Memory engine"]
  node_extractor["Dimension extraction<br/>[extractor.ts]"]
  node_reconcile["Graph reconciliation<br/>[reconciliation.ts]"]
  node_retriever["Context retrieval<br/>[retriever.ts]"]
  node_persongraph["Person identities<br/>[person-graph.ts]"]
  node_store["Memory store<br/>[store.ts]"]
end

subgraph group_reflection["Search and reflection"]
  node_searchapi["Memory search<br/>[route.ts]"]
  node_chatapi["Memory chat<br/>[route.ts]"]
  node_insights["Journal insights<br/>[route.ts]"]
  node_storyboardapi["Storyboard synthesis<br/>[route.ts]"]
end

subgraph group_services["External services"]
  node_gemini["Gemini AI<br/>[gemini.ts]"]
  node_firestore[("Cloud Firestore")]
  node_firebaseadmin["Firebase token verification<br/>[firebase-admin.ts]"]
end

node_user(("Journal user"))

node_user -->|"uses"| node_app
node_app -->|"starts capture"| node_captureui
node_captureui -->|"records media"| node_mediahook
node_captureui -->|"submits capture"| node_captureapi
node_mediahook -.->|"sends media"| node_mediaapi
node_captureapi -->|"verifies token"| node_firebaseadmin
node_captureapi -->|"writes and reads"| node_firestore
node_analyze -->|"verifies token"| node_firebaseadmin
node_analyze -->|"generates analysis"| node_gemini
node_analyze -->|"saves capture"| node_store
node_analyze -->|"extracts bundle"| node_extractor
node_analyze -->|"reconciles bundle"| node_reconcile
node_reconcile -->|"updates graph"| node_store
node_store -->|"persists memory"| node_firestore
node_searchapi -->|"verifies token"| node_firebaseadmin
node_searchapi -->|"reads captures"| node_store
node_searchapi -->|"ranks matches"| node_gemini
node_chatapi -->|"verifies token"| node_firebaseadmin
node_chatapi -->|"retrieves context"| node_retriever
node_retriever -->|"reads memory"| node_store
node_chatapi -->|"generates response"| node_gemini
node_insights -->|"synthesizes insights"| node_gemini
node_storyboardapi -->|"resolves identities"| node_persongraph
node_storyboardapi -->|"synthesizes storyboard"| node_gemini
node_app -->|"presents memories"| node_timeline
node_app -->|"presents recaps"| node_recaps
node_app -->|"explores memories"| node_collections
node_app -->|"browses entities"| node_elements
node_app -->|"opens reflection"| node_chatui
node_chatui -->|"sends query"| node_chatapi
node_timeline -.->|"requests insights"| node_insights
node_recaps -.->|"requests synthesis"| node_storyboardapi
node_app -.->|"searches memories"| node_searchapi

click node_app "https://github.com/rpavani1998/memoiary/blob/main/app/page.tsx"
click node_timeline "https://github.com/rpavani1998/memoiary/blob/main/components/TimelineView.tsx"
click node_recaps "https://github.com/rpavani1998/memoiary/blob/main/components/WeeklyRecapBoard.tsx"
click node_collections "https://github.com/rpavani1998/memoiary/blob/main/components/UnifiedCollectionsGraphView.tsx"
click node_elements "https://github.com/rpavani1998/memoiary/blob/main/components/EntitiesViewSection.tsx"
click node_chatui "https://github.com/rpavani1998/memoiary/blob/main/components/ReflectionChatboard.tsx"
click node_captureui "https://github.com/rpavani1998/memoiary/blob/main/components/TextCaptureModal.tsx"
click node_mediahook "https://github.com/rpavani1998/memoiary/blob/main/lib/hooks/useMediaCapture.ts"
click node_captureapi "https://github.com/rpavani1998/memoiary/blob/main/app/api/v1/capture/route.ts"
click node_mediaapi "https://github.com/rpavani1998/memoiary/blob/main/app/api/v1/media/route.ts"
click node_analyze "https://github.com/rpavani1998/memoiary/blob/main/app/api/gemini/analyze/route.ts"
click node_extractor "https://github.com/rpavani1998/memoiary/blob/main/lib/memory-engine/extractor.ts"
click node_reconcile "https://github.com/rpavani1998/memoiary/blob/main/lib/memory-engine/reconciliation.ts"
click node_retriever "https://github.com/rpavani1998/memoiary/blob/main/lib/memory-engine/retriever.ts"
click node_persongraph "https://github.com/rpavani1998/memoiary/blob/main/lib/memory-engine/person-graph.ts"
click node_store "https://github.com/rpavani1998/memoiary/blob/main/lib/memory-engine/store.ts"
click node_searchapi "https://github.com/rpavani1998/memoiary/blob/main/app/api/v1/search/route.ts"
click node_chatapi "https://github.com/rpavani1998/memoiary/blob/main/app/api/gemini/chat/route.ts"
click node_insights "https://github.com/rpavani1998/memoiary/blob/main/app/api/gemini/insights/route.ts"
click node_storyboardapi "https://github.com/rpavani1998/memoiary/blob/main/app/api/v1/storyboard/route.ts"
click node_gemini "https://github.com/rpavani1998/memoiary/blob/main/lib/gemini.ts"
click node_firebaseadmin "https://github.com/rpavani1998/memoiary/blob/main/lib/firebase-admin.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_timeline,node_recaps,node_collections,node_elements,node_chatui,node_user toneBlue
class node_captureui,node_mediahook,node_captureapi,node_mediaapi,node_analyze toneAmber
class node_extractor,node_reconcile,node_retriever,node_persongraph,node_store toneMint
class node_searchapi,node_chatapi,node_insights,node_storyboardapi toneRose
class node_gemini,node_firestore,node_firebaseadmin toneIndigo
```

## Components

### Journal experience

- [Journal app](https://github.com/rpavani1998/memoiary/blob/main/app/page.tsx): `app/page.tsx`
- [Timeline views](https://github.com/rpavani1998/memoiary/blob/main/components/TimelineView.tsx): `components/TimelineView.tsx`
- [Storyboards and recaps](https://github.com/rpavani1998/memoiary/blob/main/components/WeeklyRecapBoard.tsx): `components/WeeklyRecapBoard.tsx`
- [Collections and graph](https://github.com/rpavani1998/memoiary/blob/main/components/UnifiedCollectionsGraphView.tsx): `components/UnifiedCollectionsGraphView.tsx`
- [People, events, wishes](https://github.com/rpavani1998/memoiary/blob/main/components/EntitiesViewSection.tsx): `components/EntitiesViewSection.tsx`
- [Reflection chat](https://github.com/rpavani1998/memoiary/blob/main/components/ReflectionChatboard.tsx): `components/ReflectionChatboard.tsx`

### Capture and analysis

- [Text and voice capture](https://github.com/rpavani1998/memoiary/blob/main/components/TextCaptureModal.tsx): `components/TextCaptureModal.tsx`
- [Media recording](https://github.com/rpavani1998/memoiary/blob/main/lib/hooks/useMediaCapture.ts): `lib/hooks/useMediaCapture.ts`
- [Capture endpoint](https://github.com/rpavani1998/memoiary/blob/main/app/api/v1/capture/route.ts): `app/api/v1/capture/route.ts`
- [Media analysis](https://github.com/rpavani1998/memoiary/blob/main/app/api/v1/media/route.ts): `app/api/v1/media/route.ts`
- [Capture analysis](https://github.com/rpavani1998/memoiary/blob/main/app/api/gemini/analyze/route.ts): `app/api/gemini/analyze/route.ts`

### Memory engine

- [Dimension extraction](https://github.com/rpavani1998/memoiary/blob/main/lib/memory-engine/extractor.ts): `lib/memory-engine/extractor.ts`
- [Graph reconciliation](https://github.com/rpavani1998/memoiary/blob/main/lib/memory-engine/reconciliation.ts): `lib/memory-engine/reconciliation.ts`
- [Context retrieval](https://github.com/rpavani1998/memoiary/blob/main/lib/memory-engine/retriever.ts): `lib/memory-engine/retriever.ts`
- [Person identities](https://github.com/rpavani1998/memoiary/blob/main/lib/memory-engine/person-graph.ts): `lib/memory-engine/person-graph.ts`
- [Memory store](https://github.com/rpavani1998/memoiary/blob/main/lib/memory-engine/store.ts): `lib/memory-engine/store.ts`

### Search and reflection

- [Memory search](https://github.com/rpavani1998/memoiary/blob/main/app/api/v1/search/route.ts): `app/api/v1/search/route.ts`
- [Memory chat](https://github.com/rpavani1998/memoiary/blob/main/app/api/gemini/chat/route.ts): `app/api/gemini/chat/route.ts`
- [Journal insights](https://github.com/rpavani1998/memoiary/blob/main/app/api/gemini/insights/route.ts): `app/api/gemini/insights/route.ts`
- [Storyboard synthesis](https://github.com/rpavani1998/memoiary/blob/main/app/api/v1/storyboard/route.ts): `app/api/v1/storyboard/route.ts`

### External services

- [Gemini AI](https://github.com/rpavani1998/memoiary/blob/main/lib/gemini.ts): `lib/gemini.ts`
- **Cloud Firestore**
- [Firebase token verification](https://github.com/rpavani1998/memoiary/blob/main/lib/firebase-admin.ts): `lib/firebase-admin.ts`

### Other components

- **Journal user**

## Connections

- Journal user → Journal app: uses
- Journal app → Text and voice capture: starts capture
- Text and voice capture → Media recording: records media
- Text and voice capture → Capture endpoint: submits capture
- Media recording → Media analysis: sends media
- Capture endpoint → Firebase token verification: verifies token
- Capture endpoint → Cloud Firestore: writes and reads
- Capture analysis → Firebase token verification: verifies token
- Capture analysis → Gemini AI: generates analysis
- Capture analysis → Memory store: saves capture
- Capture analysis → Dimension extraction: extracts bundle
- Capture analysis → Graph reconciliation: reconciles bundle
- Graph reconciliation → Memory store: updates graph
- Memory store → Cloud Firestore: persists memory
- Memory search → Firebase token verification: verifies token
- Memory search → Memory store: reads captures
- Memory search → Gemini AI: ranks matches
- Memory chat → Firebase token verification: verifies token
- Memory chat → Context retrieval: retrieves context
- Context retrieval → Memory store: reads memory
- Memory chat → Gemini AI: generates response
- Journal insights → Gemini AI: synthesizes insights
- Storyboard synthesis → Person identities: resolves identities
- Storyboard synthesis → Gemini AI: synthesizes storyboard
- Journal app → Timeline views: presents memories
- Journal app → Storyboards and recaps: presents recaps
- Journal app → Collections and graph: explores memories
- Journal app → People, events, wishes: browses entities
- Journal app → Reflection chat: opens reflection
- Reflection chat → Memory chat: sends query
- Timeline views → Journal insights: requests insights
- Storyboards and recaps → Storyboard synthesis: requests synthesis
- Journal app → Memory search: searches memories
