# auxilor/eco architecture

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

- Interactive diagram: https://gitdiagram.com/auxilor/eco
- Repository: https://github.com/auxilor/eco

## Overview

##### Main Components
- API Layer (eco-api): This module exposes all the public APIs that developers will use. It contains interfaces, command APIs, configuration abstractions, data storage interfaces, GUI/placeholder APIs, and more.
- Core Modules (eco-core): This umbrella module is further subdivided:
- core-backend & core-backend-modern: Hosts business logic including commands, configurations, data processing, extension APIs, and integration management.
- core-nms: Contains version-specific code and NMS (net.minecraft.server) abstractions that handle low-level operations, entity control, packet injection, and other server-dependent functionalities. Notice the multiple directories for specific Minecraft versions (v1_17_R1, v1_18_R1, …, v1_21_4, etc.).
- core-plugin: Works as the entry point for the plugin. It integrates the eco framework into the Spigot environment by wiring up event listeners, command registration, and plugin lifecycle management.
- core-proxy: Acts as an abstraction layer to provide compatibility and adapt functionalities for different server versions.
- Lib Directory: Contains external dependencies and other plugin integrations such as DeluxeMenus, CMI, bStats, and other third-party plugins that eco can integrate with.
- Configuration, Documentation, and Gradle Build Files: Provide the glue that ties together building, continuous integration (such as GitHub workflows), and dependency management.

##### How Components Interact
- The API layer calls into the core modules to execute commands, manage configurations, handle persistence (supporting YAML, MySQL, MongoDB), and control in-game entities.
- The core-backend modules implement the business logic; they call on the NMS abstractions in core-nms to interact with the server internals (packets, entities, etc.) while remaining largely version-agnostic.
- The core-plugin module is where the eco framework is “bootstrapped” into Spigot. It registers events (e.g., player interactions, entity events, GUI interactions) and integrates with the proxy layer to manage version-specific behavior.
- A separate proxy layer (core-proxy) cleanly isolates version-specific implementations so that interface changes in the NMS do not bloat higher-level modules.
- External plugins (as noted in the libs folder) integrate with eco’s extension API to add additional features such as custom recipes, economy systems, price integrations, or integration with popular plugins like DeluxeMenus, CMI, and more.

##### Architectural Patterns and Design Principles
- Modularization: The project is extremely modular with clear separation between public APIs and internal implementations.
- Abstraction over Version-Specific Code: The proxy and NMS modules encapsulate the complexities of working with multiple Minecraft server versions.
- Dependency Injection & Extension: The framework supports fluent dependency injection for keys, metadata values, etc., and also an extension API so that plugins for plugins can be developed.
- Layered Architecture: With distinct layers (presentation via eco-api, business logic in eco-core, compatibility handling via core-nms and core-proxy, and integration through eco-plugin), the system is well-separated by concerns.
- Event-Driven / Reactive Design: Several modules (such as packet API and event listeners) adopt event-driven architectures.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Public API Layer
    A["eco-api: Public API for commands, configs, GUI etc."]:::api

    %% Core Modules Subgraph
    subgraph "Core Modules"
        B["core-backend: Business Logic & Commands"]:::core
        C["core-backend-modern: Advanced Business Logic"]:::core
        D["core-nms: Version-specific NMS Abstractions"]:::nms
        E["core-plugin: Spigot Plugin Entry Point"]:::plugin
        F["core-proxy: Compatibility Proxy Layer"]:::proxy
    end

    %% External Integrations
    subgraph "External Integrations"
        G["lib: External Dependencies & Integrations"]:::external
    end

    %% Configuration & Build Files
    subgraph "Configuration & Build"
        H["Gradle Build & Settings Files"]:::config
        I["Configuration Files"]:::config
    end

    %% Note on Design Philosophy
    J["Note: Extensibility, Dependency Injection, and Event-Driven Design"]:::note

    %% Connections between layers
    A -->|"calls"| B
    A -->|"calls"| C
    A -->|"invokes"| E
    B -->|"processes"| D
    C -->|"enhances"| D
    E -->|"registersEvents"| F
    F -->|"abstracts"| D
    B -->|"integrates"| G
    E -->|"integrates"| G
    H -->|"builds"| A
    H -->|"builds"| B
    H -->|"builds"| C
    H -->|"builds"| E
    I -->|"configures"| A

    %% Design philosophy annotation linking to key modules
    J --- A
    J --- B
    J --- E

    %% Click Events
    click A "https://github.com/auxilor/eco/tree/master/eco-api/"
    click B "https://github.com/auxilor/eco/tree/master/eco-core/core-backend/"
    click C "https://github.com/auxilor/eco/tree/master/eco-core/core-backend-modern/"
    click D "https://github.com/auxilor/eco/tree/master/eco-core/core-nms/"
    click E "https://github.com/auxilor/eco/tree/master/eco-core/core-plugin/"
    click F "https://github.com/auxilor/eco/tree/master/eco-core/core-proxy/"
    click G "https://github.com/auxilor/eco/tree/master/lib/"
    click H "https://github.com/auxilor/eco/blob/master/build.gradle.kts"
    click I "https://github.com/auxilor/eco/tree/master/config/"

    %% Styles for color coding
    classDef api fill:#99d1f3,stroke:#2b70a8,stroke-width:2px;
    classDef core fill:#b3e5b3,stroke:#4CAF50,stroke-width:2px;
    classDef nms fill:#ffccd5,stroke:#ff5e78,stroke-width:2px;
    classDef plugin fill:#ffe8b3,stroke:#ffbf00,stroke-width:2px;
    classDef proxy fill:#ffd6a5,stroke:#ff9f1c,stroke-width:2px;
    classDef external fill:#d3d3d3,stroke:#a9a9a9,stroke-width:2px;
    classDef config fill:#e0e0e0,stroke:#808080,stroke-width:2px;
    classDef note fill:#fceabb,stroke:#f8b500,stroke-width:2px,stroke-dasharray:5,5;
```
