Reference: Data Contracts
This is the schema gospel. Any time we touch Supabase, we anchor back to these contracts from supabase/migrations/0001_init.sql.
profiles
Per-user metadata + AI preferences.
id uuidPK →auth.users(id)email text,display_name textfocus_tags text[]— mirrors selected focus topics for quick querying.ai_settings jsonb— stores sliders, Gemini keys, etc.- Timestamps:
created_at,updated_at(auto-updated viahandle_updated_at).
sources
Every RSS feed or X handle a user follows.
id uuidPK,user_id uuidtype textenum (rss,twitter)url text(RSS) /handle text(Twitter)display_name text,status text,last_polled_at- Unique constraints on
(user_id, url)and(user_id, handle)prevent duplicates.
items
News stories pulled from sources.
id uuidPKsource_id uuidtitle text,summary text,url textpublished_at timestamptzmetadata jsonb— houses tweet metrics, Gemini summaries, popularity scores.focus_topics text[]content_hash text— dedupe fingerprint.- Unique
(source_id, url)keeps duplicates out.
user_item_scores
Future personalization hooks.
- Composite PK
(user_id, item_id) score numeric,seen_at timestamptz,dismissed boolean
bookmarks
Saved stories with resurfacing support.
id uuidPKuser_id uuid,item_id uuidbookmarked_at,surfaced_attimestamps
jobs
Ingestion audit trail.
id uuidPKsource_id uuidstatus text,attempts intscheduled_for,last_run_aterror text
RLS shorthand
Every table above has RLS enabled with policies scoped to auth.uid(). We only bypass RLS with the Supabase service-role key inside Edge Functions and cron handlers.