Database Architecture

Powered by Supabase and PostgreSQL, utilizing Edge Functions, pgvector, and Row Level Security for infinite scale and compliance.

Entity Relationship Diagram

companiesid: uuid (PK)name: textats_config: jsonbinterviewsid: uuid (PK)company_id (FK)status: enumconfig: jsonbsessionsid: uuid (PK)interview_id (FK)candidate_id (FK)score_data: jsonbtelemetry_ref: textmemory_vectorsid: uuid (PK)session_id (FK)embedding: vector(1536)content: text

pgvector for AI Memory

We leverage the Postgres `pgvector` extension natively to store and query highly dimensional embeddings of the interview transcript. This allows the AI agent to instantly recall context from minutes prior using Cosine Similarity matching without bloating the LLM prompt context window.

-- Example similarity search
SELECT content
FROM memory_vectors
WHERE session_id = 'uuid'
ORDER BY embedding <-> '[0.1, 0.2, ...]'
LIMIT 5;

Row Level Security (RLS)

Absolute multi-tenant isolation. Utilizing Supabase's native RLS, database queries executed via the client or edge functions are automatically scoped to the authenticated user's `tenant_id`. Data crossover is cryptographically impossible at the database layer.

-- Immutable tenant isolation
CREATE POLICY tenant_isolation ON sessions
FOR ALL
USING (
  company_id = auth.jwt()->>'company_id'
);