# osumionline/framework architecture

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

- Interactive diagram: https://gitdiagram.com/osumionline/framework
- Repository: https://github.com/osumionline/framework

## Overview

##### Project Purpose and Overall Structure
- The README emphasizes that this is a framework (Osumi Framework) to help developers build web applications by leveraging a Model-View-Controller structure.
- The file tree confirms this with folders for assets (locales, templates), a core engine, CLI commands, an ORM module, routing, tasks, and web-specific utilities.

##### Main Components
a. Core Engine and Configuration:
- “src/Core” directory (OComponent, OCore, OConfig, ODTO, OService, OTask, OTranslate). This is the heart of the framework managing essential operations, configuration, and overall execution flow.
- How this component interacts with other modules (for example, calling on logging, caching, and routing).

b. MVC Components and Supporting Layers:
- Although there’s no explicit “Controller” folder, the framework leverages "src/Routing" (which includes ORoute, ORouteCheck, and OUrl) to direct requests to the appropriate handlers.
- The “src/ORM” module (containing OModel, OField, OCreatedAt, ODeletedAt, OUpdatedAt, etc.) handles the model (data) representation and persistence.
- Views are handled through templates under “src/Assets/template” – include subdirectories for tasks like add, backup, extractor, plugins, update, etc. These are used to render the output or to scaffold code.

c. Developer Tools and CLI:
- The “src/CLI” directory includes CLI.php which indicates that part of the framework is designed to be used via command-line.

d. Additional Service Layers:
- Cache: “src/Cache” module with OCache and OCacheContainer which suggests a layer for caching to optimize performance.
- DTO and Logging: “src/DTO” and “src/Log” provide data transfer and logging functionality respectively.
- Web Utilities: “src/Web” (securing sessions, cookies, handling requests) represents the web layer and user session management.

##### Establish Relationships and Data Flow
- Data flow from an external web request entering through the “Routing” module that resolves the correct controller/action.
- How the Core component (OCore) orchestrates the interaction between routing, ORM for models, and the rendering templates (Views).
- CLI/Tools components as parallel execution paths for maintenance tasks, scaffolding, and background jobs.
- Incoming HTTP requests → Routing → Core.
- Core invoking ORM for data operations.
- Core rendering dynamic views via Assets/templates.
- Tasks being invoked from CLI which in turn may use tools/ORM/cache/logging.

##### Architectural Patterns
- The framework is modular, so each folder (Core, ORM, Routing, CLI, Task, etc.) should be represented as discrete components interacting with each other through well-defined interfaces.
- Use clear delineation for MVC functions: Routing/Controller layer (interpreting user actions), ORM model layer (data persistence), and template system for the view.
- Design concepts like dependency injection (if used within OService) or separation of static assets (templates and locales).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Runtime Operations"
        A["HTTP Request"]:::external
        B["Routing (MVC Controller Layer)"]:::mvc
        C["Core Engine & Configuration"]:::core
        J["DTO (Data Transfer Objects)"]:::core
        D["ORM (Model & Data Persistence)"]:::orm
        E["Views / Templating"]:::template
        F["Caching Mechanism"]:::cache
        G["Logging Facility"]:::log
        H["Web Utilities & Session Management"]:::web

        A -->|"sends"| B
        B -->|"forwards"| C
        C -->|"transfers"| J
        C -->|"calls"| D
        C -->|"renders"| E
        C -->|"invokes"| F
        C -->|"logs"| G
        C -->|"manages"| H
    end

    subgraph "Developer Operations"
        I["Developer Tools and CLI"]:::cli
        K["Task Runner & Background Operations"]:::task
        L["Utility Tools"]:::tools

        I -->|"runs"| K
        I -->|"uses"| L
    end

    click C "https://github.com/osumionline/framework/tree/main/src/Core"
    click B "https://github.com/osumionline/framework/tree/main/src/Routing"
    click D "https://github.com/osumionline/framework/tree/main/src/ORM"
    click E "https://github.com/osumionline/framework/tree/main/src/Assets/template"
    click I "https://github.com/osumionline/framework/tree/main/src/CLI"
    click K "https://github.com/osumionline/framework/tree/main/src/Task"
    click L "https://github.com/osumionline/framework/tree/main/src/Tools"
    click F "https://github.com/osumionline/framework/tree/main/src/Cache"
    click J "https://github.com/osumionline/framework/tree/main/src/DTO"
    click G "https://github.com/osumionline/framework/tree/main/src/Log"
    click H "https://github.com/osumionline/framework/tree/main/src/Web"

    classDef core fill:#FFC0CB,stroke:#333,stroke-width:2px;
    classDef mvc fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef orm fill:#98FB98,stroke:#333,stroke-width:2px;
    classDef template fill:#B0E0E6,stroke:#333,stroke-width:2px;
    classDef cli fill:#FFA07A,stroke:#333,stroke-width:2px;
    classDef task fill:#FA8072,stroke:#333,stroke-width:2px;
    classDef tools fill:#E0FFFF,stroke:#333,stroke-width:2px;
    classDef cache fill:#DDA0DD,stroke:#333,stroke-width:2px;
    classDef log fill:#FFFFE0,stroke:#333,stroke-width:2px;
    classDef web fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef external fill:#FFD700,stroke:#333,stroke-width:2px;
```
