Skip to content

Data Model ​

Storage Ownership ​

Canonical content, user-scoped records, derived search state, generated audio, and local SQL tables have separate ownership boundaries.
DataStorageNotes
ChannelsGCSchannels/{id}.json canonical channel records
VideoslibSQLvideos table for canonical video records and queue state
Transcripts, summaries, video infoGCSCanonical content blobs
User channel subscriptionsGCSuser-channel-subscriptions/{user_id}
User video memberships and view stateGCSuser-video-memberships/* and user-video-states/*
Search chunksGCSDerived keyword projection
Search sourcesGCSDerived projection metadata
ConversationsGCSAuthenticated user chat history
HighlightsGCSAuthenticated user annotations
Writing flagsGCSwriting-flags/{user_id}/, style feedback for summaries
User preferenceslibSQLpreferences table keyed by user_id
TTS statisticslibSQLtts_stats table global aggregate row

Browser storage is cache and UI state only. IndexedDB, localStorage, and sessionStorage do not own canonical content or user records.

Canonical Content ​

Canonical content is owned by ingest and processing. It is separate from user overlays and derived search state.

RecordRole
channelsCanonical channel metadata
videosCanonical per-video metadata plus transcript/summary processing state
transcriptsExtracted raw text and formatted markdown transcript forms
summariesGenerated or manually edited summaries plus quality fields
video_infoExtended metadata such as description, duration, and view count

videos carries lifecycle state:

  • transcript_status
  • summary_status
  • retry_count
  • quality_score

The status values are:

  • pending
  • loading
  • ready
  • failed

User-facing fields such as acknowledged are overlays from user-scoped records.

User-Scoped Library Records ​

Most user-owned library state lives in GCS under user-specific prefixes.

PrefixRole
user-channel-subscriptions/{user_id}/Channel subscriptions plus per-subscription sync settings
user-video-memberships/{user_id}/Explicitly added videos, including the virtual Others view
user-video-states/{user_id}/Per-user overlays such as acknowledged

These records are loaded into request scope so the backend can authorize and shape channel, video, search, and chat responses for the caller.

Highlights ​

Highlights are authenticated user annotations under user-highlights/{user_id}/.

Each highlight stores:

  • id
  • video_id
  • source: transcript or summary
  • text
  • prefix_context
  • suffix_context
  • created_at

Grouping highlights by route or view is API behavior, not storage ownership.

Writing flags ​

Writing flags are passages of a summary that a signed-in reader marked as bad writing, stored under writing-flags/{user_id}/{id}.json. Each flag stores id, video_id, text, comment, prefix_context, suffix_context, and created_at.

The summary writer reads every flag from every reader and adds them to the summary prompt as style feedback, newest first. Each note goes in whole; a flagged passage longer than 400 characters is shortened. Summaries stay shared between readers, so every reader's flags shape every summary.

Chat Storage ​

Persistent chat conversations are authenticated user records in GCS.

StorageRole
user-conversations/{user_id}/index.jsonConversation list index with titles and timestamps
user-conversations/{user_id}/{id}.jsonFull conversation with messages and sources

Conversation records store:

  • id
  • title
  • created_at
  • updated_at
  • messages

Message records store:

  • id
  • role
  • content
  • status
  • sources for assistant messages

Sources reference search chunks for attribution. Signed-out chat stays in the frontend's ephemeral session path and does not write these GCS records.

Search Projection ​

Search is derived state. It can be rebuilt without rewriting canonical transcripts, summaries, or video metadata.

Canonical transcript and summary records feed derived search source and chunk records. Search indexing then maintains keyword and vector indexes from those chunks.

search_sources ​

One record per (video_id, source_kind) pair:

  • content_hash
  • source_generation
  • embedding_model
  • index_status
  • last_indexed_at
  • last_error

search_chunks ​

Each chunk is a GCS object with:

  • search_source_id
  • source_generation
  • chunk_index
  • section_title
  • chunk_text
  • start_sec
  • token_count

The local libSQL FTS index is a runtime keyword index built from search_chunks. Semantic vector search is disabled in the current GCS-only runtime.

If the projection schema changes, the backend can drop and recreate search_sources and search_chunks.

Search coverage counts use readiness flags from videos instead of scanning large transcript or summary text blobs.

Generated Audio Cache ​

Summary audio is a derived cache generated from the current summary text when Google Cloud Text-to-Speech is enabled.

Storage key:

text
summary-audio/{video_id}/{audio_hash}.{ext}

The cache key includes:

  • current summary content
  • Google TTS voice
  • Google TTS language
  • Google TTS output settings

If the summary or TTS settings change, the cache key changes and old audio is not reused.

libSQL Tables ​

The runtime stores selected app state in a local libSQL file and reconciles it from GCS-backed snapshots when needed.

videos ​

Stores canonical video records, queue state, retry counts, and summary quality mirrors.

Field groupDescription
metadataVideo id, channel id, title, publish timestamp
processing statetranscript_status, summary_status, retry_count
quality mirrorquality_score copied from summary evaluation output

preferences ​

Per-authenticated-user preferences.

FieldDescription
channel_orderOrdered list of channel IDs
channel_sort_modeSort mode: custom, alpha, newest
vocabulary_replacementsCustom word replacements for summaries

Rows are keyed by Firebase user id. On first authenticated access, the backend can copy the legacy single-user row preferences.user_id = "user" forward.

tts_stats ​

Global TTS generation metrics in the row id = "global".

FieldDescription
sample_countCompleted TTS generations
total_wordsCumulative words processed
total_duration_secsCumulative synthesis duration

These values estimate synthesis time for future TTS requests.

Storage Rules ​

Canonical Before Derived ​

Canonical records are written first. Derived search state, generated audio, and runtime indexes can be rebuilt later.

User State Stays Scoped ​

User-owned records are keyed by authenticated user id or held in an ephemeral signed-out path. Browser caches must be keyed by auth scope.

Search Chunks Are Disposable ​

Search chunks are derived from canonical transcript and summary content. They can be dropped and rebuilt.