# revintofficial/revint architecture

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

- Interactive diagram: https://gitdiagram.com/revintofficial/revint
- Repository: https://github.com/revintofficial/revint

## Overview

Revint is sales intelligence for teams selling to local businesses: it gathers business evidence, turns it into a package recommendation and grounded sales talk track, then surfaces the card in the lead page and CRM. Discovery and worker dispatch are visible in sampled source; the README documents the four evidence/decision stages and CRM writeback. The worker’s internal execution and control-room capabilities are documented, but their detailed implementation paths were not sampled, so those relationships rely on the README.

Main entry points: [`src/lib/ai-core`](https://github.com/revintofficial/revint/tree/main/src/lib/ai-core) (Sales-card decision), [`src/app/api/discovery/route.ts`](https://github.com/revintofficial/revint/blob/main/src/app/api/discovery/route.ts) (Discovery API), [`src/lib/agent-workers/execute.ts`](https://github.com/revintofficial/revint/blob/main/src/lib/agent-workers/execute.ts) (Worker execution), [`src/lib/google-places.ts`](https://github.com/revintofficial/revint/blob/main/src/lib/google-places.ts) (Places search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Lead discovery"]
  node_discovery_api["Discovery API<br/>[route.ts]"]
  node_places_search["Places search<br/>[google-places.ts]"]
  node_lead_records[("Lead records<br/>[prisma.ts]")]
end

subgraph group_intelligence["Lead intelligence"]
  node_job_queue["AI job queue<br/>[queues.ts]"]
  node_worker_supervisor["Agent worker"]
  node_execution["Worker execution<br/>[execute.ts]"]
  node_maps_evidence["Maps evidence<br/>[gmaps-deep.ts]"]
  node_website_audit["Website audit"]
  node_review_analysis["Review analysis"]
  node_decision["Sales-card decision"]
end

subgraph group_product["Rep workflow"]
  node_lead_page["Lead page<br/>[page.tsx]"]
  node_lead_detail["Lead detail UI"]
  node_hubspot_writeback["HubSpot writeback"]
  node_hubspot_card["HubSpot card<br/>[route.ts]"]
  node_workspace_auth["Workspace auth<br/>[auth.ts]"]
end

subgraph group_quality["Quality control"]
  node_control_room["Control room"]
  node_review_panel["Brief review"]
end

node_rep(("Sales rep"))
node_google["Google Places"]
node_crm[("CRM")]

node_rep -->|"starts discovery"| node_discovery_api
node_discovery_api -->|"searches places"| node_places_search
node_places_search -->|"queries listings"| node_google
node_discovery_api -.->|"records leads"| node_lead_records
node_discovery_api -->|"emits lead events"| node_job_queue
node_job_queue -->|"dispatches jobs"| node_worker_supervisor
node_worker_supervisor -->|"executes runs"| node_execution
node_execution -.->|"gathers maps evidence"| node_maps_evidence
node_execution -.->|"audits websites"| node_website_audit
node_execution -.->|"analyzes reviews"| node_review_analysis
node_maps_evidence -->|"provides evidence"| node_decision
node_website_audit -->|"provides evidence"| node_decision
node_review_analysis -->|"provides evidence"| node_decision
node_decision -->|"returns sales card"| node_lead_page
node_lead_page -.->|"renders brief"| node_lead_detail
node_decision -->|"writes brief"| node_hubspot_writeback
node_hubspot_writeback -->|"updates CRM"| node_crm
node_crm -.->|"supplies CRM context"| node_hubspot_card
node_hubspot_card -->|"shows CRM card"| node_rep
node_decision -->|"tracks brief quality"| node_control_room
node_control_room -.->|"routes human review"| node_review_panel
node_rep -.->|"authenticates"| node_workspace_auth

click node_discovery_api "https://github.com/revintofficial/revint/blob/main/src/app/api/discovery/route.ts"
click node_places_search "https://github.com/revintofficial/revint/blob/main/src/lib/google-places.ts"
click node_lead_records "https://github.com/revintofficial/revint/blob/main/src/lib/prisma.ts"
click node_job_queue "https://github.com/revintofficial/revint/blob/main/src/lib/queues.ts"
click node_worker_supervisor "https://github.com/revintofficial/revint/blob/main/src/workers/agent-run-worker.ts"
click node_execution "https://github.com/revintofficial/revint/blob/main/src/lib/agent-workers/execute.ts"
click node_maps_evidence "https://github.com/revintofficial/revint/blob/main/src/lib/agent-workers/apify/gmaps-deep.ts"
click node_website_audit "https://github.com/revintofficial/revint/tree/main/src/lib/agent-workers"
click node_review_analysis "https://github.com/revintofficial/revint/blob/main/src/workers/review-analysis-worker.ts"
click node_decision "https://github.com/revintofficial/revint/tree/main/src/lib/ai-core"
click node_lead_page "https://github.com/revintofficial/revint/blob/main/src/app/app/leads/%5Bid%5D/page.tsx"
click node_lead_detail "https://github.com/revintofficial/revint/blob/main/src/components/app/leads/LegacyLeadDetailClient.tsx"
click node_hubspot_writeback "https://github.com/revintofficial/revint/tree/main/src/lib/integrations/hubspot"
click node_hubspot_card "https://github.com/revintofficial/revint/blob/main/src/app/api/integrations/hubspot/card-data/route.ts"
click node_control_room "https://github.com/revintofficial/revint/tree/main/src/app/admin/control"
click node_review_panel "https://github.com/revintofficial/revint/blob/main/src/components/admin/control-review-panel.tsx"
click node_workspace_auth "https://github.com/revintofficial/revint/blob/main/src/lib/auth.ts"

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_discovery_api,node_places_search,node_lead_records toneBlue
class node_job_queue,node_worker_supervisor,node_execution,node_maps_evidence,node_website_audit,node_review_analysis,node_decision,node_crm toneAmber
class node_lead_page,node_lead_detail,node_hubspot_writeback,node_hubspot_card,node_workspace_auth toneMint
class node_control_room,node_review_panel toneRose
class node_rep,node_google toneIndigo
```

## Components

### Lead discovery

- [Discovery API](https://github.com/revintofficial/revint/blob/main/src/app/api/discovery/route.ts): `src/app/api/discovery/route.ts`
- [Places search](https://github.com/revintofficial/revint/blob/main/src/lib/google-places.ts): `src/lib/google-places.ts`
- [Lead records](https://github.com/revintofficial/revint/blob/main/src/lib/prisma.ts): `src/lib/prisma.ts`

### Lead intelligence

- [AI job queue](https://github.com/revintofficial/revint/blob/main/src/lib/queues.ts): `src/lib/queues.ts`
- [Agent worker](https://github.com/revintofficial/revint/blob/main/src/workers/agent-run-worker.ts): `src/workers/agent-run-worker.ts`
- [Worker execution](https://github.com/revintofficial/revint/blob/main/src/lib/agent-workers/execute.ts): `src/lib/agent-workers/execute.ts`
- [Maps evidence](https://github.com/revintofficial/revint/blob/main/src/lib/agent-workers/apify/gmaps-deep.ts): `src/lib/agent-workers/apify/gmaps-deep.ts`
- [Website audit](https://github.com/revintofficial/revint/tree/main/src/lib/agent-workers): `src/lib/agent-workers`
- [Review analysis](https://github.com/revintofficial/revint/blob/main/src/workers/review-analysis-worker.ts): `src/workers/review-analysis-worker.ts`
- [Sales-card decision](https://github.com/revintofficial/revint/tree/main/src/lib/ai-core): `src/lib/ai-core`

### Rep workflow

- [Lead page](https://github.com/revintofficial/revint/blob/main/src/app/app/leads/%5Bid%5D/page.tsx): `src/app/app/leads/[id]/page.tsx`
- [Lead detail UI](https://github.com/revintofficial/revint/blob/main/src/components/app/leads/LegacyLeadDetailClient.tsx): `src/components/app/leads/LegacyLeadDetailClient.tsx`
- [HubSpot writeback](https://github.com/revintofficial/revint/tree/main/src/lib/integrations/hubspot): `src/lib/integrations/hubspot`
- [HubSpot card](https://github.com/revintofficial/revint/blob/main/src/app/api/integrations/hubspot/card-data/route.ts): `src/app/api/integrations/hubspot/card-data/route.ts`
- [Workspace auth](https://github.com/revintofficial/revint/blob/main/src/lib/auth.ts): `src/lib/auth.ts`

### Quality control

- [Control room](https://github.com/revintofficial/revint/tree/main/src/app/admin/control): `src/app/admin/control`
- [Brief review](https://github.com/revintofficial/revint/blob/main/src/components/admin/control-review-panel.tsx): `src/components/admin/control-review-panel.tsx`

### Other components

- **Sales rep**
- **Google Places**
- **CRM**

## Connections

- Sales rep → Discovery API: starts discovery (evidence: `src/app/api/discovery/route.ts`)
- Discovery API → Places search: searches places (evidence: `src/app/api/discovery/route.ts`)
- Places search → Google Places: queries listings (evidence: `README.md`)
- Discovery API → Lead records: records leads (evidence: `src/app/api/discovery/route.ts`)
- Discovery API → AI job queue: emits lead events (evidence: `src/app/api/discovery/route.ts`)
- AI job queue → Agent worker: dispatches jobs (evidence: `README.md`)
- Agent worker → Worker execution: executes runs (evidence: `src/workers/agent-run-worker.ts`)
- Worker execution → Maps evidence: gathers maps evidence
- Worker execution → Website audit: audits websites
- Worker execution → Review analysis: analyzes reviews
- Maps evidence → Sales-card decision: provides evidence (evidence: `README.md`)
- Website audit → Sales-card decision: provides evidence (evidence: `README.md`)
- Review analysis → Sales-card decision: provides evidence (evidence: `README.md`)
- Sales-card decision → Lead page: returns sales card (evidence: `README.md`)
- Lead page → Lead detail UI: renders brief
- Sales-card decision → HubSpot writeback: writes brief (evidence: `README.md`)
- HubSpot writeback → CRM: updates CRM (evidence: `README.md`)
- CRM → HubSpot card: supplies CRM context
- HubSpot card → Sales rep: shows CRM card (evidence: `src/app/api/integrations/hubspot/card-data/route.ts`)
- Sales-card decision → Control room: tracks brief quality (evidence: `README.md`)
- Control room → Brief review: routes human review
- Sales rep → Workspace auth: authenticates
