# william-hon/mnemo architecture

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

- Interactive diagram: https://gitdiagram.com/william-hon/mnemo
- Repository: https://github.com/william-hon/mnemo

## Overview

MNEMO is a cross-platform, privacy-first journal and memory retrieval app. Users authenticate, unlock or set up encryption, then create text or voice entries; the client encrypts journal text before storage. Voice transcripts and entries are processed into embeddings for hybrid search, while retrieved memories can ground on-device local-LLM chat. History supports search and deletion; settings manage encryption and the local model, and admin screens handle failed processing. The README documents backend and model-hosting capabilities not fully visible in sampled source; those links are cited to it rather than inferred from imports.

Main entry points: [`src/services/entries.ts`](https://github.com/william-hon/mnemo/blob/main/src/services/entries.ts) (Entry service), [`supabase/functions/transcribe/index.ts`](https://github.com/william-hon/mnemo/blob/main/supabase/functions/transcribe/index.ts) (Transcription function), [`supabase/functions/process-entry/index.ts`](https://github.com/william-hon/mnemo/blob/main/supabase/functions/process-entry/index.ts) (Entry processing), [`src/services/LocalAIService.ts`](https://github.com/william-hon/mnemo/blob/main/src/services/LocalAIService.ts) (Local AI runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_auth["Sign-in and recovery<br/>[recovery.tsx]"]
  node_home["Journal capture<br/>[home.tsx]"]
  node_history["History and search<br/>[history.tsx]"]
  node_settings["Settings and model<br/>[settings.tsx]"]
  node_admin["Processing admin<br/>[admin.tsx]"]
end

subgraph group_privacy["Privacy and entries"]
  node_authstate["Auth state<br/>[AuthProvider.tsx]"]
  node_crypto["Client encryption<br/>[encryption.ts]"]
  node_entries["Entry service<br/>[entries.ts]"]
  node_audio["Audio capture<br/>[audio.ts]"]
  node_media["Audio storage<br/>[media.ts]"]
end

subgraph group_memory["Memory and local AI"]
  node_process["Entry processing<br/>[index.ts]"]
  node_searchfn["Vector search function<br/>[index.ts]"]
  node_edgecrypto["Edge encryption<br/>[encryption.ts]"]
  node_localai["Local AI runtime<br/>[LocalAIService.ts]"]
end

subgraph group_backend["Cloud services"]
  node_supabase["Supabase client<br/>[supabase.ts]"]
  node_store[("Postgres and storage")]
  node_transcribe["Transcription function<br/>[index.ts]"]
  node_download["Model download sessions<br/>[index.ts]"]
  node_downloadcomplete["Download completion<br/>[index.ts]"]
  node_deleteaccount["Account deletion<br/>[index.ts]"]
end

node_person(("Journal user"))
node_groq["Groq Whisper"]
node_r2["Cloudflare R2"]

node_person -->|"signs in"| node_auth
node_auth -->|"establishes session"| node_authstate
node_auth -->|"sets up keys"| node_crypto
node_home -->|"saves text"| node_entries
node_home -->|"captures voice"| node_audio
node_home -->|"uploads audio"| node_media
node_entries -->|"encrypts and decrypts"| node_crypto
node_entries -->|"reads and writes"| node_supabase
node_media -->|"stores audio"| node_supabase
node_history -->|"lists searches deletes"| node_entries
node_history -->|"asks about memories"| node_localai
node_admin -->|"retries processing"| node_entries
node_settings -->|"manages model"| node_localai
node_settings -->|"manages encryption"| node_crypto
node_supabase -->|"connects to"| node_store
node_entries -->|"invokes transcription"| node_transcribe
node_entries -->|"invokes indexing"| node_process
node_entries -->|"invokes vector search"| node_searchfn
node_transcribe -->|"transcribes audio"| node_groq
node_transcribe -->|"encrypts transcript"| node_edgecrypto
node_transcribe -->|"triggers indexing"| node_process
node_process -->|"decrypts and encrypts"| node_edgecrypto
node_process -->|"writes embeddings"| node_store
node_searchfn -->|"queries vectors"| node_store
node_entries -->|"stores encrypted entries"| node_store
node_localai -->|"requests signed URL"| node_download
node_download -->|"signs model URL"| node_r2
node_localai -->|"completes session"| node_downloadcomplete
node_downloadcomplete -->|"marks session complete"| node_store
node_person -.->|"requests account deletion"| node_deleteaccount
node_deleteaccount -->|"cascades user data"| node_store

click node_auth "https://github.com/william-hon/mnemo/blob/main/app/(auth)/recovery.tsx"
click node_home "https://github.com/william-hon/mnemo/blob/main/app/(tabs)/home.tsx"
click node_history "https://github.com/william-hon/mnemo/blob/main/app/(tabs)/history.tsx"
click node_settings "https://github.com/william-hon/mnemo/blob/main/app/(tabs)/settings.tsx"
click node_admin "https://github.com/william-hon/mnemo/blob/main/app/(tabs)/admin.tsx"
click node_authstate "https://github.com/william-hon/mnemo/blob/main/src/providers/AuthProvider.tsx"
click node_crypto "https://github.com/william-hon/mnemo/blob/main/src/lib/encryption.ts"
click node_entries "https://github.com/william-hon/mnemo/blob/main/src/services/entries.ts"
click node_audio "https://github.com/william-hon/mnemo/blob/main/src/services/audio.ts"
click node_media "https://github.com/william-hon/mnemo/blob/main/src/services/media.ts"
click node_supabase "https://github.com/william-hon/mnemo/blob/main/src/lib/supabase.ts"
click node_transcribe "https://github.com/william-hon/mnemo/blob/main/supabase/functions/transcribe/index.ts"
click node_process "https://github.com/william-hon/mnemo/blob/main/supabase/functions/process-entry/index.ts"
click node_searchfn "https://github.com/william-hon/mnemo/blob/main/supabase/functions/search-entries/index.ts"
click node_edgecrypto "https://github.com/william-hon/mnemo/blob/main/supabase/functions/shared/encryption.ts"
click node_localai "https://github.com/william-hon/mnemo/blob/main/src/services/LocalAIService.ts"
click node_download "https://github.com/william-hon/mnemo/blob/main/supabase/functions/private-ai-download-url/index.ts"
click node_downloadcomplete "https://github.com/william-hon/mnemo/blob/main/supabase/functions/complete-private-ai-download/index.ts"
click node_deleteaccount "https://github.com/william-hon/mnemo/blob/main/supabase/functions/delete-account/index.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_auth,node_home,node_history,node_settings,node_admin,node_person toneBlue
class node_authstate,node_crypto,node_entries,node_audio,node_media toneAmber
class node_process,node_searchfn,node_edgecrypto,node_localai toneMint
class node_supabase,node_store,node_transcribe,node_download,node_downloadcomplete,node_deleteaccount toneRose
class node_groq,node_r2 toneIndigo
```

## Components

### Client experience

- [Sign-in and recovery](https://github.com/william-hon/mnemo/blob/main/app/(auth)/recovery.tsx): `app/(auth)/recovery.tsx`
- [Journal capture](https://github.com/william-hon/mnemo/blob/main/app/(tabs)/home.tsx): `app/(tabs)/home.tsx`
- [History and search](https://github.com/william-hon/mnemo/blob/main/app/(tabs)/history.tsx): `app/(tabs)/history.tsx`
- [Settings and model](https://github.com/william-hon/mnemo/blob/main/app/(tabs)/settings.tsx): `app/(tabs)/settings.tsx`
- [Processing admin](https://github.com/william-hon/mnemo/blob/main/app/(tabs)/admin.tsx): `app/(tabs)/admin.tsx`

### Privacy and entries

- [Auth state](https://github.com/william-hon/mnemo/blob/main/src/providers/AuthProvider.tsx): `src/providers/AuthProvider.tsx`
- [Client encryption](https://github.com/william-hon/mnemo/blob/main/src/lib/encryption.ts): `src/lib/encryption.ts`
- [Entry service](https://github.com/william-hon/mnemo/blob/main/src/services/entries.ts): `src/services/entries.ts`
- [Audio capture](https://github.com/william-hon/mnemo/blob/main/src/services/audio.ts): `src/services/audio.ts`
- [Audio storage](https://github.com/william-hon/mnemo/blob/main/src/services/media.ts): `src/services/media.ts`

### Memory and local AI

- [Entry processing](https://github.com/william-hon/mnemo/blob/main/supabase/functions/process-entry/index.ts): `supabase/functions/process-entry/index.ts`
- [Vector search function](https://github.com/william-hon/mnemo/blob/main/supabase/functions/search-entries/index.ts): `supabase/functions/search-entries/index.ts`
- [Edge encryption](https://github.com/william-hon/mnemo/blob/main/supabase/functions/shared/encryption.ts): `supabase/functions/shared/encryption.ts`
- [Local AI runtime](https://github.com/william-hon/mnemo/blob/main/src/services/LocalAIService.ts): `src/services/LocalAIService.ts`

### Cloud services

- [Supabase client](https://github.com/william-hon/mnemo/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`
- **Postgres and storage**
- [Transcription function](https://github.com/william-hon/mnemo/blob/main/supabase/functions/transcribe/index.ts): `supabase/functions/transcribe/index.ts`
- [Model download sessions](https://github.com/william-hon/mnemo/blob/main/supabase/functions/private-ai-download-url/index.ts): `supabase/functions/private-ai-download-url/index.ts`
- [Download completion](https://github.com/william-hon/mnemo/blob/main/supabase/functions/complete-private-ai-download/index.ts): `supabase/functions/complete-private-ai-download/index.ts`
- [Account deletion](https://github.com/william-hon/mnemo/blob/main/supabase/functions/delete-account/index.ts): `supabase/functions/delete-account/index.ts`

### Other components

- **Journal user**
- **Groq Whisper**
- **Cloudflare R2**

## Connections

- Journal user → Sign-in and recovery: signs in
- Sign-in and recovery → Auth state: establishes session (evidence: `src/providers/AuthProvider.tsx`)
- Sign-in and recovery → Client encryption: sets up keys (evidence: `app/(auth)/recovery.tsx`)
- Journal capture → Entry service: saves text (evidence: `app/(tabs)/home.tsx`)
- Journal capture → Audio capture: captures voice (evidence: `app/(tabs)/home.tsx`)
- Journal capture → Audio storage: uploads audio (evidence: `app/(tabs)/home.tsx`)
- Entry service → Client encryption: encrypts and decrypts (evidence: `src/services/entries.ts`)
- Entry service → Supabase client: reads and writes (evidence: `src/services/entries.ts`)
- Audio storage → Supabase client: stores audio (evidence: `src/services/media.ts`)
- History and search → Entry service: lists searches deletes (evidence: `app/(tabs)/history.tsx`)
- History and search → Local AI runtime: asks about memories (evidence: `app/(tabs)/history.tsx`)
- Processing admin → Entry service: retries processing (evidence: `app/(tabs)/admin.tsx`)
- Settings and model → Local AI runtime: manages model (evidence: `app/(tabs)/settings.tsx`)
- Settings and model → Client encryption: manages encryption (evidence: `app/(tabs)/settings.tsx`)
- Supabase client → Postgres and storage: connects to
- Entry service → Transcription function: invokes transcription (evidence: `src/services/entries.ts`)
- Entry service → Entry processing: invokes indexing (evidence: `src/services/entries.ts`)
- Entry service → Vector search function: invokes vector search (evidence: `src/services/entries.ts`)
- Transcription function → Groq Whisper: transcribes audio
- Transcription function → Edge encryption: encrypts transcript (evidence: `supabase/functions/transcribe/index.ts`)
- Transcription function → Entry processing: triggers indexing
- Entry processing → Edge encryption: decrypts and encrypts (evidence: `supabase/functions/process-entry/index.ts`)
- Entry processing → Postgres and storage: writes embeddings
- Vector search function → Postgres and storage: queries vectors
- Entry service → Postgres and storage: stores encrypted entries
- Local AI runtime → Model download sessions: requests signed URL
- Model download sessions → Cloudflare R2: signs model URL
- Local AI runtime → Download completion: completes session (evidence: `src/services/LocalAIService.ts`)
- Download completion → Postgres and storage: marks session complete
- Journal user → Account deletion: requests account deletion
- Account deletion → Postgres and storage: cascades user data
