# rutherfordum/test_task_atlantis architecture

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

- Interactive diagram: https://gitdiagram.com/rutherfordum/test_task_atlantis
- Repository: https://github.com/rutherfordum/test_task_atlantis

## Overview

This project is a Unity-based AR application with a modular service architecture. Its main purpose is to load and display content – including 3D models (GLB/glTF), images for AR tracking, and more – and to manage internet connectivity, content download, and augmented reality support. In addition, it leverages several external libraries such as Extenject (for dependency injection), UniTask/UniRx (for asynchronous tasks and reactive programming), glTFast (for fast GLTF loading), and ARFoundation (for AR functionality).

##### Main Components
- Services Layer:
- WebRequestService: Handles downloading byte arrays and textures from the internet.
- InternetAccessService: Monitors and checks for internet connectivity based on a configurable interval and URL.
- ContentDownloadService: Combines the functionality of WebRequestService and InternetAccessService to manage content downloads.
- GltfImportService: Loads GLB/GLTF models and brings them onto the scene.
- ARTrackedImageService: Responsible for detecting images and overlaying data within AR mode.
- ARSupportService: Checks device AR support to conditionally enable AR features.
- Additional UI/Interaction Services: For example, MainCanvasViewService that ties UI elements into the experience.
- Configuration and Resources:
- Configuration files located in Assets/_Project/Resources/Configurations.
- Prefabs and Scene Assets in Assets/_Project/Resources and Assets/_Project/Scenes.
- Dependency Injection and Utilities:
- Extenject is used to wire all components together.
- UniTask and UniRx are employed for handling asynchronous operations and reactive event streams.
- External Libraries:
- glTFast (GLTF loading), ARFoundation (for managing AR interactions), and others for text rendering (TextMesh Pro) and XR support.

##### Defining Relationships and Interactions
- Data Flow:
- The ContentDownloadService sits as an orchestrator: it calls into WebRequestService for downloading files and uses InternetAccessService to validate connectivity.
- Once download tasks complete (potentially via asynchronous UniTask calls), GltfImportService takes over to load models into the scene.
- In parallel or subsequent operations, ARTrackedImageService continuously monitors for images, and ARSupportService governs whether AR mode is enabled based on device capabilities.
- Integration Points:
- Each service reads from its respective configuration (from the Assets/_Project/Resources/Configurations).
- Event and Observer Patterns:

##### Architectural Patterns & Design Principles
- Modular Service Design:
Each service is decoupled and likely encapsulated into separate assemblies (visible by the *.asmdef files) for testability and maintenance.
- Dependency Injection:
The use of Extenject enables object creation and wiring to be managed externally, so denote a central DI container node that connects to most services.
- Asynchronous / Reactive Programming:
Services interact asynchronously (UniTask) and use reactive streams (UniRx) to propagate events (e.g., download progress or AR tracking updates).

- Clear labels for every component.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Config["\"Configurations & Resources\""]:::config
    DI["\"Extenject DI Container\""]:::di

    subgraph "Services Layer"
        WS["\"WebRequestService\n- Downloads internet content\""]:::service
        IAS["\"InternetAccessService\n- Checks connectivity\""]:::service
        CDS["\"ContentDownloadService\n- Orchestrates downloads\""]:::service
        GIS["\"GltfImportService\n- Loads 3D models\""]:::service
        ATS["\"ARTrackedImageService\n- Detects AR images\""]:::service
        ASS["\"ARSupportService\n- Enables AR features\""]:::service
        MCVS["\"MainCanvasViewService\n- Manages UI elements\""]:::service
    end

    UniRx["\"UniRx\""]:::external
    ARF["\"ARFoundation\""]:::external
    GLTF["\"glTFast\""]:::external

    %% DI container wires to all services
    DI --> WS
    DI --> IAS
    DI --> CDS
    DI --> GIS
    DI --> ATS
    DI --> ASS
    DI --> MCVS

    %% Data flows between services
    CDS -->|"calls"| WS
    CDS -->|"calls"| IAS
    CDS -->|"triggers"| GIS

    %% Each service depends on configuration
    Config -->|"configures"| WS
    Config -->|"configures"| IAS
    Config -->|"configures"| CDS
    Config -->|"configures"| GIS
    Config -->|"configures"| ATS
    Config -->|"configures"| ASS
    Config -->|"configures"| MCVS

    %% External libraries integrations
    UniRx -->|"async/reactive"| CDS
    UniRx -->|"async/reactive"| ATS
    UniRx -->|"async/reactive"| ASS
    ARF -->|"ARsupport"| ATS
    ARF -->|"ARsupport"| ASS
    GLTF -->|"GLTFloading"| GIS

    %% UI update from AR services
    ATS -->|"updatesUI"| MCVS
    ASS -->|"updatesUI"| MCVS

    %% Click Events for Services
    click WS "https://github.com/rutherfordum/test_task_atlantis/blob/main/Assets/_Project/Scripts/Services/WebRequestService/UnityWebRequestService.cs"
    click IAS "https://github.com/rutherfordum/test_task_atlantis/blob/main/Assets/_Project/Scripts/Services/InternetAccessService/InternetAccessService.cs"
    click CDS "https://github.com/rutherfordum/test_task_atlantis/blob/main/Assets/_Project/Scripts/Services/ContentDownloadService/ARContentDownloadService.cs"
    click GIS "https://github.com/rutherfordum/test_task_atlantis/blob/main/Assets/_Project/Scripts/Services/GltfImportService/GltfFastImporterService.cs"
    click ATS "https://github.com/rutherfordum/test_task_atlantis/blob/main/Assets/_Project/Scripts/Services/ARTrackedImageService/ARTrackedImageService.cs"
    click ASS "https://github.com/rutherfordum/test_task_atlantis/blob/main/Assets/_Project/Scripts/Services/ARSupportService/ArSupportService.cs"
    click MCVS "https://github.com/rutherfordum/test_task_atlantis/blob/main/Assets/_Project/Scripts/Services/MainCanvasViewService/MainCanvasViewService.cs"

    %% Click Events for Configurations & Resources
    click Config "https://github.com/rutherfordum/test_task_atlantis/tree/main/Assets/_Project/Resources/Configurations"
    click Config "https://github.com/rutherfordum/test_task_atlantis/blob/main/Assets/_Project/Resources/Configurations/new ARContentDownloadConfiguration.asset"
    click Config "https://github.com/rutherfordum/test_task_atlantis/blob/main/Assets/_Project/Resources/Configurations/new InternetAccessConfiguration.asset"

    %% Click Events for Dependency Injection
    click DI "https://github.com/rutherfordum/test_task_atlantis/blob/main/Assets/_Project/Scripts/BootstrapInstaller.cs"
    click DI "https://github.com/rutherfordum/test_task_atlantis/blob/main/Assets/_Project/Scripts/ProjectBootstrapInstaller.cs"

    %% Click Events for External Libraries
    click UniRx "https://github.com/rutherfordum/test_task_atlantis/tree/main/Assets/Plugins/UniRx"
    click ARF "https://github.com/rutherfordum/test_task_atlantis/blob/main/Assets/XR/Loaders/ARCoreLoader.asset"

    %% Styles
    classDef service fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef config fill:#A9DFBF,stroke:#145A32,stroke-width:2px,stroke-dasharray: 5, 5;
    classDef di fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef external fill:#F5B7B1,stroke:#922B21,stroke-width:2px;
```
