# phoolhbti/citraining architecture

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

- Interactive diagram: https://gitdiagram.com/phoolhbti/citraining
- Repository: https://github.com/phoolhbti/citraining

## Overview

<explanation>
1. Identify the project type and purpose  
   - This is an Adobe Experience Manager (AEM) multi‑module Maven project (“citraining”) that builds:
     • OSGi bundles and Java back‑end logic (core, bundle, bundle‑taglib)  
     • JCR content and configs (content, ui.apps, ui.config, ui.content)  
     • Front‑end assets via Webpack (ui.frontend)  
     • Dispatcher configurations for Apache HTTP caching (dispatcher, dispatcher.ams)  
     • Integration and UI tests (it.tests, ui.tests)  

2. Analyze the file structure  
   - Top‑level aggregator pom.xml ties together modules: all, core, content, ui.apps, ui.config, ui.content, ui.frontend, dispatchers, test modules.  
   - “core” contains OSGi services, servlets, filters, schedulers, Sling models.  
   - “bundle‑taglib” and “bundle” produce additional OSGi bundles for custom JSP taglibs.  
   - “content” holds generic content package definitions.  
   - “ui.apps” and “ui.content” deliver /apps and /conf JCR packages.  
   - “ui.config” delivers OSGi configurations under /apps/citraining/osgiconfig.  
   - “ui.frontend” compiles SCSS/JS into AEM clientlibs.  
   - “dispatcher” and “dispatcher.ams” produce Apache Dispatcher vhost/farm configs for on‑premise and AMS.  
   - “it.tests” runs JUnit ITs against AEM instances.  
   - “ui.tests” runs WebDriver/Selenium tests in containers (Docker compose).  

3. Examine the README  
   - The README is minimal. Use module names and Maven lifecycle as source of architecture.

4. System design diagram instructions  
   a. Main components (draw each as distinct boxes):  
      – Developer/CI pipeline (Maven build agent)  
      – AEM Author instance  
      – AEM Publish instance  
      – Dispatcher (Apache HTTPD) in front of publish (and author if applicable)  
      – JCR repository (underlying CRX/Jackrabbit OAK)  
      – External services: Commerce GraphQL endpoint, FDM/Salesforce/Dynamics cloud configs  
      – Test environments (IT tests container, UI tests containers)  

   b. Relationships & interactions (use directional arrows):  
      – CI → Maven modules → AEM package deploy (ui.apps + content + config + core + bundles)  
      – UI.frontend → builds clientlibs → deployed into ui.apps  
      – Dispatcher → routes incoming HTTP(S) traffic → AEM publish → JCR repository  
      – Publish calls out → External GraphQL commerce service  
      – IT tests → invoke AEM servlets/Pages → validate responses  
      – UI tests → drive browser via WebDriver → hit Dispatcher → AEM  

   c. Architectural patterns & design principles  
      – Multi‑module Maven “feature‑oriented” packaging (separate OSGi, content, config, front‑end)  
      – OSGi micro‑services (servlets, schedulers, Sling models, filters)  
      – Client‑side asset pipeline with Webpack → AEM clientlibs  
      – Dispatcher as caching/reverse‑proxy layer  
      – Test modules for contract and end‑to‑end coverage  

   d. Technologies, frameworks, libraries  
      – Java / Sling / OSGi (Apache Felix)  
      – Sling Models, Sling Servlets, Filters, Schedulers  
      – Maven, Sling Maven Plugin, AEM Content Package Maven Plugin  
      – Webpack, Node, SCSS, TypeScript (in ui.frontend)  
      – Apache HTTPD + Dispatcher module  
      – JUnit + AEM Mocks + HttpUnit (for it.tests)  
      – WebDriverIO + Docker (for ui.tests)  

