# obaid1dev/autolead architecture

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

- Interactive diagram: https://gitdiagram.com/obaid1dev/autolead
- Repository: https://github.com/obaid1dev/autolead

## Overview

AutoLead turns a place-and-category search into a contact-rich local-business lead list. The browser submits search criteria; the API resolves the place, searches OpenStreetMap business data, and returns filtered results for display or CSV export. The graph includes category mapping and API models as internal layers. Source excerpts show the main calls and external requests; frontend presentation details and several advertised capabilities are documented in the README rather than inspected source.

Main entry points: [`app/main.py`](https://github.com/obaid1dev/autolead/blob/main/app/main.py) (API routes), [`app/static/app.js`](https://github.com/obaid1dev/autolead/blob/main/app/static/app.js) (Search and results), [`app/overpass.py`](https://github.com/obaid1dev/autolead/blob/main/app/overpass.py) (Overpass search and processing), [`app/static/index.html`](https://github.com/obaid1dev/autolead/blob/main/app/static/index.html) (Search interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Browser experience"]
  node_interface["Search interface<br/>[index.html]"]
  node_browser["Search and results<br/>[app.js]"]
  node_styling["Responsive themes<br/>[styles.css]"]
  node_csv["CSV export<br/>[app.js]"]
end

subgraph group_api["Search API"]
  node_api_routes["API routes<br/>[main.py]"]
  node_schemas["Request and response models<br/>[models.py]"]
end

subgraph group_discovery["Place discovery"]
  node_category_catalog["Category catalog<br/>[categories.py]"]
  node_geocoder["Place geocoding<br/>[geo.py]"]
end

subgraph group_business_data["Business data"]
  node_business_search["Overpass search and processing<br/>[overpass.py]"]
end

node_user(("Searcher"))
node_nominatim{{"Nominatim"}}
node_overpass_api{{"Overpass API"}}

node_user -.->|"enters search"| node_interface
node_interface -.->|"provides controls"| node_browser
node_browser -->|"posts search"| node_api_routes
node_browser -->|"loads categories"| node_api_routes
node_api_routes -->|"serves page"| node_interface
node_api_routes -->|"validates and returns"| node_schemas
node_api_routes -->|"lists options"| node_category_catalog
node_api_routes -->|"resolves place"| node_geocoder
node_geocoder -->|"requests bounds"| node_nominatim
node_api_routes -->|"searches bounds"| node_business_search
node_business_search -->|"queries OSM"| node_overpass_api
node_business_search -->|"builds filters and labels"| node_category_catalog
node_business_search -->|"creates businesses"| node_schemas
node_browser -->|"exports results"| node_csv
node_browser -.->|"renders styled page"| node_styling

click node_interface "https://github.com/obaid1dev/autolead/blob/main/app/static/index.html"
click node_browser "https://github.com/obaid1dev/autolead/blob/main/app/static/app.js"
click node_styling "https://github.com/obaid1dev/autolead/blob/main/app/static/styles.css"
click node_csv "https://github.com/obaid1dev/autolead/blob/main/app/static/app.js"
click node_api_routes "https://github.com/obaid1dev/autolead/blob/main/app/main.py"
click node_schemas "https://github.com/obaid1dev/autolead/blob/main/app/models.py"
click node_category_catalog "https://github.com/obaid1dev/autolead/blob/main/app/categories.py"
click node_geocoder "https://github.com/obaid1dev/autolead/blob/main/app/geo.py"
click node_business_search "https://github.com/obaid1dev/autolead/blob/main/app/overpass.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_interface,node_browser,node_styling,node_csv toneBlue
class node_api_routes,node_schemas toneAmber
class node_category_catalog,node_geocoder,node_overpass_api toneMint
class node_business_search toneRose
class node_user,node_nominatim toneIndigo
```

## Components

### Browser experience

- [Search interface](https://github.com/obaid1dev/autolead/blob/main/app/static/index.html): `app/static/index.html`
- [Search and results](https://github.com/obaid1dev/autolead/blob/main/app/static/app.js): `app/static/app.js`
- [Responsive themes](https://github.com/obaid1dev/autolead/blob/main/app/static/styles.css): `app/static/styles.css`
- [CSV export](https://github.com/obaid1dev/autolead/blob/main/app/static/app.js): `app/static/app.js`

### Search API

- [API routes](https://github.com/obaid1dev/autolead/blob/main/app/main.py): `app/main.py`
- [Request and response models](https://github.com/obaid1dev/autolead/blob/main/app/models.py): `app/models.py`

### Place discovery

- [Category catalog](https://github.com/obaid1dev/autolead/blob/main/app/categories.py): `app/categories.py`
- [Place geocoding](https://github.com/obaid1dev/autolead/blob/main/app/geo.py): `app/geo.py`

### Business data

- [Overpass search and processing](https://github.com/obaid1dev/autolead/blob/main/app/overpass.py): `app/overpass.py`

### Other components

- **Searcher**
- **Nominatim**
- **Overpass API**

## Connections

- Searcher → Search interface: enters search (evidence: `README.md`)
- Search interface → Search and results: provides controls (evidence: `README.md`)
- Search and results → API routes: posts search (evidence: `app/static/app.js`)
- Search and results → API routes: loads categories (evidence: `app/static/app.js`)
- API routes → Search interface: serves page (evidence: `app/main.py`)
- API routes → Request and response models: validates and returns (evidence: `app/main.py`)
- API routes → Category catalog: lists options (evidence: `app/main.py`)
- API routes → Place geocoding: resolves place (evidence: `app/main.py`)
- Place geocoding → Nominatim: requests bounds (evidence: `app/geo.py`)
- API routes → Overpass search and processing: searches bounds (evidence: `app/main.py`)
- Overpass search and processing → Overpass API: queries OSM (evidence: `app/overpass.py`)
- Overpass search and processing → Category catalog: builds filters and labels (evidence: `app/overpass.py`)
- Overpass search and processing → Request and response models: creates businesses (evidence: `app/overpass.py`)
- Search and results → CSV export: exports results (evidence: `app/static/app.js`)
- Search and results → Responsive themes: renders styled page (evidence: `README.md`)
