# trailheadapps/purealoe-lwc architecture

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

- Interactive diagram: https://gitdiagram.com/trailheadapps/purealoe-lwc
- Repository: https://github.com/trailheadapps/purealoe-lwc

## Overview

Pure Aloe is a Salesforce agricultural and product-distribution sample app. Users manage harvest fields through list, map, and record views; control irrigation; and assemble merchandise bundles. Salesforce data and Platform Events support the application, including distributor-system updates. The README also identifies Einstein capabilities, represented here as an additional product branch; its implementation relationships were not sampled, so those links are left unverified.

Main entry points: [`force-app/main/default/objects/Harvest_Field__c/Harvest_Field__c.object-meta.xml`](https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/objects/Harvest_Field__c/Harvest_Field__c.object-meta.xml) (Field Records), [`force-app/main/default/lwc/harvestFieldList/harvestFieldList.js`](https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/lwc/harvestFieldList/harvestFieldList.js) (Field Views), [`force-app/main/default/lwc/bundle/bundle.js`](https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/lwc/bundle/bundle.js) (Bundle Builder), [`force-app/main/default/objects/Bundle_Item__c/Bundle_Item__c.object-meta.xml`](https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/objects/Bundle_Item__c/Bundle_Item__c.object-meta.xml) (Bundle Items)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_field_ops["Field Operations"]
  node_field_views["Field Views"]
  node_field_map["Field Map<br/>[harvestFieldMap.js]"]
  node_field_record["Field Record<br/>[harvestField.js]"]
  node_irrigation_flow["Irrigation Flow"]
  node_irrigation_manager["Irrigation Controls"]
  node_harvest_records[("Harvest Records")]
end

subgraph group_commerce["Product Distribution"]
  node_merchandise_list["Merchandise Catalog<br/>[merchandiseList.js]"]
  node_bundle_ui["Bundle Builder<br/>[bundle.js]"]
  node_bundle_api["Bundle Data API"]
  node_bundle_records[("Bundle Records")]
  node_bundle_items[("Bundle Items")]
end

subgraph group_platform["Salesforce Platform"]
  node_field_records[("Field Records")]
  node_field_api["Field Data API"]
  node_platform_events["Platform Events"]
end

subgraph group_intelligence["Einstein Services"]
  node_einstein_api["Einstein API Client"]
  node_prediction["Prediction Service"]
  node_vision["Vision Service<br/>[VisionService.cls]"]
end

node_user(("Salesforce User"))
node_distributor["Distributor Systems"]
node_einstein_service["Einstein Platform"]

node_user -->|"views fields"| node_field_views
node_field_views -->|"loads fields"| node_field_api
node_field_api -.->|"reads fields"| node_field_records
node_field_views -.->|"selects map"| node_field_map
node_field_map -->|"selects record"| node_field_record
node_field_record -.->|"reads and updates"| node_field_records
node_user -->|"starts irrigation"| node_irrigation_flow
node_irrigation_flow -.->|"hosts controls"| node_irrigation_manager
node_irrigation_manager -->|"reads field"| node_field_records
node_field_records -.->|"publishes updates"| node_platform_events
node_platform_events -->|"updates stock"| node_distributor
node_distributor -->|"publishes updates"| node_platform_events
node_user -->|"browses products"| node_merchandise_list
node_user -->|"builds bundle"| node_bundle_ui
node_bundle_ui -->|"loads items"| node_bundle_api
node_bundle_ui -->|"creates and edits"| node_bundle_items
node_bundle_api -.->|"reads items"| node_bundle_items
node_bundle_items -.->|"references bundle"| node_bundle_records
node_user -.->|"uses predictions"| node_prediction
node_user -.->|"uses vision"| node_vision
node_prediction -.->|"uses client"| node_einstein_api
node_vision -.->|"uses client"| node_einstein_api
node_einstein_api -.->|"calls platform"| node_einstein_service

