# nutanamru/salesforce_projects architecture

> Architecture diagram of the GitHub repository nutanamru/salesforce_projects, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nutanamru/salesforce_projects
- Repository: https://github.com/nutanamru/salesforce_projects

## Overview

##### Project type and purpose
- HandsMen Threads is a cloud-native CRM application built on Salesforce.
- It automates order confirmations, inventory alerts, loyalty tracking, and nightly batch reconciliation.
- Core technologies: Apex (triggers, classes, batch jobs), Flow Builder, Lightning App Builder, standard/custom Salesforce objects, Email Alerts.

##### File structure
- HandsMen_Threads.pdf – project overview and supporting documentation.
- Readme.md – outlines features, tech stack, real-world problems addressed.
- apex code.zip – contains all Apex triggers, classes, batch jobs and metadata for flows and Lightning pages.

##### README for architectural insights
- UI layer: Lightning App Builder pages and possibly Visualforce/Lightning Components.
- Business logic: Apex triggers for real-time data checks, Batch Apex for nightly reconciliation, Flow Builder for scheduled flows and record-based automations.
- Data layer: Salesforce objects (Order, Inventory, Loyalty, etc.) defined via master-detail and lookup relationships.
- Integrations: Email Alerts for notifications, plus any external or internal warehouse systems receiving alerts by email.

a. Main components (4 layers):
– User Interface: Salesforce Lightning pages and flows (mobile/desktop).
– Business Logic:
- Apex Trigger modules (on-save record checks)
- Apex Classes (service layer)
- Batch Apex jobs scheduled at midnight
- Flow Builder processes (scheduled and record-triggered Flows)
– Data Storage: Custom and standard Salesforce objects with relationships.
– External Services:
- Email service (Salesforce Email Alerts)
- Warehouse/ERP email endpoint or API (if applicable)
b. Relationships and interactions:
– Scheduled flows and Batch Jobs run autonomously at defined times, update records and fire email alerts.
– Email Alerts flow outbound to warehouse or customers.
c. Architectural patterns & principles:
– Event-driven (record-triggered triggers and flows).
– Layered separation: UI (Lightning) → application services (Apex/Flows) → persistence (objects).
– Scheduled processing for bulk jobs.
– Declarative + programmatic hybrid approach (Flow Builder + Apex).
d. Key technologies & frameworks:
– Salesforce Lightning App Builder, Flow Builder, Apex (Triggers, Classes, Batch).
– Standard Email Alert infrastructure.
– Data modeling via master-detail and lookup relationships.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Global Documentation
    DocsPDF["Project Docs: HandsMen_Threads.pdf"]:::external
    Readme["Architecture Notes: Readme.md"]:::external

    DocsPDF -->|refer to| Readme
    Readme -->|guides UI & Logic| UI

    %% UI Layer
    subgraph "UI Layer"
        direction TB
        LightningPages["Lightning App Builder Pages"]:::ui
        AuraComponents["Aura Components (Custom UI)"]:::ui
    end
    click LightningPages "https://github.com/nutanamru/salesforce_projects/tree/main/apex code.zip/flexipages/"
    click AuraComponents "https://github.com/nutanamru/salesforce_projects/tree/main/apex code.zip/aura/"

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        direction TB
        Triggers["Apex Triggers (record-triggered)"]:::logic
        ApexClasses["Apex Classes (Service Layer)"]:::logic
        BatchJobs["Batch Apex Jobs (Nightly)"]:::logic
        Flows["Flow Builder Processes"]:::logic
    end
    click Triggers "https://github.com/nutanamru/salesforce_projects/tree/main/apex code.zip/triggers/"
    click ApexClasses "https://github.com/nutanamru/salesforce_projects/tree/main/apex code.zip/classes/"
    click BatchJobs "https://github.com/nutanamru/salesforce_projects/tree/main/apex code.zip/classes/"
    click Flows "https://github.com/nutanamru/salesforce_projects/tree/main/apex code.zip/flows/"

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        DataObjects["Salesforce Objects (Order, Inventory, Loyalty)"]:::data
    end
    click DataObjects "https://github.com/nutanamru/salesforce_projects/tree/main/apex code.zip/objects/"

    %% Integration Layer
    subgraph "Integration Layer"
        direction TB
        EmailAlerts["Email Alerts & Templates"]:::external
        WarehouseEndpoint["Warehouse/ERP Endpoint"]:::external
    end
    click EmailAlerts "https://github.com/nutanamru/salesforce_projects/tree/main/apex code.zip/email/"

    %% Relationships
    UI -->|user clicks, CRUD| Triggers
    UI -->|invokes| Flows
    Triggers -->|read/write| DataObjects
    ApexClasses -->|business logic calls| DataObjects
    Flows -->|scheduled/record-triggered| DataObjects
    BatchJobs -->|scheduled nightly| DataObjects
    BatchJobs -->|after processing| EmailAlerts
    Flows -->|on criteria| EmailAlerts
    DataObjects -->|notify| EmailAlerts
    EmailAlerts -->|send notifications| WarehouseEndpoint

    %% Classes
    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef logic fill:#90EE90,stroke:#333,stroke-width:1px
    classDef data fill:#FFFF66,stroke:#333,stroke-width:1px
    classDef external fill:#FFA500,stroke:#333,stroke-width:1px
```
