# sassembla/autoya architecture

> Architecture diagram of the GitHub repository sassembla/autoya, 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/sassembla/autoya
- Repository: https://github.com/sassembla/autoya

## Overview

##### Core Modules and Their Roles
- AssetBundle Module: Represented in both the “Assets/Autoya/AssetBundle” folder and the “AssetBundles” directory at the root. This module handles the download, preloading, and management of asset bundles. Include subcomponents like AssetBundleList, AssetBundleLoader, and AssetBundlePreloader.
- Authentication Module: Found under “Backyard” and “ThirdPartyAuthentication.” This module is responsible for handling basic authentication flows (including third-party methods like SignInWithApple).
- Connection Module: Under “Assets/Autoya/Connections” and potentially integrated in “Backyard,” this module supports HTTP, TCP, and UDP communications with external servers or endpoints.
- Notification Module: Located in “Assets/Autoya/Notification,” this component manages both local and remote notifications and includes platform-specific plugins.
- Purchase/IAP Module: Under “Assets/Autoya/Purchase,” this module integrates with Unity Services (and possibly native services) to provide in-app purchasing.
- Information and Persistence Modules: Under “Assets/Autoya/Information” and “Assets/Autoya/Persistence.” They deal with displaying game information and managing local persistence or caching of data (e.g., URL caching, file persistence).
- Settings and Manifest: Configuration resources in “Assets/Autoya/Settings” and “Assets/Autoya/Manifest,” which supply essential runtime and build-time configuration.
- Editor Tools: Found under “Assets/Autoya/Editor” and the “Editor” directory that contains AssetGraph and AutoyaEditorTool components. These tools help with asset bundle building and link.xml generation.
- Test Framework: The “Assets/AutoyaTests” (and usage of MiyamasuTestRunner) represent the testing support, helping validate each module via unit and integration tests.

##### Relationships and Data Flow
- How the Unity runtime uses Autoya’s core modules for tasks like downloading asset bundles, authenticating users, and processing network requests.
- Authentication module with the Connection and Purchase modules where secure communications and user validation are required.
- Links from the Editor Tools to the AssetBundle Module, showing how build-time processes (asset bundle creation, manifest generation) feed into runtime use.
- That the Test framework interacts with all these modules to ensure correct behavior and integration.

##### Important Architectural Patterns and Design Principles
- Modularity & Separation of Concerns – Each feature (authentication, connection, asset management, etc.) is encapsulated in its own submodule.
- Editor vs. Runtime Separation – Differentiate between editor tools and runtime components, with a clear boundary for build processes versus game execution.
- Versioning & Updatability – The asset bundles and sub-assets are versioned (e.g., “1.0.0”, “1.0.1”), which suggests that the system supports incremental updates and asset updates.

##### Technologies & Integration Points
- Unity Engine: The underlying platform.
- Miyamasu Test Runner: For testing.
- Third-Party Authentication Plugins (e.g., SignInWithApple).
- Potential integration with Unity Services for in-app purchases.
- Networking libraries built into the Autoya framework (HTTP, TCP, UDP).

##### Putting It All Together
- An Editor Tools section that feeds into the runtime (illustrating pre-processing/build activities).
- An external interactions section (external authentication, purchase servers, asset servers) that communicate with the connection and purchase modules.
- Finally, include a testing “sandbox” that interacts with almost all modules to verify functionality.

## Diagram (Mermaid)

