Skip to content

Repository files navigation

LeadRadar

A multi-tenant lead generation platform for finding high-value, in-need clients in the US, UK, UAE, Australia, Netherlands, Ireland (and 10 more tier-2 markets) — built to be used by your agency and resold as a white-label template to other businesses (real estate, consulting, recruiting…).

What's inside

Layer What it does
Lead engine Searches Apollo.io's 270M+ verified B2B database by country, title, industry, company size, keywords. No fragile scrapers — real API, verified emails.
Scoring engine Every lead scored 0–100 across 6 dimensions: geography tier, decision-making power, company-size sweet spot, industry fit, buying signals (hiring, funding, company age), reachability. Graded A–D, hot/warm/cold.
Pipeline Leads stored forever in Postgres (Supabase), searchable, filterable, status tracking (new → contacted → replied → qualified → won), activity log, one-click enrichment (verified email + phone), CSV export.
Multi-tenant SaaS Every signup gets an isolated organization (Postgres Row-Level Security — tenants can never see each other's data), a 14-day trial, and white-label branding (product name + accent color) plus an industry preset that re-targets the whole app.
Admin dashboard Platform-owner-only view: MRR, annual run-rate, customer list, plan breakdown, churn (30d), per-tenant usage. Auto-synced from Stripe via webhook.

v2 — The Outreach Engine (NEW)

Feature How it works
AI-personalized sequences Click "Draft AI sequence" on any lead → OpenAI (gpt-4o-mini) writes a 3-email cold sequence referencing that lead's actual buying signals (hiring, funding, industry). You review/edit every word before anything sends.
Automatic follow-ups Email 1 sends instantly; follow-ups go out on day 3 and day 7 — handled by a scheduled function every 15 min. No reply needed from you.
Reply detection + AI classification A second scheduled job reads your Gmail inbox, matches replies to leads, and classifies them: interested / not now / wrong person / unsubscribe / out of office. Any reply stops the sequence instantly. Unsubscribes are never emailed again.
Deliverability protection Per-account daily send limit (default 30/day — raise it slowly as your domain warms up), sequences pause automatically at the cap.

v2 setup additions

  1. Run supabase/migrations/002_outreach.sql in the Supabase SQL Editor (after 001).
  2. Get an OpenAI API key (platform.openai.com → API keys) → add OPENAI_API_KEY to Netlify env vars.
  3. In the app → Outreach tab → connect Gmail with an App Password: Google Account → Security → turn on 2-Step Verification → App passwords → create one for "Mail". (Normal passwords are rejected by Google.)
  4. Redeploy. The two scheduled functions (sequence-runner, inbox-sync) activate automatically via netlify.toml.

Outreach compliance (non-negotiable if you sell this)

  • Every AI draft ends with a built-in opt-out line; the classifier enforces it automatically.
  • Keep daily limits low for the first 2–3 weeks on any new Gmail account (deliverability warm-up).
  • Use a secondary domain (e.g. tryyouragency.com) for cold email — never your main domain.
  • GDPR markets (NL/UK/IE): identify your company in the signature, honor opt-outs instantly (the system does), keep records.

Architecture

React (Vite) ──> Netlify Functions ──> Apollo.io API   (lead search + enrichment)
     │                  │
     │                  └──────────> Stripe            (billing webhook → revenue dashboard)
     └────────────────> Supabase    (Postgres + Auth + RLS, multi-tenant)

Setup (≈30 minutes)

1. Supabase (database + auth)

  1. Create a project at supabase.com.
  2. SQL Editor → paste & run supabase/migrations/001_init.sql.
  3. Authentication → Providers → enable Email. (Optionally disable "Confirm email" while testing.)
  4. Copy: Project URL, anon key, service_role key (Settings → API).

2. Apollo.io (lead data)

  1. Sign up at apollo.io → Settings → Integrations → API → create key.
  2. People Search works on free/basic; email reveal (enrichment) needs a paid plan with export credits — Basic ($49/mo) is enough to start.

3. Netlify (hosting + functions)

  1. Push this folder to a GitHub repo → "Import project" in Netlify.
  2. Site settings → Environment variables → add everything from .env.example.
  3. Deploy. The /api/* redirect routes to the serverless functions automatically.

4. Stripe (only needed when you start selling it)

  1. Create 3 Products with monthly Prices; set each Price's lookup_key to starter, growth, scale ($49/$149/$399 — already seeded in the DB, change freely).
  2. Developers → Webhooks → endpoint https://YOURSITE.netlify.app/api/stripe-webhook, events: customer.subscription.*. Copy the signing secret.
  3. When a customer pays, save their Stripe customer ID into organizations.stripe_customer_id — from then on MRR/churn sync automatically.

5. Make yourself the platform owner

Sign up in the app, then run in Supabase SQL Editor:

update profiles set is_super_admin = true where email = '[email protected]';

The Admin · Revenue tab appears on next refresh.

Selling it as a template

  • Each customer signs up → isolated tenant with trial, automatically.
  • They pick an industry preset in Settings (software agency / real estate / consulting / recruiting) — this swaps default countries, titles, industries and scoring focus. Add more presets in src/lib/core.jsx (PRESETS) + the scoring map in netlify/functions/apollo-search.mjs.
  • White-label: they rename the product and recolor it in Settings; you keep the admin view of all of them.
  • For "their own Apollo key per tenant", add an apollo_api_key column on organizations and read it in the functions — 10-minute change.

⚠️ Compliance (read this — you're targeting the EU/UK)

  • Netherlands, Ireland and the UK are GDPR/UK-GDPR territory. B2B cold email is generally workable under legitimate interest if you: contact business addresses about relevant services, identify yourself, and honor opt-outs immediately. Keep a suppression list.
  • US: CAN-SPAM (real postal address + unsubscribe). Australia/UAE have their own spam laws.
  • Apollo data is licensed for this use; that's another reason it beats scraping. This isn't legal advice — have a lawyer sanity-check your outreach flow before scale.

=====================================================

CREDENTIALS YOU NEED TO PROVIDE (the full list)

=====================================================

# Credential Where to get it Where it goes
1 VITE_SUPABASE_URL Supabase → Settings → API Netlify env (build)
2 VITE_SUPABASE_ANON_KEY Supabase → Settings → API Netlify env (build)
3 SUPABASE_URL same as #1 Netlify env (functions)
4 SUPABASE_SERVICE_ROLE_KEY Supabase → Settings → API (secret — server only) Netlify env (functions)
5 APOLLO_API_KEY Apollo.io → Settings → API Netlify env (functions)
6 STRIPE_SECRET_KEY Stripe → Developers → API keys Netlify env (functions) — only when selling
7 STRIPE_WEBHOOK_SECRET Stripe → Webhooks → your endpoint Netlify env (functions) — only when selling
8 OPENAI_API_KEY platform.openai.com → API keys Netlify env (functions) — for AI drafting + reply classification
9 Gmail App Password Google Account → Security → App passwords entered inside the app (Outreach tab), per tenant
— GitHub repo + Netlify account free hosting

Recommended upgrades when revenue starts: a custom domain, a separate email-sending tool (Instantly/Smartlead) fed by the CSV export, and Apollo Professional for more credits.

Releases

Packages

Contributors

Languages