# topupchips/harvest-ai architecture

> Architecture diagram of the GitHub repository topupchips/harvest-ai, 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/topupchips/harvest-ai
- Repository: https://github.com/topupchips/harvest-ai

## Overview

WorldScout is a map-driven world-generation product with a data-extraction and object-detection workflow. Users select a location, provide optional product imagery, generate and view a 3D world, then can extract views from saved worlds and detect matching objects for annotated-image download. The graph also includes the landing experience, backend orchestration, and persistence. Some service internals were not excerpted; their links are omitted or marked unverified rather than inferred.

Main entry points: [`frontend/src/App.jsx`](https://github.com/topupchips/harvest-ai/blob/main/frontend/src/App.jsx) (App workflow), [`backend/routes/generate.py`](https://github.com/topupchips/harvest-ai/blob/main/backend/routes/generate.py) (World generation routes), [`backend/main.py`](https://github.com/topupchips/harvest-ai/blob/main/backend/main.py) (HTTP application), [`frontend/src/components/DataFactory.jsx`](https://github.com/topupchips/harvest-ai/blob/main/frontend/src/components/DataFactory.jsx) (Data factory UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_app["App workflow<br/>[App.jsx]"]
  node_map["Location map<br/>[MapView.jsx]"]
  node_landing["Landing page<br/>[LandingPage.jsx]"]
  node_earth["3D Earth<br/>[Earth3D.jsx]"]
  node_location["Location details<br/>[LocationPopup.jsx]"]
  node_product["Product descriptor"]
  node_worldviewer["World viewer<br/>[WorldViewer.jsx]"]
end

subgraph group_generation["World generation"]
  node_webapi["API client<br/>[api.js]"]
  node_generate["World generation routes<br/>[generate.py]"]
  node_compositor["Product compositor<br/>[compositor.py]"]
  node_placement["Image placement<br/>[image_placement.py]"]
  node_worldlabsclient["Generation client<br/>[worldlabs.py]"]
end

subgraph group_datafactory["Data factory"]
  node_factoryui["Data factory UI<br/>[DataFactory.jsx]"]
  node_gatewaylog["Progress log<br/>[GatewayLog.jsx]"]
  node_factoryclient["Factory client<br/>[dataFactory.js]"]
  node_factoryroutes["Factory routes<br/>[data_factory.py]"]
  node_factoryservice["View extraction<br/>[data_factory.py]"]
  node_detector["Vision detection<br/>[vision_detector.py]"]
  node_panorama["Panorama processing<br/>[panorama.py]"]
end

subgraph group_backend["Backend services"]
  node_backendapp["HTTP application<br/>[main.py]"]
  node_visionroutes["Vision routes<br/>[vision.py]"]
  node_visionservice["Vision service<br/>[vision.py]"]
  node_worldroutes["World records routes<br/>[worlds.py]"]
  node_storageclient["Storage client<br/>[supabase_client.py]"]
end

subgraph group_integrations["External systems"]
  node_database[("Supabase")]
  node_worldlabs["World Labs"]
  node_visionprovider["Vision model API"]
end

node_visitor(("Visitor"))

node_visitor -->|"opens"| node_landing
node_app -->|"renders"| node_landing
node_landing -->|"renders"| node_earth
node_app -->|"renders"| node_map
node_map -->|"reports location"| node_app
node_app -->|"renders"| node_location
node_app -->|"renders"| node_product
node_app -->|"requests generation"| node_webapi
node_app -.->|"renders"| node_worldviewer
node_app -->|"renders"| node_factoryui
node_factoryui -->|"starts extraction"| node_factoryclient
node_factoryui -->|"fetches worlds"| node_webapi
node_factoryui -->|"renders events"| node_gatewaylog
node_webapi -->|"posts generation"| node_generate
node_factoryclient -.->|"calls endpoints"| node_factoryroutes
node_backendapp -->|"registers routes"| node_generate
node_backendapp -->|"registers routes"| node_factoryroutes
node_backendapp -->|"registers routes"| node_visionroutes
node_backendapp -->|"registers routes"| node_worldroutes
node_generate -->|"requests generation"| node_worldlabsclient
node_generate -->|"composites imagery"| node_compositor
node_compositor -->|"uses placement"| node_placement
node_generate -->|"stores world"| node_storageclient
node_factoryroutes -->|"extracts views"| node_factoryservice
node_factoryroutes -->|"runs detection"| node_detector
node_factoryservice -.->|"processes panorama"| node_panorama
node_factoryservice -.->|"loads world data"| node_worldlabsclient
node_factoryservice -.->|"reads world data"| node_storageclient
node_visionroutes -->|"uses vision"| node_visionservice
node_visionroutes -->|"uses compositor"| node_compositor
node_worldroutes -.->|"reads worlds"| node_storageclient
node_storageclient -->|"reads and writes"| node_database
node_worldlabsclient -.->|"generates worlds"| node_worldlabs
node_detector -.->|"queries model"| node_visionprovider

click node_app "https://github.com/topupchips/harvest-ai/blob/main/frontend/src/App.jsx"
click node_map "https://github.com/topupchips/harvest-ai/blob/main/frontend/src/components/MapView.jsx"
click node_landing "https://github.com/topupchips/harvest-ai/blob/main/frontend/src/components/landing/LandingPage.jsx"
click node_earth "https://github.com/topupchips/harvest-ai/blob/main/frontend/src/components/landing/Earth3D.jsx"
click node_location "https://github.com/topupchips/harvest-ai/blob/main/frontend/src/components/LocationPopup.jsx"
click node_product "https://github.com/topupchips/harvest-ai/blob/main/frontend/src/components/ProductDescriptor.jsx"
click node_worldviewer "https://github.com/topupchips/harvest-ai/blob/main/frontend/src/components/WorldViewer.jsx"
click node_factoryui "https://github.com/topupchips/harvest-ai/blob/main/frontend/src/components/DataFactory.jsx"
click node_gatewaylog "https://github.com/topupchips/harvest-ai/blob/main/frontend/src/components/GatewayLog.jsx"
click node_webapi "https://github.com/topupchips/harvest-ai/blob/main/frontend/src/services/api.js"
click node_factoryclient "https://github.com/topupchips/harvest-ai/blob/main/frontend/src/services/dataFactory.js"
click node_backendapp "https://github.com/topupchips/harvest-ai/blob/main/backend/main.py"
click node_generate "https://github.com/topupchips/harvest-ai/blob/main/backend/routes/generate.py"
click node_compositor "https://github.com/topupchips/harvest-ai/blob/main/backend/services/compositor.py"
click node_placement "https://github.com/topupchips/harvest-ai/blob/main/backend/services/image_placement.py"
click node_worldlabsclient "https://github.com/topupchips/harvest-ai/blob/main/backend/services/worldlabs.py"
click node_factoryroutes "https://github.com/topupchips/harvest-ai/blob/main/backend/routes/data_factory.py"
click node_factoryservice "https://github.com/topupchips/harvest-ai/blob/main/backend/services/data_factory.py"
click node_detector "https://github.com/topupchips/harvest-ai/blob/main/backend/services/vision_detector.py"
click node_panorama "https://github.com/topupchips/harvest-ai/blob/main/backend/services/panorama.py"
click node_visionroutes "https://github.com/topupchips/harvest-ai/blob/main/backend/routes/vision.py"
click node_visionservice "https://github.com/topupchips/harvest-ai/blob/main/backend/services/vision.py"
click node_worldroutes "https://github.com/topupchips/harvest-ai/blob/main/backend/routes/worlds.py"
click node_storageclient "https://github.com/topupchips/harvest-ai/blob/main/backend/services/supabase_client.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_map,node_landing,node_earth,node_location,node_product,node_worldviewer toneBlue
class node_webapi,node_generate,node_compositor,node_placement,node_worldlabsclient toneAmber
class node_factoryui,node_gatewaylog,node_factoryclient,node_factoryroutes,node_factoryservice,node_detector,node_panorama toneMint
class node_backendapp,node_visionroutes,node_visionservice,node_worldroutes,node_storageclient toneRose
class node_database,node_worldlabs,node_visionprovider,node_visitor toneIndigo
```

## Components

### Web experience

- [App workflow](https://github.com/topupchips/harvest-ai/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Location map](https://github.com/topupchips/harvest-ai/blob/main/frontend/src/components/MapView.jsx): `frontend/src/components/MapView.jsx`
- [Landing page](https://github.com/topupchips/harvest-ai/blob/main/frontend/src/components/landing/LandingPage.jsx): `frontend/src/components/landing/LandingPage.jsx`
- [3D Earth](https://github.com/topupchips/harvest-ai/blob/main/frontend/src/components/landing/Earth3D.jsx): `frontend/src/components/landing/Earth3D.jsx`
- [Location details](https://github.com/topupchips/harvest-ai/blob/main/frontend/src/components/LocationPopup.jsx): `frontend/src/components/LocationPopup.jsx`
- [Product descriptor](https://github.com/topupchips/harvest-ai/blob/main/frontend/src/components/ProductDescriptor.jsx): `frontend/src/components/ProductDescriptor.jsx`
- [World viewer](https://github.com/topupchips/harvest-ai/blob/main/frontend/src/components/WorldViewer.jsx): `frontend/src/components/WorldViewer.jsx`

### World generation

- [API client](https://github.com/topupchips/harvest-ai/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [World generation routes](https://github.com/topupchips/harvest-ai/blob/main/backend/routes/generate.py): `backend/routes/generate.py`
- [Product compositor](https://github.com/topupchips/harvest-ai/blob/main/backend/services/compositor.py): `backend/services/compositor.py`
- [Image placement](https://github.com/topupchips/harvest-ai/blob/main/backend/services/image_placement.py): `backend/services/image_placement.py`
- [Generation client](https://github.com/topupchips/harvest-ai/blob/main/backend/services/worldlabs.py): `backend/services/worldlabs.py`

### Data factory

- [Data factory UI](https://github.com/topupchips/harvest-ai/blob/main/frontend/src/components/DataFactory.jsx): `frontend/src/components/DataFactory.jsx`
- [Progress log](https://github.com/topupchips/harvest-ai/blob/main/frontend/src/components/GatewayLog.jsx): `frontend/src/components/GatewayLog.jsx`
- [Factory client](https://github.com/topupchips/harvest-ai/blob/main/frontend/src/services/dataFactory.js): `frontend/src/services/dataFactory.js`
- [Factory routes](https://github.com/topupchips/harvest-ai/blob/main/backend/routes/data_factory.py): `backend/routes/data_factory.py`
- [View extraction](https://github.com/topupchips/harvest-ai/blob/main/backend/services/data_factory.py): `backend/services/data_factory.py`
- [Vision detection](https://github.com/topupchips/harvest-ai/blob/main/backend/services/vision_detector.py): `backend/services/vision_detector.py`
- [Panorama processing](https://github.com/topupchips/harvest-ai/blob/main/backend/services/panorama.py): `backend/services/panorama.py`

### Backend services

- [HTTP application](https://github.com/topupchips/harvest-ai/blob/main/backend/main.py): `backend/main.py`
- [Vision routes](https://github.com/topupchips/harvest-ai/blob/main/backend/routes/vision.py): `backend/routes/vision.py`
- [Vision service](https://github.com/topupchips/harvest-ai/blob/main/backend/services/vision.py): `backend/services/vision.py`
- [World records routes](https://github.com/topupchips/harvest-ai/blob/main/backend/routes/worlds.py): `backend/routes/worlds.py`
- [Storage client](https://github.com/topupchips/harvest-ai/blob/main/backend/services/supabase_client.py): `backend/services/supabase_client.py`

### External systems

- **Supabase**
- **World Labs**
- **Vision model API**

### Other components

- **Visitor**

## Connections

- Visitor → Landing page: opens
- App workflow → Landing page: renders (evidence: `frontend/src/App.jsx`)
- Landing page → 3D Earth: renders (evidence: `frontend/src/components/landing/LandingPage.jsx`)
- App workflow → Location map: renders (evidence: `frontend/src/App.jsx`)
- Location map → App workflow: reports location (evidence: `frontend/src/App.jsx`)
- App workflow → Location details: renders (evidence: `frontend/src/App.jsx`)
- App workflow → Product descriptor: renders (evidence: `frontend/src/App.jsx`)
- App workflow → API client: requests generation (evidence: `frontend/src/App.jsx`)
- App workflow → World viewer: renders
- App workflow → Data factory UI: renders (evidence: `frontend/src/App.jsx`)
- Data factory UI → Factory client: starts extraction (evidence: `frontend/src/components/DataFactory.jsx`)
- Data factory UI → API client: fetches worlds (evidence: `frontend/src/components/DataFactory.jsx`)
- Data factory UI → Progress log: renders events (evidence: `frontend/src/components/DataFactory.jsx`)
- API client → World generation routes: posts generation (evidence: `frontend/src/services/api.js`)
- Factory client → Factory routes: calls endpoints
- HTTP application → World generation routes: registers routes (evidence: `backend/main.py`)
- HTTP application → Factory routes: registers routes (evidence: `backend/main.py`)
- HTTP application → Vision routes: registers routes (evidence: `backend/main.py`)
- HTTP application → World records routes: registers routes (evidence: `backend/main.py`)
- World generation routes → Generation client: requests generation (evidence: `backend/routes/generate.py`)
- World generation routes → Product compositor: composites imagery (evidence: `backend/routes/generate.py`)
- Product compositor → Image placement: uses placement (evidence: `backend/services/compositor.py`)
- World generation routes → Storage client: stores world (evidence: `backend/routes/generate.py`)
- Factory routes → View extraction: extracts views (evidence: `backend/routes/data_factory.py`)
- Factory routes → Vision detection: runs detection (evidence: `backend/routes/data_factory.py`)
- View extraction → Panorama processing: processes panorama (evidence: `backend/services/data_factory.py`)
- View extraction → Generation client: loads world data (evidence: `backend/services/data_factory.py`)
- View extraction → Storage client: reads world data (evidence: `backend/services/data_factory.py`)
- Vision routes → Vision service: uses vision (evidence: `backend/routes/vision.py`)
- Vision routes → Product compositor: uses compositor (evidence: `backend/routes/vision.py`)
- World records routes → Storage client: reads worlds (evidence: `backend/routes/worlds.py`)
- Storage client → Supabase: reads and writes (evidence: `backend/services/supabase_client.py`)
- Generation client → World Labs: generates worlds
- Vision detection → Vision model API: queries model
