# ani03sha/aem-tutorials architecture

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

- Interactive diagram: https://gitdiagram.com/ani03sha/aem-tutorials
- Repository: https://github.com/ani03sha/aem-tutorials

## Overview

##### Project type and purpose
- This is a multi-module, full-stack AEM (Adobe Experience Manager) tutorial application.
- Purpose: Demonstrate AEM concepts (OSGi services, Sling models, servlets, workflows, clientlibs, templates) alongside a React-based front end.

##### File structure
- Top-level modules (in Maven aggregator “all/pom.xml”):
- core — Java OSGi bundle (backend services, Sling models, servlets, event handlers, schedulers, workflows)
- ui.apps & ui.apps.structure — JCR-root packages defining AEM components, clientlibs (HTL, CSS, JS), dialogs, templates, configurations
- ui.content — JCR content packages (policies, templates, site content, experience fragments, DAM assets, workflows definitions)
- ui.frontend — React SPA (App.js, components, utilities) built and packaged as a clientlib or deployed separately
- “all” is the aggregator POM, orchestrating build order and package assembly for AEM deployment.

##### README for additional insights
- It’s a tutorial series compatible with AEM 6.3–6.5 covering OSGi, Sling, HTL, workflows, schedulers, eventing, etc.

##### Main components and interactions
a. AEM Author/Publish Instance
- OSGi Container: runs the “core” bundle
- JCR Repository: stores everything under /apps and /conf from ui.apps & ui.content
- Sling Engine: resolves requests via Sling models and servlets
b. Java OSGi “core” Bundle
- Services (CardService, EmailService, etc.)
- Sling Models (CardImpl, UserImpl)
- Servlets (FetchTODOServlet, SearchServlet, etc.)
- Event Handlers & Schedulers
- Workflow Participants & Processes
c. JCR Packages
- ui.apps — component definitions, HTL templates, dialogs, clientlibs for styling and client-side behavior
- ui.content — content policies, templates, sample content, experience fragments, DAM assets
d. React Front End (ui.frontend)
- Independent SPA that fetches data via Sling servlet endpoints
- Packaged as AEM clientlib or served externally and proxied to AEM APIs

##### Architectural patterns & design principles
- OSGi modularity: one bundle (“core”) with clear service interfaces and implementations
- MVC/MVVM in Sling: Models (Sling Models) → Views (HTL) → Controllers (Servlets & Services)
- Content-first: separation of content (ui.content) vs. presentation (ui.apps)
- Headless/client-side: React front-end consuming Sling JSON endpoints (servlets)
- Maven multi-module: isolates build artifacts, packages, and dependencies

## Diagram (Mermaid)