```mermaid
flowchart TD
    U["Unity Game Engine"]:::runtime

    %% Runtime Modules
    subgraph "Runtime Modules"
        ABM["AssetBundle Module"]:::runtime
        BA["Basic Authentication"]:::runtime
        TPA["Third-Party Authentication"]:::runtime
        CON["Connection Module"]:::runtime
        NOT["Notification Module"]:::runtime
        PUR["Purchase/IAP Module"]:::runtime
        INF["Information Module"]:::runtime
        PER["Persistence Module"]:::runtime
        ST["Settings"]:::runtime
        MAN["Manifest"]:::runtime
    end

    %% External Services
    subgraph "External Services"
        AS["Asset Server"]:::external
        EAS["External Authentication Service"]:::external
        EPS["External Purchase Service"]:::external
    end

    %% Editor Tools
    subgraph "Editor Tools"
        E1["Primary Editor Tools"]:::editor
        E2["Extended Editor Tools"]:::editor
    end

    %% Test Framework
    subgraph "Test Framework"
        T1["Autoya Tests"]:::test
        T2["Miyamasu Test Runner"]:::test
    end

    %% Connections from Unity Game Engine to Runtime Modules
    U -->|"uses"| ABM
    U -->|"uses"| BA
    U -->|"uses"| CON
    U -->|"uses"| NOT
    U -->|"uses"| PUR
    U -->|"uses"| INF
    U -->|"uses"| PER
    U -->|"uses"| ST
    U -->|"uses"| MAN

    %% AssetBundle Module downloads assets from Asset Server
    ABM -->|"downloadsFrom"| AS

    %% Authentication flows between Basic and Third-Party authentication
    BA ---|"sync"| TPA
    BA -->|"validate"| EAS
    TPA -->|"validate"| EAS

    %% Authentication communicates with Connection & Purchase modules
    BA -->|"authTo"| CON
    TPA -->|"authTo"| CON
    BA -->|"authTo"| PUR
    TPA -->|"authTo"| PUR

    %% Connection Module network interactions with external services
    CON -->|"networkTo"| EAS
    CON -->|"networkTo"| EPS

    %% Purchase Module communicates with External Purchase Service
    PUR -->|"purchaseReq"| EPS

    %% Settings provide configuration to multiple modules
    ST -->|"config"| ABM
    ST -->|"config"| BA
    ST -->|"config"| PUR

    %% Editor Tools feeding into AssetBundle Module
    E1 -->|"builds"| ABM
    E2 -->|"builds"| ABM

    %% Test Framework interacts with all core modules
    T1 --- ABM
    T1 --- BA
    T1 --- CON
    T1 --- NOT
    T1 --- PUR
    T1 --- INF
    T1 --- PER
    T1 --- ST
    T1 --- MAN

    T2 --- ABM
    T2 --- BA
    T2 --- CON
    T2 --- NOT
    T2 --- PUR
    T2 --- INF
    T2 --- PER
    T2 --- ST
    T2 --- MAN

    %% Click Events
    click ABM "https://github.com/sassembla/autoya/tree/master/Assets/Autoya/AssetBundle"
    click AS "https://github.com/sassembla/autoya/tree/master/AssetBundles"
    click BA "https://github.com/sassembla/autoya/tree/master/Assets/Autoya/Backyard"
    click TPA "https://github.com/sassembla/autoya/tree/master/Assets/Autoya/ThirdPartyAuthentication/SignInWithApple"
    click CON "https://github.com/sassembla/autoya/tree/master/Assets/Autoya/Connections"
    click NOT "https://github.com/sassembla/autoya/tree/master/Assets/Autoya/Notification"
    click PUR "https://github.com/sassembla/autoya/tree/master/Assets/Autoya/Purchase"
    click INF "https://github.com/sassembla/autoya/tree/master/Assets/Autoya/Information"
    click PER "https://github.com/sassembla/autoya/tree/master/Assets/Autoya/Persistence"
    click ST "https://github.com/sassembla/autoya/tree/master/Assets/Autoya/Settings"
    click MAN "https://github.com/sassembla/autoya/tree/master/Assets/Autoya/Manifest"
    click E1 "https://github.com/sassembla/autoya/tree/master/Assets/Autoya/Editor"
    click E2 "https://github.com/sassembla/autoya/tree/master/Assets/Editor"
    click T1 "https://github.com/sassembla/autoya/tree/master/Assets/AutoyaTests"
    click T2 "https://github.com/sassembla/autoya/tree/master/Assets/MiyamasuTestRunner"

    %% Styles
    classDef runtime fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef external fill:#A9DFBF,stroke:#27AE60,stroke-width:2px;
    classDef editor fill:#F9E79F,stroke:#F1C40F,stroke-width:2px;
    classDef test fill:#D2B4DE,stroke:#8E44AD,stroke-width:2px;
```
