# panaligana17-code/scaper1 architecture

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

- Interactive diagram: https://gitdiagram.com/panaligana17-code/scaper1
- Repository: https://github.com/panaligana17-code/scaper1

## Overview

TradeAnchor is a lead-scraping and lead-management application. Users select counties, cities, and trades in the dashboard, search for businesses, then review, filter, and export leads; saved leads are loaded when the app opens. The visible search handler queries Serper and upserts results to Supabase. The API also exposes county, city, trade, and lead data operations. The Python file and some API behavior are identified by the tree or source index but were not excerpted, so their runtime relationships are not inferred.

Main entry points: [`frontend/api/_supabase.js`](https://github.com/panaligana17-code/scaper1/blob/main/frontend/api/_supabase.js) (Supabase client), [`frontend/src/App.jsx`](https://github.com/panaligana17-code/scaper1/blob/main/frontend/src/App.jsx) (App shell), [`frontend/src/ScraperDashboard.jsx`](https://github.com/panaligana17-code/scaper1/blob/main/frontend/src/ScraperDashboard.jsx) (Scraper dashboard), [`frontend/api/search.js`](https://github.com/panaligana17-code/scaper1/blob/main/frontend/api/search.js) (Business search API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Lead Management UI"]
  node_app["App shell<br/>[App.jsx]"]
  node_dashboard["Scraper dashboard"]
  node_leadlist["Leads list<br/>[LeadsList.jsx]"]
  node_csv["CSV export<br/>[ExportCSV.jsx]"]
end

subgraph group_api["Application API"]
  node_leadapi["Saved leads API<br/>[leads.js]"]
  node_searchapi["Business search API<br/>[search.js]"]
  node_counties["County API<br/>[counties.js]"]
  node_cities["City API<br/>[cities.js]"]
  node_trades["Trade API<br/>[trades.js]"]
  node_health["Health API<br/>[health.js]"]
end

subgraph group_services["Search and Persistence"]
  node_supabaseclient["Supabase client<br/>[_supabase.js]"]
  node_database[("Supabase data store<br/>[schema.sql]")]
end

subgraph group_python["Python Runtime"]
  node_pythonapp["Python service<br/>[scaper.py]"]
end

node_user(("Lead user"))
node_serper["Serper Maps"]

node_user -->|"uses"| node_app
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_leadlist
node_app -->|"loads leads"| node_leadapi
node_dashboard -->|"adds county"| node_counties
node_dashboard -->|"searches businesses"| node_searchapi
node_leadlist -->|"exports leads"| node_csv
node_leadapi -->|"uses client"| node_supabaseclient
node_searchapi -->|"queries places"| node_serper
node_searchapi -->|"upserts leads"| node_supabaseclient
node_counties -->|"queries counties"| node_supabaseclient
node_cities -->|"inserts cities"| node_supabaseclient
node_trades -->|"reads and inserts"| node_supabaseclient
node_supabaseclient -.->|"connects"| node_database

click node_app "https://github.com/panaligana17-code/scaper1/blob/main/frontend/src/App.jsx"
click node_dashboard "https://github.com/panaligana17-code/scaper1/blob/main/frontend/src/ScraperDashboard.jsx"
click node_leadlist "https://github.com/panaligana17-code/scaper1/blob/main/frontend/src/LeadsList.jsx"
click node_csv "https://github.com/panaligana17-code/scaper1/blob/main/frontend/src/ExportCSV.jsx"
click node_leadapi "https://github.com/panaligana17-code/scaper1/blob/main/frontend/api/leads.js"
click node_searchapi "https://github.com/panaligana17-code/scaper1/blob/main/frontend/api/search.js"
click node_counties "https://github.com/panaligana17-code/scaper1/blob/main/frontend/api/counties.js"
click node_cities "https://github.com/panaligana17-code/scaper1/blob/main/frontend/api/cities.js"
click node_trades "https://github.com/panaligana17-code/scaper1/blob/main/frontend/api/trades.js"
click node_health "https://github.com/panaligana17-code/scaper1/blob/main/frontend/api/health.js"
click node_supabaseclient "https://github.com/panaligana17-code/scaper1/blob/main/frontend/api/_supabase.js"
click node_database "https://github.com/panaligana17-code/scaper1/blob/main/supabase/schema.sql"
click node_pythonapp "https://github.com/panaligana17-code/scaper1/blob/main/scaper.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_app,node_dashboard,node_leadlist,node_csv,node_user toneBlue
class node_leadapi,node_searchapi,node_counties,node_cities,node_trades,node_health toneAmber
class node_supabaseclient,node_database toneMint
class node_pythonapp toneRose
class node_serper toneIndigo
```

## Components

### Lead Management UI

- [App shell](https://github.com/panaligana17-code/scaper1/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Scraper dashboard](https://github.com/panaligana17-code/scaper1/blob/main/frontend/src/ScraperDashboard.jsx): `frontend/src/ScraperDashboard.jsx`
- [Leads list](https://github.com/panaligana17-code/scaper1/blob/main/frontend/src/LeadsList.jsx): `frontend/src/LeadsList.jsx`
- [CSV export](https://github.com/panaligana17-code/scaper1/blob/main/frontend/src/ExportCSV.jsx): `frontend/src/ExportCSV.jsx`

### Application API

- [Saved leads API](https://github.com/panaligana17-code/scaper1/blob/main/frontend/api/leads.js): `frontend/api/leads.js`
- [Business search API](https://github.com/panaligana17-code/scaper1/blob/main/frontend/api/search.js): `frontend/api/search.js`
- [County API](https://github.com/panaligana17-code/scaper1/blob/main/frontend/api/counties.js): `frontend/api/counties.js`
- [City API](https://github.com/panaligana17-code/scaper1/blob/main/frontend/api/cities.js): `frontend/api/cities.js`
- [Trade API](https://github.com/panaligana17-code/scaper1/blob/main/frontend/api/trades.js): `frontend/api/trades.js`
- [Health API](https://github.com/panaligana17-code/scaper1/blob/main/frontend/api/health.js): `frontend/api/health.js`

### Search and Persistence

- [Supabase client](https://github.com/panaligana17-code/scaper1/blob/main/frontend/api/_supabase.js): `frontend/api/_supabase.js`
- [Supabase data store](https://github.com/panaligana17-code/scaper1/blob/main/supabase/schema.sql): `supabase/schema.sql`

### Python Runtime

- [Python service](https://github.com/panaligana17-code/scaper1/blob/main/scaper.py): `scaper.py`

### Other components

- **Lead user**
- **Serper Maps**

## Connections

- Lead user → App shell: uses (evidence: `frontend/src/App.jsx`)
- App shell → Scraper dashboard: renders (evidence: `frontend/src/App.jsx`)
- App shell → Leads list: renders (evidence: `frontend/src/App.jsx`)
- App shell → Saved leads API: loads leads (evidence: `frontend/src/App.jsx`)
- Scraper dashboard → County API: adds county (evidence: `frontend/src/ScraperDashboard.jsx`)
- Scraper dashboard → Business search API: searches businesses (evidence: `frontend/src/ScraperDashboard.jsx`)
- Leads list → CSV export: exports leads (evidence: `frontend/src/LeadsList.jsx`)
- Saved leads API → Supabase client: uses client (evidence: `frontend/api/leads.js`)
- Business search API → Serper Maps: queries places (evidence: `frontend/api/search.js`)
- Business search API → Supabase client: upserts leads (evidence: `frontend/api/search.js`)
- County API → Supabase client: queries counties (evidence: `frontend/api/counties.js`)
- City API → Supabase client: inserts cities (evidence: `frontend/api/cities.js`)
- Trade API → Supabase client: reads and inserts (evidence: `frontend/api/trades.js`)
- Supabase client → Supabase data store: connects
