# vaishnavizende1562-cell/leadscaler architecture

> Architecture diagram of the GitHub repository vaishnavizende1562-cell/leadscaler, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vaishnavizende1562-cell/leadscaler
- Repository: https://github.com/vaishnavizende1562-cell/leadscaler

## Overview

leadScaler is a B2B lead-discovery and personalized-outreach product: users target a market in a private web workspace, the web API submits a batch to n8n, and results are audited, stored, and returned. Its documented workflow covers provider waterfall discovery, optional TinyFish discovery and email verification, and outreach personalization. The graph reflects README-documented workflow stages and sampled API behavior; the n8n definition and race service were not sampled, so their internal call relationships are shown only where documented.

Main entry points: [`backend/smart_leadflow_web.py`](https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/backend/smart_leadflow_web.py) (Workspace API), [`workflows/b2b-smart-leadflow-n8n.json`](https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/workflows/b2b-smart-leadflow-n8n.json) (78-node n8n workflow), [`frontend/index.html`](https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/frontend/index.html) (Lead workspace UI), [`netlify/functions/api.mjs`](https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/netlify/functions/api.mjs) (API tunnel proxy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Workspace"]
  node_ui["Lead workspace UI<br/>[index.html]"]
  node_proxy["API tunnel proxy<br/>[api.mjs]"]
  node_webapi["Workspace API"]
end

subgraph group_orchestration["Lead orchestration"]
  node_targeting["Prompt and filter targeting"]
  node_workflow["78-node n8n workflow"]
  node_waterfall["Provider lead waterfall"]
  node_race["Parallel discovery race"]
end

subgraph group_verification["Verification and enrichment"]
  node_purity["Company purity audit"]
  node_email["Email guessing and checks"]
  node_linkedin["LinkedIn resolution"]
  node_outreach["Outreach personalization"]
end

subgraph group_persistence["User data"]
  node_store[("SQLite workspace store")]
end

node_user(("Workspace user"))
node_n8n["n8n runtime"]
node_providers["Lead data providers"]
node_llms["Primary and backup LLMs"]
node_mailmeteor["Mailmeteor checker"]

node_user -->|"sets target"| node_ui
node_ui -->|"sends requests"| node_proxy
node_proxy -->|"forwards API"| node_webapi
node_webapi -->|"builds target"| node_targeting
node_webapi -->|"submits batch"| node_workflow
node_workflow -->|"runs on"| node_n8n
node_workflow -->|"routes leads"| node_waterfall
node_waterfall -->|"queries providers"| node_providers
node_webapi -->|"audits leads"| node_purity
node_webapi -->|"tops up batch"| node_race
node_race -->|"guesses and checks"| node_email
node_email -->|"verifies email"| node_mailmeteor
node_workflow -->|"resolves profiles"| node_linkedin
node_workflow -->|"personalizes email"| node_outreach
node_outreach -->|"uses language models"| node_llms
node_webapi -->|"stores workspace data"| node_store
node_webapi -->|"serves workspace"| node_ui

click node_ui "https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/frontend/index.html"
click node_proxy "https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/netlify/functions/api.mjs"
click node_webapi "https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/backend/smart_leadflow_web.py"
click node_targeting "https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/backend/smart_leadflow_web.py"
click node_workflow "https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/workflows/b2b-smart-leadflow-n8n.json"
click node_waterfall "https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/workflows/b2b-smart-leadflow-n8n.json"
click node_race "https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/backend/mailmeteor_race_server.py"
click node_purity "https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/backend/smart_leadflow_web.py"
click node_email "https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/backend/mailmeteor_race_server.py"
click node_linkedin "https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/workflows/b2b-smart-leadflow-n8n.json"
click node_outreach "https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/workflows/b2b-smart-leadflow-n8n.json"
click node_store "https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/backend/smart_leadflow_web.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ui,node_proxy,node_webapi,node_user toneBlue
class node_targeting,node_workflow,node_waterfall,node_race toneAmber
class node_purity,node_email,node_linkedin,node_outreach toneMint
class node_store toneRose
class node_n8n,node_providers,node_llms,node_mailmeteor toneIndigo
```

## Components

### Workspace

- [Lead workspace UI](https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/frontend/index.html): `frontend/index.html`
- [API tunnel proxy](https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/netlify/functions/api.mjs): `netlify/functions/api.mjs`
- [Workspace API](https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/backend/smart_leadflow_web.py): `backend/smart_leadflow_web.py`

### Lead orchestration

- [Prompt and filter targeting](https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/backend/smart_leadflow_web.py): `backend/smart_leadflow_web.py`
- [78-node n8n workflow](https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/workflows/b2b-smart-leadflow-n8n.json): `workflows/b2b-smart-leadflow-n8n.json`
- [Provider lead waterfall](https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/workflows/b2b-smart-leadflow-n8n.json): `workflows/b2b-smart-leadflow-n8n.json`
- [Parallel discovery race](https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/backend/mailmeteor_race_server.py): `backend/mailmeteor_race_server.py`

### Verification and enrichment

- [Company purity audit](https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/backend/smart_leadflow_web.py): `backend/smart_leadflow_web.py`
- [Email guessing and checks](https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/backend/mailmeteor_race_server.py): `backend/mailmeteor_race_server.py`
- [LinkedIn resolution](https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/workflows/b2b-smart-leadflow-n8n.json): `workflows/b2b-smart-leadflow-n8n.json`
- [Outreach personalization](https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/workflows/b2b-smart-leadflow-n8n.json): `workflows/b2b-smart-leadflow-n8n.json`

### User data

- [SQLite workspace store](https://github.com/vaishnavizende1562-cell/leadscaler/blob/main/backend/smart_leadflow_web.py): `backend/smart_leadflow_web.py`

### Other components

- **Workspace user**
- **n8n runtime**
- **Lead data providers**
- **Primary and backup LLMs**
- **Mailmeteor checker**

## Connections

- Workspace user → Lead workspace UI: sets target (evidence: `README.md`)
- Lead workspace UI → API tunnel proxy: sends requests (evidence: `netlify/functions/api.mjs`)
- API tunnel proxy → Workspace API: forwards API (evidence: `netlify/functions/api.mjs`)
- Workspace API → Prompt and filter targeting: builds target (evidence: `backend/smart_leadflow_web.py`)
- Workspace API → 78-node n8n workflow: submits batch (evidence: `backend/smart_leadflow_web.py`)
- 78-node n8n workflow → n8n runtime: runs on (evidence: `README.md`)
- 78-node n8n workflow → Provider lead waterfall: routes leads (evidence: `README.md`)
- Provider lead waterfall → Lead data providers: queries providers (evidence: `README.md`)
- Workspace API → Company purity audit: audits leads (evidence: `backend/smart_leadflow_web.py`)
- Workspace API → Parallel discovery race: tops up batch (evidence: `backend/smart_leadflow_web.py`)
- Parallel discovery race → Email guessing and checks: guesses and checks (evidence: `README.md`)
- Email guessing and checks → Mailmeteor checker: verifies email (evidence: `README.md`)
- 78-node n8n workflow → LinkedIn resolution: resolves profiles (evidence: `README.md`)
- 78-node n8n workflow → Outreach personalization: personalizes email (evidence: `README.md`)
- Outreach personalization → Primary and backup LLMs: uses language models (evidence: `README.md`)
- Workspace API → SQLite workspace store: stores workspace data (evidence: `README.md`)
- Workspace API → Lead workspace UI: serves workspace (evidence: `backend/smart_leadflow_web.py`)
