# mendix/extensionapi-samples architecture

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

- Interactive diagram: https://gitdiagram.com/mendix/extensionapi-samples
- Repository: https://github.com/mendix/extensionapi-samples

## Overview

##### Project Type and Purpose
- This is a sample repository for Mendix Studio Pro Extensions. It aims to demonstrate various extension use cases (e.g., adding context menus, dockable panes, custom menus, microflow manipulation, and modal webview dialogs).
- The central purpose is educational: to show how different parts of the Mendix Extensions API can be utilized in real projects.

##### File Structure
- The top-level directories include an extensive “API Reference” folder where every aspect of the Extensions API is broken down into components (BackgroundJobs, ConsistencyCheck, DomainModels, Microflows, UI components, etc.). This illustrates a modular design in the API itself.
- There are separate tutorial directories (tutorial_basics, tutorial_contextMenus, tutorial_dockablePanes, tutorial_menus, tutorial_microflows, tutorial_modalWebviewDialogs). Each one is a self-contained project with its own .csproj and manifest.json; these serve as discrete examples that hook into the core API.
- A solution file (MyCompany.MyProject.ExtensionSamples.sln) ties these sample projects together, suggesting a suite of interconnected examples.

##### Key Architectural Components
a. Core Extensions API (Library Layer):
- Represented by the API Reference folder.
- Contains interfaces, classes, documentation, and service components for Background Jobs, Domain Models, Microflows, UI components (e.g., Dockable Panes, Menus), etc.
b. Sample Projects (Extension Implementations):
- Each tutorial (Basics, Context Menus, Dockable Panes, Menus, Microflows, Modal Webview Dialogs) implements a specific extension.
- They serve as entry points that interact with the core API – each defined via their respective project file and manifest.
c. Integration and Deployment:
- The sample projects illustrate how to integrate with the core API. They may depend on specific Mendix API services (such as IBackgroundJobService, IMicroflowService, or IMenuExtension).
- The manifest.json in each sample provides metadata for integration, showing how the extension is configured within Mendix Studio Pro.

##### Relationships and Interactions
- Each sample should be individually represented – as separate blocks that connect back to the central API components.

##### Architectural Patterns and Technologies
- The API design follows an interface-based modular design, as evidenced by the many “I…” prefixed interfaces.
- Each sample project adheres to the same API, demonstrating dependency injection or service-oriented principles.
- The repository is designed to be extensible, allowing for new sample extensions to be added easily by following the provided patterns.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Extensions API Subgraph
    subgraph "Core Extensions API"
        CoreAPI["Core Extensions API"] 
        BGJ["Background Jobs"]
        DOM["Domain Models"]
        MFL["Microflows"]
        DP["Dockable Panes"]
        MN["Menus"]
        MD["Modal Dialogs"]
        WV["WebView"]
    end

    %% Sample Projects Subgraph
    subgraph "Sample Projects"
        Basics["Tutorial: Basics"]
        ContextMenus["Tutorial: Context Menus"]
        DockableTutorial["Tutorial: Dockable Panes"]
        MenusTutorial["Tutorial: Menus"]
        MicroflowsTutorial["Tutorial: Microflows"]
        ModalTutorial["Tutorial: Modal Webview Dialogs"]
    end

    %% Relationships within the Core API (overview to detailed docs)
    CoreAPI ---|"includes"| BGJ
    CoreAPI ---|"includes"| DOM
    CoreAPI ---|"includes"| MFL
    CoreAPI ---|"includes"| DP
    CoreAPI ---|"includes"| MN
    CoreAPI ---|"includes"| MD
    CoreAPI ---|"includes"| WV

    %% Sample Projects calling into the core API components
    Basics -->|"calls"| CoreAPI
    ContextMenus -->|"calls"| MN
    DockableTutorial -->|"calls"| DP
    MenusTutorial -->|"calls"| MN
    MicroflowsTutorial -->|"calls"| MFL
    ModalTutorial -->|"calls"| MD
    ModalTutorial -->|"calls"| WV

    %% Styles for core and sample components
    classDef core fill:#ffcc99,stroke:#e67e22,stroke-width:2px;
    classDef sample fill:#ace,stroke:#3498db,stroke-width:2px;
    class CoreAPI,BGJ,DOM,MFL,DP,MN,MD,WV core;
    class Basics,ContextMenus,DockableTutorial,MenusTutorial,MicroflowsTutorial,ModalTutorial sample;

    %% Click Events for Core API Components
    click CoreAPI "https://github.com/mendix/extensionapi-samples/tree/main/API Reference"
    click BGJ "https://github.com/mendix/extensionapi-samples/blob/main/API Reference/Mendix.StudioPro.ExtensionsAPI.BackgroundJobs"
    click DOM "https://github.com/mendix/extensionapi-samples/blob/main/API Reference/Mendix.StudioPro.ExtensionsAPI.Model.DomainModels"
    click MFL "https://github.com/mendix/extensionapi-samples/blob/main/API Reference/Mendix.StudioPro.ExtensionsAPI.Model.Microflows"
    click DP "https://github.com/mendix/extensionapi-samples/blob/main/API Reference/Mendix.StudioPro.ExtensionsAPI.UI.DockablePane"
    click MN "https://github.com/mendix/extensionapi-samples/blob/main/API Reference/Mendix.StudioPro.ExtensionsAPI.UI.Menu"
    click MD "https://github.com/mendix/extensionapi-samples/blob/main/API Reference/Mendix.StudioPro.ExtensionsAPI.UI.Dialogs"
    click WV "https://github.com/mendix/extensionapi-samples/blob/main/API Reference/Mendix.StudioPro.ExtensionsAPI.UI.WebView"

    %% Click Events for Sample Projects
    click Basics "https://github.com/mendix/extensionapi-samples/tree/main/tutorial_basics"
    click ContextMenus "https://github.com/mendix/extensionapi-samples/tree/main/tutorial_contextMenus"
    click DockableTutorial "https://github.com/mendix/extensionapi-samples/tree/main/tutorial_dockablePanes"
    click MenusTutorial "https://github.com/mendix/extensionapi-samples/tree/main/tutorial_menus"
    click MicroflowsTutorial "https://github.com/mendix/extensionapi-samples/tree/main/tutorial_microflows"
    click ModalTutorial "https://github.com/mendix/extensionapi-samples/tree/main/tutorial_modalWebviewDialogs"
```