```mermaid
graph TB
    %% Maven Build
    subgraph "Maven Multi-Module Build" 
        all["all (Aggregator)"]:::build
        coreModule["core Module"]:::backend
        uiAppsPkg["ui.apps Package"]:::jcr
        uiContentPkg["ui.content Package"]:::jcr
        uiFrontendMod["ui.frontend Module"]:::frontend
        all --> coreModule
        all --> uiAppsPkg
        all --> uiContentPkg
        all --> uiFrontendMod
    end

    %% AEM Instance
    subgraph "AEM Instance (Author/Publish)"
        subgraph "OSGi Container"
            coreBundle["core.jar (OSGi Bundle)"]:::backend
            interfaces["Service Interfaces"]:::backend
            implServices["Service Implementations"]:::backend
            modelsApi["Sling Models API"]:::backend
            modelsImpl["Sling Model Impl"]:::backend
            servlets["Sling Servlets (JSON Endpoints)"]:::backend
            events["Event Handlers & Listeners"]:::backend
            schedulers["Schedulers (Jobs)"]:::backend
            workflows["Workflows (Participants & Processes)"]:::backend
            configs["Configuration POJOs"]:::backend
            utils["Utilities & Constants"]:::backend

            servlets --> interfaces
            servlets --> implServices
            servlets --> modelsApi
            servlets --> modelsImpl
            servlets --> configs
            servlets --> utils
            interfaces --> implServices
            implServices --> utils
            implServices --> configs
            implServices --> workflows
            implServices --> schedulers
            implServices --> events
        end
        subgraph "JCR Repository"
            apps["/apps & /conf (ui.apps, ui.content)"]:::jcr
        end
    end

    %% React Frontend
    react["React SPA"]:::frontend

    %% ui.apps Package Details
    subgraph "ui.apps Package"
        componentsUi["Component Definitions & HTL"]:::jcr
        clientlibs["Clientlibs (CSS/JS)"]:::jcr
        dialogs["Dialog Definitions (_cq_dialog)"]:::jcr
        structure["Page & Structure Components"]:::jcr
        felixConfigs["OSGi Felix Configs"]:::jcr
        templates["HTL Templates"]:::jcr
        tests["Front-end Tests"]:::jcr
    end

    %% ui.content Package Details
    subgraph "ui.content Package"
        contentPolicies["Content Policies & WCM Config"]:::jcr
        siteContent["Site Content & Pages"]:::jcr
        damAssets["DAM Assets"]:::jcr
        experience["Experience Fragments"]:::jcr
        workflowDefs["Workflow Definitions"]:::jcr
    end

    %% React Module Details
    subgraph "React SPA (ui.frontend)"
        entry["App.js"]:::frontend
        componentsFE["React Components"]:::frontend
        utilsFE["React Utilities"]:::frontend
        public["Public Files (index.html, manifest)"]:::frontend
        assembly["AEM Clientlib Packaging"]:::frontend
    end

    %% Relationships
    coreModule --> coreBundle
    uiAppsPkg --> componentsUi
    uiAppsPkg --> clientlibs
    uiAppsPkg --> dialogs
    uiAppsPkg --> structure
    uiAppsPkg --> felixConfigs
    uiAppsPkg --> templates
    uiAppsPkg --> tests

    uiContentPkg --> contentPolicies
    uiContentPkg --> siteContent
    uiContentPkg --> damAssets
    uiContentPkg --> experience
    uiContentPkg --> workflowDefs

    coreBundle --> apps
    apps --> componentsUi
    apps --> contentPolicies

    react --> servlets
    servlets --> apps
    implServices --> apps
    events --> apps
    schedulers --> apps
    workflows --> apps

    react --> entry
    entry --> componentsFE
    entry --> utilsFE
    entry --> public
    entry --> assembly

    %% Click Events
    click all "https://github.com/ani03sha/aem-tutorials/blob/master/all/pom.xml"
    click coreModule "https://github.com/ani03sha/aem-tutorials/blob/master/core/pom.xml"
    click coreBundle "https://github.com/ani03sha/aem-tutorials/tree/master/core/src/main/java/org/redquark/aem/tutorials/core"
    click interfaces "https://github.com/ani03sha/aem-tutorials/tree/master/core/src/main/java/org/redquark/aem/tutorials/core/services"
    click implServices "https://github.com/ani03sha/aem-tutorials/tree/master/core/src/main/java/org/redquark/aem/tutorials/core/services/impl"
    click modelsApi "https://github.com/ani03sha/aem-tutorials/tree/master/core/src/main/java/org/redquark/aem/tutorials/core/models"
    click modelsImpl "https://github.com/ani03sha/aem-tutorials/tree/master/core/src/main/java/org/redquark/aem/tutorials/core/models/impl"
    click servlets "https://github.com/ani03sha/aem-tutorials/tree/master/core/src/main/java/org/redquark/aem/tutorials/core/servlets"
    click events "https://github.com/ani03sha/aem-tutorials/tree/master/core/src/main/java/org/redquark/aem/tutorials/core/events/handler"
    click schedulers "https://github.com/ani03sha/aem-tutorials/tree/master/core/src/main/java/org/redquark/aem/tutorials/core/schedulers"
    click workflows "https://github.com/ani03sha/aem-tutorials/tree/master/core/src/main/java/org/redquark/aem/tutorials/core/workflows/participant"
    click configs "https://github.com/ani03sha/aem-tutorials/tree/master/core/src/main/java/org/redquark/aem/tutorials/core/configs"
    click utils "https://github.com/ani03sha/aem-tutorials/tree/master/core/src/main/java/org/redquark/aem/tutorials/core/utils"

    click componentsUi "https://github.com/ani03sha/aem-tutorials/tree/master/ui.apps/src/main/content/jcr_root/apps/aemtutorials/components"
    click clientlibs "https://github.com/ani03sha/aem-tutorials/tree/master/ui.apps/src/main/content/jcr_root/apps/aemtutorials/clientlibs"
    click dialogs "https://github.com/ani03sha/aem-tutorials/tree/master/ui.apps/src/main/content/jcr_root/apps/aemtutorials/components/**/_cq_dialog"
    click structure "https://github.com/ani03sha/aem-tutorials/tree/master/ui.apps/src/main/content/jcr_root/apps/aemtutorials/components/structure/page"
    click felixConfigs "https://github.com/ani03sha/aem-tutorials/blob/master/ui.apps/src/main/content/jcr_root/apps/aemtutorials/config/org.apache.sling.commons.log.LogManager.factory.config-aemtutorials.xml"
    click templates "https://github.com/ani03sha/aem-tutorials/tree/master/ui.apps/src/main/content/jcr_root/apps/aemtutorials/templates"
    click tests "https://github.com/ani03sha/aem-tutorials/tree/master/ui.apps/src/main/content/jcr_root/apps/aemtutorials/tests"

    click contentPolicies "https://github.com/ani03sha/aem-tutorials/tree/master/ui.content/src/main/content/jcr_root/conf/aemtutorials/settings/wcm"
    click siteContent "https://github.com/ani03sha/aem-tutorials/tree/master/ui.content/src/main/content/jcr_root/content/aemtutorials"
    click damAssets "https://github.com/ani03sha/aem-tutorials/tree/master/ui.content/src/main/content/jcr_root/content/dam/aemtutorials"
    click experience "https://github.com/ani03sha/aem-tutorials/tree/master/ui.content/src/main/content/jcr_root/content/experience-fragments/aemtutorials"
    click workflowDefs "https://github.com/ani03sha/aem-tutorials/tree/master/ui.content/src/main/content/jcr_root/var/workflow/models/aemtutorials"

    click uiFrontendMod "https://github.com/ani03sha/aem-tutorials/blob/master/ui.frontend/pom.xml"
    click entry "https://github.com/ani03sha/aem-tutorials/blob/master/ui.frontend/src/App.js"
    click componentsFE "https://github.com/ani03sha/aem-tutorials/tree/master/ui.frontend/src/components"
    click utilsFE "https://github.com/ani03sha/aem-tutorials/tree/master/ui.frontend/src/utils"
    click public "https://github.com/ani03sha/aem-tutorials/blob/master/ui.frontend/public/index.html"
    click assembly "https://github.com/ani03sha/aem-tutorials/blob/master/ui.frontend/assembly.xml"

    %% Styles
    classDef backend fill:#dae8fc,stroke:#6c8ebf,color:#1a237e
    classDef jcr fill:#d9ead3,stroke:#6aa84f,color:#274e13
    classDef frontend fill:#ffe6cc,stroke:#f1a654,color:#7f6000
    classDef build fill:#f2f2f2,stroke:#999999,color:#333333
```
