Link every step to the next in one tenant-scoped data model. SourceMate replaced a five-tool commercial stack with discovery, research, drafting, deals, engagements, phased invoicing and collections in one place — AI drafts and extracts under human approval, while Postgres rules own numbering, overdue status, balances and margin.
Alex Scharifker · Co-founder, product architect, and systems lead
SourceMate Clear Revenue Hub was designed and led by Alex Scharifker for SourceMate, the consultancy he co-founded in 2023.
The commercial function ran on a spreadsheet stack plus memory: prospects in a notes app, deals in a spreadsheet, invoices in a document template, payments in a bank statement. Nothing linked to the next thing, so 'which outreach produced revenue?' was unanswerable — while overdue AR was discovered by accident, vendor cost stayed invisible until close-out, and banking details sat in plaintext.
Sources in, deterministic logic in the middle, AI restricted to interpretation.
Data sources
Layers
Deterministic logic
Where AI is used
Decision loop
My role
Layer-by-layer architecture, deterministic model, AI guardrails, and the decision loop.
The commercial function ran on spreadsheets and memory, so nobody could answer which outreach produced revenue. This system closes the loop between selling effort and collected cash — with AI drafting and a human deciding.
Key takeaways
Architecture Principle
React 18 + Vite + TypeScript with TanStack Query as the only state boundary — roughly 25 typed domain hooks, no global store. Every query key carries the active org id, so switching tenants re-partitions the cache instead of filtering client-side.
Deterministic CRUD and aggregation go straight to PostgREST under row-level security. Anything needing a secret, an external call, or privileged logic goes to a Deno edge function — 15 of them. No API layer re-implements what SQL already enforces.
About 20 Postgres tables spanning demand generation, outreach, pipeline, delivery and finance. Every row is predicated on user_belongs_to_org(auth.uid(), org_id); roles live in a separate user_roles table behind a security-definer has_role().
Invoice numbering (AI-YYYY-NNN), overdue enforcement, and timestamps are Postgres triggers — not application code. The rule holds no matter which client path writes the row, so status can never drift out of sync with reality.
Every dollar on the dashboard traces back through payment → invoice → engagement phase → deal → outreach touch → the researched prospect that started it. That traceability is the product.

Get insights on product management and operations delivered to your inbox.
Subscribe on LinkedIn