click node_field_views "https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/lwc/harvestFieldList/harvestFieldList.js"
click node_field_map "https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/lwc/harvestFieldMap/harvestFieldMap.js"
click node_field_record "https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/lwc/harvestField/harvestField.js"
click node_irrigation_flow "https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/flows/IrrigationManagement.flow-meta.xml"
click node_irrigation_manager "https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/lwc/irrigationManager/irrigationManager.js"
click node_harvest_records "https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/objects/Harvest__c/Harvest__c.object-meta.xml"
click node_field_records "https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/objects/Harvest_Field__c/Harvest_Field__c.object-meta.xml"
click node_field_api "https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/classes/HarvestFieldController.cls"
click node_merchandise_list "https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/lwc/merchandiseList/merchandiseList.js"
click node_bundle_ui "https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/lwc/bundle/bundle.js"
click node_bundle_api "https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/classes/BundleController.cls"
click node_bundle_records "https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/objects/Bundle__c/Bundle__c.object-meta.xml"
click node_bundle_items "https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/objects/Bundle_Item__c/Bundle_Item__c.object-meta.xml"
click node_platform_events "https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/objects/Field_Status_Change__e/Field_Status_Change__e.object-meta.xml"
click node_einstein_api "https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/classes/Einstein_HttpClient.cls"
click node_prediction "https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/classes/Einstein_PredictionService.cls"
click node_vision "https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/classes/VisionService.cls"

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_field_views,node_field_map,node_field_record,node_irrigation_flow,node_irrigation_manager,node_harvest_records,node_user toneBlue
class node_merchandise_list,node_bundle_ui,node_bundle_api,node_bundle_records,node_bundle_items toneAmber
class node_field_records,node_field_api,node_platform_events toneMint
class node_einstein_api,node_prediction,node_vision toneRose
class node_distributor,node_einstein_service toneIndigo
```

## Components

### Field Operations

- [Field Views](https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/lwc/harvestFieldList/harvestFieldList.js): `force-app/main/default/lwc/harvestFieldList/harvestFieldList.js`
- [Field Map](https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/lwc/harvestFieldMap/harvestFieldMap.js): `force-app/main/default/lwc/harvestFieldMap/harvestFieldMap.js`
- [Field Record](https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/lwc/harvestField/harvestField.js): `force-app/main/default/lwc/harvestField/harvestField.js`
- [Irrigation Flow](https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/flows/IrrigationManagement.flow-meta.xml): `force-app/main/default/flows/IrrigationManagement.flow-meta.xml`
- [Irrigation Controls](https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/lwc/irrigationManager/irrigationManager.js): `force-app/main/default/lwc/irrigationManager/irrigationManager.js`
- [Harvest Records](https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/objects/Harvest__c/Harvest__c.object-meta.xml): `force-app/main/default/objects/Harvest__c/Harvest__c.object-meta.xml`

### Product Distribution

- [Merchandise Catalog](https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/lwc/merchandiseList/merchandiseList.js): `force-app/main/default/lwc/merchandiseList/merchandiseList.js`
- [Bundle Builder](https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/lwc/bundle/bundle.js): `force-app/main/default/lwc/bundle/bundle.js`
- [Bundle Data API](https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/classes/BundleController.cls): `force-app/main/default/classes/BundleController.cls`
- [Bundle Records](https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/objects/Bundle__c/Bundle__c.object-meta.xml): `force-app/main/default/objects/Bundle__c/Bundle__c.object-meta.xml`
- [Bundle Items](https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/objects/Bundle_Item__c/Bundle_Item__c.object-meta.xml): `force-app/main/default/objects/Bundle_Item__c/Bundle_Item__c.object-meta.xml`

### Salesforce Platform

- [Field Records](https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/objects/Harvest_Field__c/Harvest_Field__c.object-meta.xml): `force-app/main/default/objects/Harvest_Field__c/Harvest_Field__c.object-meta.xml`
- [Field Data API](https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/classes/HarvestFieldController.cls): `force-app/main/default/classes/HarvestFieldController.cls`
- [Platform Events](https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/objects/Field_Status_Change__e/Field_Status_Change__e.object-meta.xml): `force-app/main/default/objects/Field_Status_Change__e/Field_Status_Change__e.object-meta.xml`

### Einstein Services

- [Einstein API Client](https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/classes/Einstein_HttpClient.cls): `force-app/main/default/classes/Einstein_HttpClient.cls`
- [Prediction Service](https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/classes/Einstein_PredictionService.cls): `force-app/main/default/classes/Einstein_PredictionService.cls`
- [Vision Service](https://github.com/trailheadapps/purealoe-lwc/blob/master/force-app/main/default/classes/VisionService.cls): `force-app/main/default/classes/VisionService.cls`

### Other components

- **Salesforce User**
- **Distributor Systems**
- **Einstein Platform**

## Connections

- Salesforce User → Field Views: views fields (evidence: `README.md`)
- Field Views → Field Data API: loads fields (evidence: `force-app/main/default/lwc/harvestFieldList/harvestFieldList.js`)
- Field Data API → Field Records: reads fields
- Field Views → Field Map: selects map
- Field Map → Field Record: selects record (evidence: `force-app/main/default/lwc/harvestFieldMap/harvestFieldMap.js`)
- Field Record → Field Records: reads and updates
- Salesforce User → Irrigation Flow: starts irrigation (evidence: `README.md`)
- Irrigation Flow → Irrigation Controls: hosts controls
- Irrigation Controls → Field Records: reads field (evidence: `force-app/main/default/lwc/irrigationManager/irrigationManager.js`)
- Field Records → Platform Events: publishes updates
- Platform Events → Distributor Systems: updates stock (evidence: `README.md`)
- Distributor Systems → Platform Events: publishes updates (evidence: `README.md`)
- Salesforce User → Merchandise Catalog: browses products (evidence: `README.md`)
- Salesforce User → Bundle Builder: builds bundle (evidence: `README.md`)
- Bundle Builder → Bundle Data API: loads items (evidence: `force-app/main/default/lwc/bundle/bundle.js`)
- Bundle Builder → Bundle Items: creates and edits (evidence: `force-app/main/default/lwc/bundle/bundle.js`)
- Bundle Data API → Bundle Items: reads items
- Bundle Items → Bundle Records: references bundle
- Salesforce User → Prediction Service: uses predictions
- Salesforce User → Vision Service: uses vision
- Prediction Service → Einstein API Client: uses client
- Vision Service → Einstein API Client: uses client
- Einstein API Client → Einstein Platform: calls platform
