# udistrital/iris architecture

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

- Interactive diagram: https://gitdiagram.com/udistrital/iris
- Repository: https://github.com/udistrital/iris

## Overview

##### Main Components
a. Client/Frontend Interface: Represented by files like index.php, login.php, profile.php, kb (knowledge base) directories, and assets (CSS, images, JavaScript). This is the user-facing interface where customers submit and view tickets.
b. Staff/Administration Interface: The “scp” directory, which contains a separate set of pages (dashboard, tickets, reports, user management, etc.) and assets (CSS, JS) to enable support staff tasks.
c. API/Background Processes: The “api” folder (with endpoints, HTTP handlers, cron.php) and CLI modules (in include/cli) manage automated processes, integrations, and scheduled tasks.
e. Plugin and Extensibility Modules: The “include/plugins” directory holds additional packaged functionality (such as LDAP, OAuth2, storage, etc.) that integrates into the system.
f. Infrastructure & Configuration: Configuration files in “.elasticbeanstalk”, “.ebextensions”, and “include/config” suggest deployment settings (possibly on AWS Elastic Beanstalk) along with database and environment configurations.
g. External Libraries: Libraries such as laminas-mail, mpdf, and various PEAR components support email handling, PDF generation, and other auxiliary functions.
h. Auxiliary Scripts and CLI Tools: Files in “include/cli” and maintenance/upgrader scripts (in include/upgrader and its streams) manage maintenance, upgrades, and batch operations.

##### Relationships and Interactions
a. Web Server → PHP Frontend: Users access the system via a web server. Requests hit entry point pages (index.php, login.php, etc.) which delegate to the core libraries in “include”.
b. Frontend ↔ API: The client’s interactions may trigger API requests (via ajax.php in “include/ajax*” or the api folder) for dynamic content and ticket management.
c. Staff Panel Interaction: Administrators or support staff access functionality through the “scp” directory. These pages utilize similar underlying business logic, but serve different functions (e.g., tickets management, configuration, reporting).
d. Background and Cron Jobs: There are API/cron endpoints (api/cron.php) and CLI modules (include/cli) that are scheduled to perform tasks such as email fetching, ticket processing, and system maintenance.
e. Plugin/Extension Communication: Plugins interact with core systems by following defined interfaces and hooks present in the “include” folder, thereby extending authentication, storage, and other features.
f. Integration with External Services: The presence of email libraries (laminas-mail) and potential integrations (e.g., with LDAP, OAuth2) imply external connections, like email servers and directory services.

##### Architectural Patterns and Design Principals
a. Modularization: The system is decomposed into modular components (frontend, backend, API, CLI tools) which promotes separation of concerns.
b. Extensibility: A well-defined plugin architecture allows for additional functionality to be plugged into the core system.
c. Layered Design: There is a layered separation between presentation (templates in “scp” and client directories), business logic (classes in “include”), and infrastructure (configuration, deployment).
d. Reusability: Common functionalities (authentication, formatting, mail handling) are abstracted in separate classes, often utilizing third-party libraries.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface Layer
    subgraph "Client/Frontend Interface"
        direction TB
        A1["index.php"]:::frontend
        A2["login.php"]:::frontend
        A3["profile.php"]:::frontend
        A4["Knowledge Base (kb)"]:::frontend
        A5["Assets"]:::frontend
    end

    subgraph "Staff/Admin Interface"
        direction TB
        B1["scp/index.php"]:::staff
        B2["scp/dashboard.php"]:::staff
        B3["scp/login.php"]:::staff
        B4["Staff Assets"]:::staff
    end

    %% API and Background Processes Layer
    subgraph "API and Background Processes"
        direction TB
        C1["API Endpoints"]:::api
        C2["CLI Modules"]:::api
        C3["Upgrader Scripts"]:::api
    end

    %% Core Business Logic Layer
    subgraph "Core Business Logic"
        direction TB
        D1["Core Libraries"]:::logic
        D2["Plugin System"]:::logic
    end

    %% External & Infrastructure Layer
    subgraph "External & Infrastructure"
        direction TB
        E1["External Libraries"]:::external
        E2["Infrastructure & Configuration"]:::external
    end

    %% Interconnections
    A1 -->|"AJAX/API"| C1
    A1 -->|"HTTPRequests"| D1
    B1 -->|"AdminOps"| D1
    C1 -->|"Endpoints"| D1
    C2 -->|"Background"| D1
    C3 -->|"Maintenance"| D1
    D1 <-->|"Extends"| D2
    D1 -->|"Utilizes"| E1
    D1 -->|"ConfiguredBy"| E2

    %% Click Events
    click A1 "https://github.com/udistrital/iris/blob/master/index.php"
    click A2 "https://github.com/udistrital/iris/blob/master/login.php"
    click A3 "https://github.com/udistrital/iris/blob/master/profile.php"
    click A4 "https://github.com/udistrital/iris/blob/master/kb/index.php"
    click A5 "https://github.com/udistrital/iris/tree/master/assets/default/"
    
    click B1 "https://github.com/udistrital/iris/blob/master/scp/index.php"
    click B2 "https://github.com/udistrital/iris/blob/master/scp/dashboard.php"
    click B3 "https://github.com/udistrital/iris/blob/master/scp/login.php"
    click B4 "https://github.com/udistrital/iris/tree/master/scp/css"
    
    click C1 "https://github.com/udistrital/iris/blob/master/api/cron.php"
    click C2 "https://github.com/udistrital/iris/blob/master/include/cli/cli.inc.php"
    click C3 "https://github.com/udistrital/iris/tree/master/include/upgrader/"
    
    click D1 "https://github.com/udistrital/iris/blob/master/include/class.ticket.php"
    click D2 "https://github.com/udistrital/iris/tree/master/include/plugins/"
    
    click E1 "https://github.com/udistrital/iris/tree/master/include/laminas-mail/"
    click E2 "https://github.com/udistrital/iris/blob/master/include/config/filetype.yaml"

    %% Class Definitions for Styling
    classDef frontend fill:#AED6F1,stroke:#1B4F72,color:#1B4F72,stroke-width:2px;
    classDef staff fill:#F9E79F,stroke:#B7950B,color:#B7950B,stroke-width:2px;
    classDef api fill:#D5F5E3,stroke:#27AE60,color:#196F3D,stroke-width:2px;
    classDef logic fill:#FADBD8,stroke:#C0392B,color:#922B21,stroke-width:2px;
    classDef external fill:#D6EAF8,stroke:#2E86C1,color:#2E86C1,stroke-width:2px;
```
