# srinivasan067/leadgeneration architecture

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

- Interactive diagram: https://gitdiagram.com/srinivasan067/leadgeneration
- Repository: https://github.com/srinivasan067/leadgeneration

## Overview

Offshore Intel is an account-intelligence engine for finding and assessing companies that may buy offshore software teams. Its main workflow accepts an analysis request for a named company, gathers news, produces and checks an AI report, applies ICP and data-quality rules, optionally adds web research, and persists the account; discovery separately finds prospects from buying-signal news. The graph also includes company retrieval and the planned jobs-refresh endpoint as part of the API surface, not as an implemented collector. Source excerpts do not expose every server call or persistence detail, so only explicit or indexed relationships are shown.

Main entry points: [`src/server.js`](https://github.com/srinivasan067/leadgeneration/blob/main/src/server.js) (HTTP workflows), [`src/services/aiProvider.js`](https://github.com/srinivasan067/leadgeneration/blob/main/src/services/aiProvider.js) (AI analysis stages), [`src/collectors/discovery.js`](https://github.com/srinivasan067/leadgeneration/blob/main/src/collectors/discovery.js) (Signal search), [`src/collectors/googleNewsRss.js`](https://github.com/srinivasan067/leadgeneration/blob/main/src/collectors/googleNewsRss.js) (Google News RSS)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API orchestration"]
  node_server["HTTP workflows<br/>[server.js]"]
end

subgraph group_discovery["Lead discovery"]
  node_discovery_collect["Signal search<br/>[discovery.js]"]
  node_google_news["Google News RSS<br/>[googleNewsRss.js]"]
  node_signal_config["Signal seeds<br/>[signals.js]"]
end

subgraph group_analysis["Company analysis"]
  node_news_api["NewsAPI search<br/>[newsApi.js]"]
  node_web_research["Web research<br/>[webResearch.js]"]
  node_ai_provider["AI analysis stages<br/>[aiProvider.js]"]
  node_prompts["Analysis prompts<br/>[prompts.js]"]
end

subgraph group_records["Account data and policy"]
  node_icp["ICP evaluation<br/>[icp.js]"]
  node_blocklist["Prospect exclusions<br/>[blocklist.js]"]
  node_company[("Company records<br/>[Company.js]")]
end

node_user(("API client"))
node_mongo[("MongoDB")]
node_google_service(("Google News"))
node_newsapi_service(("NewsAPI"))
node_tavily(("Tavily search"))
node_ai_services(("AI providers"))

node_user -->|"requests"| node_server
node_server -->|"collects signals"| node_discovery_collect
node_discovery_collect -->|"uses seeds"| node_signal_config
node_discovery_collect -->|"searches signals"| node_google_news
node_google_news -->|"fetches feeds"| node_google_service
node_server -->|"collects company news"| node_google_news
node_server -->|"collects company news"| node_news_api
node_news_api -->|"queries articles"| node_newsapi_service
node_server -->|"analyzes reports"| node_ai_provider
node_ai_provider -->|"builds prompts"| node_prompts
node_ai_provider -->|"generates responses"| node_ai_services
node_server -->|"checks availability"| node_web_research
node_web_research -->|"searches web"| node_tavily
node_server -->|"computes fit"| node_icp
node_server -->|"checks exclusions"| node_blocklist
node_ai_provider -->|"filters discovered leads"| node_blocklist
node_server -->|"reads and upserts"| node_company
node_company -.->|"persists records"| node_mongo
node_server -->|"returns results"| node_user

click node_server "https://github.com/srinivasan067/leadgeneration/blob/main/src/server.js"
click node_discovery_collect "https://github.com/srinivasan067/leadgeneration/blob/main/src/collectors/discovery.js"
click node_google_news "https://github.com/srinivasan067/leadgeneration/blob/main/src/collectors/googleNewsRss.js"
click node_signal_config "https://github.com/srinivasan067/leadgeneration/blob/main/src/config/signals.js"
click node_news_api "https://github.com/srinivasan067/leadgeneration/blob/main/src/collectors/newsApi.js"
click node_web_research "https://github.com/srinivasan067/leadgeneration/blob/main/src/collectors/webResearch.js"
click node_ai_provider "https://github.com/srinivasan067/leadgeneration/blob/main/src/services/aiProvider.js"
click node_prompts "https://github.com/srinivasan067/leadgeneration/blob/main/src/services/prompts.js"
click node_icp "https://github.com/srinivasan067/leadgeneration/blob/main/src/config/icp.js"
click node_blocklist "https://github.com/srinivasan067/leadgeneration/blob/main/src/config/blocklist.js"
click node_company "https://github.com/srinivasan067/leadgeneration/blob/main/src/models/Company.js"

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_server,node_user toneBlue
class node_discovery_collect,node_google_news,node_signal_config,node_mongo toneAmber
class node_news_api,node_web_research,node_ai_provider,node_prompts,node_newsapi_service toneMint
class node_icp,node_blocklist,node_company toneRose
class node_google_service,node_tavily,node_ai_services toneIndigo
```

## Components

### API orchestration

- [HTTP workflows](https://github.com/srinivasan067/leadgeneration/blob/main/src/server.js): `src/server.js`

### Lead discovery

- [Signal search](https://github.com/srinivasan067/leadgeneration/blob/main/src/collectors/discovery.js): `src/collectors/discovery.js`
- [Google News RSS](https://github.com/srinivasan067/leadgeneration/blob/main/src/collectors/googleNewsRss.js): `src/collectors/googleNewsRss.js`
- [Signal seeds](https://github.com/srinivasan067/leadgeneration/blob/main/src/config/signals.js): `src/config/signals.js`

### Company analysis

- [NewsAPI search](https://github.com/srinivasan067/leadgeneration/blob/main/src/collectors/newsApi.js): `src/collectors/newsApi.js`
- [Web research](https://github.com/srinivasan067/leadgeneration/blob/main/src/collectors/webResearch.js): `src/collectors/webResearch.js`
- [AI analysis stages](https://github.com/srinivasan067/leadgeneration/blob/main/src/services/aiProvider.js): `src/services/aiProvider.js`
- [Analysis prompts](https://github.com/srinivasan067/leadgeneration/blob/main/src/services/prompts.js): `src/services/prompts.js`

### Account data and policy

- [ICP evaluation](https://github.com/srinivasan067/leadgeneration/blob/main/src/config/icp.js): `src/config/icp.js`
- [Prospect exclusions](https://github.com/srinivasan067/leadgeneration/blob/main/src/config/blocklist.js): `src/config/blocklist.js`
- [Company records](https://github.com/srinivasan067/leadgeneration/blob/main/src/models/Company.js): `src/models/Company.js`

### Other components

- **API client**
- **MongoDB**
- **Google News**
- **NewsAPI**
- **Tavily search**
- **AI providers**

## Connections

- API client → HTTP workflows: requests (evidence: `src/server.js`)
- HTTP workflows → Signal search: collects signals (evidence: `src/server.js`)
- Signal search → Signal seeds: uses seeds (evidence: `src/collectors/discovery.js`)
- Signal search → Google News RSS: searches signals (evidence: `src/collectors/discovery.js`)
- Google News RSS → Google News: fetches feeds (evidence: `src/collectors/googleNewsRss.js`)
- HTTP workflows → Google News RSS: collects company news (evidence: `src/server.js`)
- HTTP workflows → NewsAPI search: collects company news (evidence: `src/server.js`)
- NewsAPI search → NewsAPI: queries articles (evidence: `src/collectors/newsApi.js`)
- HTTP workflows → AI analysis stages: analyzes reports (evidence: `src/server.js`)
- AI analysis stages → Analysis prompts: builds prompts (evidence: `src/services/aiProvider.js`)
- AI analysis stages → AI providers: generates responses (evidence: `src/services/aiProvider.js`)
- HTTP workflows → Web research: checks availability (evidence: `src/server.js`)
- Web research → Tavily search: searches web (evidence: `src/collectors/webResearch.js`)
- HTTP workflows → ICP evaluation: computes fit (evidence: `src/server.js`)
- HTTP workflows → Prospect exclusions: checks exclusions (evidence: `src/server.js`)
- AI analysis stages → Prospect exclusions: filters discovered leads (evidence: `src/services/aiProvider.js`)
- HTTP workflows → Company records: reads and upserts (evidence: `src/server.js`)
- Company records → MongoDB: persists records
- HTTP workflows → API client: returns results (evidence: `src/server.js`)