5. Tailoring the diagram to this AEM project  
   - Emphasize separation of concerns:  
     * OSGi bundles vs. JCR content vs. front‑end assets vs. Dispatcher config  
   - Show the Maven aggregator building sub‑packages in proper order.  
   - Highlight how ui.frontend → ui.apps clientlibs interplay works.  
   - For Dispatcher.ams vs. on‑prem “dispatcher” module, show two deployment targets.  
   - For test modules, show them running in isolated containerized environments against AEM instance endpoints.  

6. Diagram styling guidelines  
   - Use clear labels for each box (e.g., “core.jar”, “ui.apps package”, “AEM Publish”).  
   - Use arrows with labels (e.g., “deploy”, “HTTP GET/POST”, “GraphQL call”) for data flow.  
   - Color‑code component types:  
     * Blue for AEM modules (core, content, ui.apps, ui.config, ui.content)  
     * Green for front‑end build (ui.frontend)  
     * Orange for Dispatcher (dispatcher, dispatcher.ams)  
     * Gray for external services (Commerce GraphQL, FDM/Salesforce)  
     * Purple for test environments (it.tests, ui.tests)  
   - Use different shapes:  
     * Rectangles for runtime components (Author, Publish, Dispatcher)  
     * Cylinders for repositories or databases (JCR)  
     * Document icons for packages/artifacts  

7. Detail and completeness  
   - Ensure every Maven module is represented, even if nested.  
   - Show the flow from source code → Maven build → AEM deployment → production runtime.  
   - Include both author and publish flows, plus dispatcher in front.  
   - Highlight external dependencies and configuration layers (ui.config).  
   - Represent test infrastructure separately, showing how they simulate end‑users or integrations.

