# missingems/mooligan architecture

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

## Overview

##### Main Components
- Main Application: Represented by the “Mooligan” folder, which contains the primary app entry point, UI runners (e.g., MooliganApp.swift), resources (Assets, LaunchScreen storyboard), and tests.
- Core Modules:
– Featurist: Under “Core/Featurist,” this likely provides generic feature-handling mechanisms or utilities for integrating modular features (with its own app entry, resources, sources, and tests).
– Networking: Under “Core/Networking,” which handles API clients for card data, set information, and querying Magic: The Gathering data. It includes subdirectories for card details, common utilities, query implementations, and mocks for testing.
- Features:
– Browse, CardDetail, and Query: Each feature is organized under its own directory in “Features” and includes sources (feature-specific UI and business logic), resources (assets, storyboards), runners, and tests. These modules implement specific functionalities such as browsing cards/decks, showing detailed card information, and handling search queries.
- Project Management & Build System:
– Tuist Configuration: There are Tuist directories in several modules (e.g., Core/DesignComponents/Tuist, Features/**/Tuist) and at the top level (“Tuist”). This indicates that Tuist is used to orchestrate project generation and dependency management.

##### Relationships and Interactions
- The Main Application (Mooligan) aggregates and integrates the different feature modules (Browse, CardDetail, Query) and leverages the shared Core modules.
- Feature modules use the shared DesignComponents for common UI patterns and rely on Networking to fetch and process card and deck data.
- Within Networking, submodules for CardDetail, Query, and Sets indicate specialized API clients that supply data to respective feature modules.
- DesignComponents serve as the “UI kit” ensuring a consistent look and feel, while Featurist might help in dynamically including multiple features.
- Tuist configurations exist at multiple levels to set up projects, define dependencies, and streamline module integration.

##### Architectural Patterns & Design Principles
- Modularity: The project is split into several loosely coupled modules (Core, Features, Mooligan) to enhance reusability and separation of concerns.
- Layering: There is a clear separation among User Interface (via DesignComponents & feature-specific UI code), Business Logic (within Features or shared Featurist), and Data Access (Networking) layers.
- Testing: Each module includes its own tests, which indicates an emphasis on unit testing and modular testability.
- Project Generation: Use of Tuist indicates an automated, standardized build and dependency setup.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Main Application
    Mooligan["Main App (Mooligan)"]:::main

    %% Features Modules
    subgraph "Features Modules"
        Browse["Browse Feature"]:::features
        CardDetail["Card Detail Feature"]:::features
        Query["Query Feature"]:::features
    end

    %% Core Modules
    subgraph "Core Modules"
        DesignComponents["Core DesignComponents"]:::design
        Featurist["Core Featurist"]:::featurist
        Networking["Core Networking"]:::networking
    end

    %% Build Management
    Tuist["Tuist Configuration"]:::tuist

    %% Relationships from Main App to Features
    Mooligan -->|"routes"| Browse
    Mooligan -->|"routes"| CardDetail
    Mooligan -->|"routes"| Query

    %% Main App depends on Featurist for feature integration
    Mooligan -->|"featureIntegration"| Featurist

    %% Features depend on Core DesignComponents (UI usage)
    Browse -->|"UI"| DesignComponents
    CardDetail -->|"UI"| DesignComponents
    Query -->|"UI"| DesignComponents

    %% Features depend on Core Networking (Data/API calls)
    Browse -->|"API"| Networking
    CardDetail -->|"API"| Networking
    Query -->|"API"| Networking

    %% Tuist configuration applies to all modules
    Tuist -->|"buildConfig"| Mooligan
    Tuist -->|"buildConfig"| DesignComponents
    Tuist -->|"buildConfig"| Featurist
    Tuist -->|"buildConfig"| Networking
    Tuist -->|"buildConfig"| Browse
    Tuist -->|"buildConfig"| CardDetail
    Tuist -->|"buildConfig"| Query

    %% Click Events
    click Mooligan "https://github.com/missingems/mooligan/blob/main/Mooligan/Sources/MooliganApp.swift"
    click DesignComponents "https://github.com/missingems/mooligan/tree/main/Core/DesignComponents"
    click Featurist "https://github.com/missingems/mooligan/tree/main/Core/Featurist"
    click Networking "https://github.com/missingems/mooligan/tree/main/Core/Networking"
    click Browse "https://github.com/missingems/mooligan/tree/main/Features/Browse"
    click CardDetail "https://github.com/missingems/mooligan/tree/main/Features/CardDetail"
    click Query "https://github.com/missingems/mooligan/tree/main/Features/Query"
    click Tuist "https://github.com/missingems/mooligan/tree/main/Tuist"

    %% Styles
    classDef main fill:#f9e79f,stroke:#b7950b,stroke-width:2px;
    classDef design fill:#aed6f1,stroke:#3498db,stroke-width:2px;
    classDef featurist fill:#fad7a0,stroke:#e67e22,stroke-width:2px;
    classDef networking fill:#a9dfbf,stroke:#27ae60,stroke-width:2px;
    classDef features fill:#f5b7b1,stroke:#c0392b,stroke-width:2px;
    classDef tuist fill:#d7bde2,stroke:#8e44ad,stroke-width:2px;
```
