BrandVoice — Multi-Tenant RAG Editorial Platform

BrandVoice — Multi-Tenant RAG Editorial Platform An architecture diagram generated by Archify. Supabase Auth · single Google Workspace · Runs locally — Supabase + Inngest in Docker Supabase Auth single Google Workspace Model Allowlist · mirrors app.ai_models · Runs locally — Supabase + Inngest in Docker Model Allowlist mirrors app.ai_models Editor UI · React 19 · Tiptap · Architecture component Editor UI React 19 · Tiptap App Router Server · handlers + server actions · Runs locally — Supabase + Inngest in Docker App Router Server handlers + server actions Inngest · durable background jobs · Runs locally — Supabase + Inngest in Docker Inngest durable background jobs Generation Pipeline · 5 traced steps · Runs locally — Supabase + Inngest in Docker Generation Pipeline 5 traced steps Model APIs · Anthropic · OpenAI · Architecture component Model APIs Anthropic · OpenAI Ingestion · parse → chunk → embed · Runs locally — Supabase + Inngest in Docker › per-brand data plane · row-level security Ingestion parse → chunk → embed Retrieval · match_brand_chunks · Runs locally — Supabase + Inngest in Docker › per-brand data plane · row-level security Retrieval match_brand_chunks Postgres + pgvector · RLS · halfvec(1536) · Runs locally — Supabase + Inngest in Docker › per-brand data plane · row-level security Postgres + pgvector RLS · halfvec(1536) HTTPS OAuth hd=domain emit event SQL under user JWT ingest-brand-docs chunks + embeddings generate-article validate model brand context cosine top-k Vercel AI SDK Runs locally — Supabase + Inngest in Docker per-brand data plane · row-level security Legend Frontend Backend Database Security Message bus External

Retrieval invariant

  • • text-embedding-3-large is requested at 1536 dims, not its default 3072
  • • That matches the halfvec(1536) column and app.match_brand_chunks
  • • Ingestion and retrieval import model and dimension from one module

Access control

  • • Sign-in restricted to one Google Workspace domain
  • • Enforced in the OAuth hd param, the callback, and a Postgres trigger
  • • Permission = global role × per-brand role

Evidence

  • • .docx uploads land in Supabase Storage, then embed in batches of 100
  • • Every generation writes a costed row to app.generations
  • • Only the model API call leaves the machine