By following these guidelines, you’ll produce a comprehensive, accurate diagram that captures the essential architecture of the citraining AEM project.  
</explanation>

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% CI Layer
    MAV["Maven Aggregator\n(pom.xml)"]:::ci

    %% Build Modules
    subgraph "Build Modules"
        CORE_BUNDLE["OSGi Core Bundle\n(core/src)"]:::build
        TAGLIB["Custom JSP Taglib Bundle\n(bundle-taglib/src)"]:::build
        BUNDLE["Additional OSGi Bundle\n(bundle/pom.xml)"]:::build
        CONTENT["Generic Content Package\n(content/src)"]:::build
        UI_APPS["JCR /apps Package\n(ui.apps/src)"]:::build
        CLIENTLIBS["Clientlibs Assets\n(ui.apps/clientlibs)"]:::build
        UI_CONFIG["OSGi Configurations\n(ui.config/src)"]:::build
        UI_CONTENT["JCR /conf Package\n(ui.content/src)"]:::build
        UI_FRONTEND["Front-end Build\n(ui.frontend/src)"]:::frontend
        DISPATCHER_CFG["Dispatcher Config\n(dispatcher/src)"]:::dispatcher
        DISPATCHER_AMS_CFG["Dispatcher AMS Config\n(dispatcher.ams/src)"]:::dispatcher
    end

    %% Runtime Layer
    subgraph "AEM Runtime"
        AUTHOR["AEM Author"]:::aem
        DISPATCHER["Dispatcher\n(Apache HTTPD)"]:::dispatcher
        PUBLISH["AEM Publish"]:::aem
        REPO[(JCR Repository)]:::repo
    end

    %% External Services
    subgraph "External Services"
        GRAPHQL["Commerce GraphQL Endpoint"]:::external
        CLOUD["FDM/Salesforce/Dynamics"]:::external
    end

    %% Test Environments
    subgraph "Test Environments"
        IT_TEST["Integration Tests\n(JUnit ITs)"]:::tests
        UI_TEST["UI Tests\n(WebDriver)"]:::tests
    end

    %% CI to Build
    MAV -->|build| CORE_BUNDLE
    MAV -->|build| TAGLIB
    MAV -->|build| BUNDLE
    MAV -->|build| CONTENT
    MAV -->|build| UI_APPS
    MAV -->|build| UI_CONFIG
    MAV -->|build| UI_CONTENT
    MAV -->|build| UI_FRONTEND
    MAV -->|build| DISPATCHER_CFG
    MAV -->|build| DISPATCHER_AMS_CFG

    %% Front-end to Clientlibs
    UI_FRONTEND -->|webpack build| CLIENTLIBS
    CLIENTLIBS -->|included in| UI_APPS

    %% Build to Author
    CORE_BUNDLE -->|deploy| AUTHOR
    TAGLIB -->|deploy| AUTHOR
    BUNDLE -->|deploy| AUTHOR
    CONTENT -->|deploy| AUTHOR
    UI_APPS -->|deploy| AUTHOR
    UI_CONFIG -->|deploy| AUTHOR
    UI_CONTENT -->|deploy| AUTHOR

    %% Dispatcher deployment
    DISPATCHER_CFG -->|deploy on-prem| DISPATCHER
    DISPATCHER_AMS_CFG -->|deploy AMS| DISPATCHER

    %% Runtime traffic
    DISPATCHER -->|"HTTP GET/POST"| PUBLISH
    PUBLISH -->|"JCR read/write"| REPO
    PUBLISH -->|"GraphQL call"| GRAPHQL
    PUBLISH -->|"Cloud Config fetch"| CLOUD

    %% Test interactions
    IT_TEST -->|"HTTP calls"| AUTHOR
    IT_TEST -->|"HTTP calls"| PUBLISH
    UI_TEST -->|"Simulate browser"| DISPATCHER

    %% Click Events
    click MAV "https://github.com/phoolhbti/citraining/blob/master/pom.xml"
    click CORE_BUNDLE "https://github.com/phoolhbti/citraining/tree/master/core/src/main/java/com/citraining/core"
    click TAGLIB "https://github.com/phoolhbti/citraining/tree/master/bundle-taglib/src/main/java/com/citraining/tag"
    click BUNDLE "https://github.com/phoolhbti/citraining/blob/master/bundle/pom.xml"
    click CONTENT "https://github.com/phoolhbti/citraining/tree/master/content/src/main/content"
    click UI_APPS "https://github.com/phoolhbti/citraining/tree/master/ui.apps/src/main/content/jcr_root/apps/citraining"
    click CLIENTLIBS "https://github.com/phoolhbti/citraining/tree/master/ui.apps/src/main/content/jcr_root/apps/citraining/clientlibs"
    click UI_CONFIG "https://github.com/phoolhbti/citraining/tree/master/ui.config/src/main/content/jcr_root/apps/citraining/osgiconfig"
    click UI_CONTENT "https://github.com/phoolhbti/citraining/tree/master/ui.content/src/main/content/jcr_root/conf/citraining/settings/cloudconfigs"
    click UI_FRONTEND "https://github.com/phoolhbti/citraining/tree/master/ui.frontend/src/main/webpack"
    click DISPATCHER_CFG "https://github.com/phoolhbti/citraining/tree/master/dispatcher/src"
    click DISPATCHER_AMS_CFG "https://github.com/phoolhbti/citraining/tree/master/dispatcher.ams/src"
    click IT_TEST "https://github.com/phoolhbti/citraining/tree/master/it.tests/src/main/java/com/citraining/it/tests"
    click UI_TEST "https://github.com/phoolhbti/citraining/tree/master/ui.tests/test-module"

    %% Styles
    classDef ci fill:#D0E6FF,stroke:#3399FF,color:#000;
    classDef build fill:#E6F2FF,stroke:#0066CC,color:#000;
    classDef frontend fill:#E6FFE6,stroke:#33CC33,color:#000;
    classDef dispatcher fill:#FFE6CC,stroke:#FF8000,color:#000;
    classDef aem fill:#CCFFFF,stroke:#33CCCC,color:#000;
    classDef repo fill:#FFFFFF,stroke:#999999,color:#000;
    classDef external fill:#F2F2F2,stroke:#666666,color:#000;
    classDef tests fill:#F0E6FF,stroke:#9933FF,color:#000;
```
