CRM of Divya Padma Infosystem LLP
Real-time lead intake and qualification dashboard
Built to close the gap between ad spend and sales follow-up: leads land in Supabase the moment Meta's webhook fires, get auto-scored, and show up on a live dashboard the sales team actually uses — instead of a CSV export nobody opens fast enough.
Demo video coming soon
A full walkthrough of this project is in the works.
How It Works
Meta Ad
Lead form submitted
Webhook
Meta fires the lead event
Supabase
RLS-scoped upsert, deduplicated
Dashboard
Pushed live via Realtime
Technical Challenges
Row-Level Security for multi-role access
Sales reps needed to see only their assigned leads while admins saw everything — enforced at the database layer, not just hidden in the UI.
Supabase RLS policies keyed off a role column, so access control holds even if the client is bypassed.
create policy "reps see own leads"
on leads for select
using (auth.uid() = assigned_rep_id);Race condition on duplicate lead intake
Meta occasionally re-fires the same lead webhook, creating duplicate rows and double-counting results.
A unique constraint on the platform lead ID plus an upsert instead of a blind insert.
await supabase
.from("leads")
.upsert(lead, { onConflict: "platform_lead_id" });Realtime subscription silently going stale
The live dashboard would stop updating after long idle periods because the Supabase Realtime socket died without visibly disconnecting.
A heartbeat check that detects a stale connection and reconnects automatically.
channel.on("system", { event: "*" }, (status) => {
if (status === "CLOSED") channel.subscribe();
});