---
name: supabase-lead-database
description: Defines a Supabase lead schema (people, companies, campaign log) deduplicated by email/LinkedIn/domain, with review queries and export.
---

# Supabase Lead Database

## What it does
Creates a central, source-agnostic lead database with people, companies, and a campaign send log tables, automatically deduplicated via an upsert function.

## When to use it
Use it when combining leads from multiple sources (scraping, forms, imports) and you need to avoid duplicates and repeat contacts before sending any campaign.

## Schema
1. People table: identity, email, LinkedIn URL, associated company.
2. Companies table: domain, name, basic firmographic data.
3. Campaign log: which lead received which send and when.

## Deduplication
4. A single upsert function deduplicates by email, LinkedIn URL, and domain on every insert.

## Useful queries
5. Query to review pending duplicates.
6. Query for leads not contacted in the last N days.
7. Filtered CSV export for the sending tool in use.

## GoHighLevel angle
8. The exported CSV can be imported as a contact list in GHL; the Supabase database remains the source of truth to avoid duplicates across campaigns.

## Safety rules
1. Every deliverable (script, email, post, ad, design) is produced as a draft first.
2. Nothing is sent, published, or paid for without explicit human approval.
3. Never invent metrics, testimonials, customer names, or data not present in the provided sources.
4. No credential, API key, or token is ever written or pasted into chat; reference environment variables instead.
