# infor-cloud/m3-h5-sdk architecture

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

- Interactive diagram: https://gitdiagram.com/infor-cloud/m3-h5-sdk
- Repository: https://github.com/infor-cloud/m3-h5-sdk

## Overview

##### Project Type and Overview
- Odin is a framework for building web applications that interface with Infor M3 systems.
- It is composed of three major parts:
– A Command Line Interface (CLI) (located under the “cli” directory) used for bootstrapping, serving, and building projects.
– A Core API library that depends only on RxJS and contains core M3 integration functionality.
– Angular services (packaged as @infor-up/m3-odin-angular) that provide M3-related features (such as executing MI programs, managing user context, etc.) and can optionally work with Infor IDS (SoHo) UI components.
- There are also sample projects, documentation, and plug-in boilerplates included (e.g., in the “m3-odin” and “login” directories) which illustrate usage in an Angular context and support the complete lifecycle from development through deployment in H5.

##### Analyzing the File Structure
- Top-level folders like “cli”, “m3-odin”, and “login” show how the project is modularized:
– The “cli” directory contains scripts, commands, boilerplates for Angular (both IDS and plain Angular), and utilities to create, serve, build, and publish new applications.
– The “m3-odin” directory holds the core API code, Angular integration (see “projects/infor-up/m3-odin-angular”), sample application code, e2e tests, documentation, and TypeScript configuration, indicating a robust modular design with clear separation between core logic and UI/integration layers.
– The “login” directory suggests a separate utility or component for handling authentication tasks (e.g., provisioning login functionality via the CLI and/or within the integrated apps).
- Configuration files (like angular.json, tsconfig.json, package.json in various subdirectories) indicate multiple build targets and support for different project types (Angular, basic vanilla web, etc.).

##### Components and Their Relationships
- CLI Component:
– Responsible for scaffolding new projects, managing development tasks (build, serve, version publish), and incorporating boilerplate templates.
– Interacts with other components by generating appropriate configuration files and by invoking underlying scripts (see the “cli/src/commands”).
- Core API (non-Angular):
– Provides functionalities to execute MI transactions and handle low-level M3 integrations using RxJS.
– Acts as the backbone over which Angular services are built.
- Angular Services:
– Wrap the core functionalities in Angular modules (see the “@infor-up/m3-odin-angular” package within “m3-odin/projects/infor-up/m3-odin-angular”).
– Supply service components that interact with M3 MI transactions, user context management, and potentially UI-level operations.
- Sample/Boilerplate Projects:
– Offer examples on how to use the CLI to generate projects that may include Angular IDS-based components or simple, vanilla web projects.
- External Integration:
– The system design should include elements showing integration with external systems such as the M3 backend and ION API, including the proxy authentication flows as described in the README.
– Indicate that the CLI supports setting proxy endpoints and authenticating (via basic auth or OAuth2 with the “odin login” flow).

##### Architectural Patterns and Design Principles
- Modular & Layered Architecture: Clear separation between CLI, core libraries, Angular services, and sample applications.
- Dependency Injection: Notably used in Angular services (e.g., IonApiConfig token) to allow for configuration overrides.
- Separation of Concerns: The CLI is solely for project scaffolding and build processes, while the core API focuses on M3 interactions without Angular dependencies.
- Extensibility: Provided boilerplates and sample codes indicate that the framework is designed to be customizable for different M3 application scenarios.
- Clear boundaries between front-end (Angular) logic and underlying service calls (using RxJS and MIRecord manipulation for MI transactions).

##### Detailed Steps for the Principal Software Engineer
– Begin with the CLI layer that covers project generation and build tasks.
– Then illustrate the generated application layer divided into the core API (which handles low-level M3 integration) and Angular services (which facilitate higher-level integration and UI interactions).
– Finally, show the external integration with Infor M3 and ION API.
- Component with its corresponding file tree locations (e.g., “cli/src/commands” for CLI commands, “m3-odin/projects/infor-up/m3-odin-angular” for Angular services).
– The flow of commands from CLI to the building process.
– The flow of data from Angular UI, through the service layer, to the core API and then to external endpoints.
– The configuration flow where the “odin set” and “odin login” commands update proxy and token configurations.
- Legends and annotations that explain key interactions and design principles.
- To capture details like:
– The CLI’s role in project creation (including boilerplate selection).
– The independent core API (with RxJS dependency).
– Conditional OAuth2 / Basic auth integrations for proxy authentication.
– The optional Infor IDS controls integration.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A1("Odin CLI"):::development
    B1("CLI Commands"):::development
    C1("CLI Boilerplate Angular Soho"):::development
    C2("CLI Boilerplate Angular"):::development
    C3("CLI Boilerplate Basic"):::development
    D1("Sample Angular Project"):::development
    A2("Core API Library (RxJS based)"):::runtime
    A3("Angular Services for M3"):::runtime
    E1("Authentication/Proxy Configuration"):::auth
    E2("CLI Login Command"):::auth
    E3("CLI Set Command"):::auth
    E4("Proxy Config"):::auth
    E5("Login Utility"):::auth
    F1("External M3/ION API Systems"):::external

    %% Connections from CLI layer
    A1 -->|"executes"| B1
    A1 -->|"providesBoilerplate"| C1
    A1 -->|"providesBoilerplate"| C2
    A1 -->|"providesBoilerplate"| C3
    A1 -->|"generatesProject"| D1
    A1 -->|"configures"| E1

    %% CLI Commands invoke core functionalities
    B1 -->|"invokes"| A2
    B1 -->|"invokes"| A3

    %% Sample project integrates with Angular services
    D1 -->|"integratesWith"| A3

    %% Core and Angular layers communicate with external systems
    A2 -->|"communicates"| F1
    A3 -->|"communicates"| F1

    %% Authentication/Proxy details
    E1 -->|"includes"| E2
    E1 -->|"includes"| E3
    E1 -->|"includes"| E4
    E1 -->|"includes"| E5
    E1 -->|"configures"| F1

    %% Click Events
    click A1 "https://github.com/infor-cloud/m3-h5-sdk/tree/master/cli/"
    click B1 "https://github.com/infor-cloud/m3-h5-sdk/tree/master/cli/src/commands"
    click C1 "https://github.com/infor-cloud/m3-h5-sdk/tree/master/cli/boilerplate/angular-soho"
    click C2 "https://github.com/infor-cloud/m3-h5-sdk/tree/master/cli/boilerplate/angular"
    click C3 "https://github.com/infor-cloud/m3-h5-sdk/tree/master/cli/boilerplate/basic"
    click A2 "https://github.com/infor-cloud/m3-h5-sdk/tree/master/m3-odin/projects/infor-up/m3-odin"
    click A3 "https://github.com/infor-cloud/m3-h5-sdk/tree/master/m3-odin/projects/infor-up/m3-odin-angular"
    click D1 "https://github.com/infor-cloud/m3-h5-sdk/tree/master/m3-odin/boilerplate/infor-m3-odin-sample-soho"
    click E2 "https://github.com/infor-cloud/m3-h5-sdk/blob/master/cli/src/commands/login.ts"
    click E3 "https://github.com/infor-cloud/m3-h5-sdk/blob/master/cli/src/commands/set.ts"
    click E4 "https://github.com/infor-cloud/m3-h5-sdk/blob/master/m3-odin/proxy.conf.json"
    click E5 "https://github.com/infor-cloud/m3-h5-sdk/tree/master/login/"

    %% Styles
    classDef development fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef runtime fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef auth fill:#FFB6C1,stroke:#333,stroke-width:2px;
    classDef external fill:#F08080,stroke:#333,stroke-width:2px;
```
