# mainframecomputer/fullmoon-ios architecture

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

- Interactive diagram: https://gitdiagram.com/mainframecomputer/fullmoon-ios
- Repository: https://github.com/mainframecomputer/fullmoon-ios

## Overview

##### Main Components Identification

The system should be represented with these key components:

a. User Interface Layer
- Onboarding Flow
- Chat Interface
- Settings Management
- Model Management

b. Core Logic Layer
- LLM Integration
- Model Evaluation
- Device Compatibility
- Data Management

c. Model Layer
- Local LLM Models
- MLX Framework Integration

##### Additional Details

Annotations for:
- Device compatibility requirements
- Local-first architecture
- Model download and installation flow
- Chat history persistence

##### The model management system

Keep the focus on the app's key differentiators:
- Local LLM execution
- Apple Silicon optimization
- Privacy-first approach with local storage
- Multi-device support (iPhone, iPad, Mac)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph UI["User Interface Layer"]
        direction TB
        Chat["Chat Interface"]
        Onboard["Onboarding Flow"]
        Settings["Settings Management"]
        
        subgraph ChatComponents["Chat Components"]
            direction TB
            CV["Chat View"]
            CLV["Chats List View"]
            ConV["Conversation View"]
        end
        
        subgraph OnboardingComponents["Onboarding Components"]
            direction TB
            OV["Onboarding View"]
            DNS["Device Not Supported View"]
            OIM["Model Installation View"]
            ODP["Download Progress View"]
        end
        
        subgraph SettingsComponents["Settings Components"]
            direction TB
            SV["Settings View"]
            MS["Model Settings"]
            CS["Chat Settings"]
            AS["Appearance Settings"]
        end
    end

    subgraph Logic["Core Logic Layer"]
        direction TB
        LLME["LLM Evaluator"]
        DC["Device Compatibility"]
        DM["Data Management"]
        LRH["LLM Request Handler"]
        MM["Model Management"]
    end

    subgraph Foundation["Foundation Layer"]
        direction TB
        MLX["MLX Swift Framework"]
        LMS[("Local Model Storage")]
        DHI["Device Hardware Integration"]
    end

    %% Relationships
    Chat --> ChatComponents
    Onboard --> OnboardingComponents
    Settings --> SettingsComponents
    
    ChatComponents --> LLME
    ChatComponents --> DM
    OnboardingComponents --> DC
    OnboardingComponents --> MM
    SettingsComponents --> MM
    
    LLME --> MLX
    DC --> DHI
    MM --> LMS
    LRH --> MLX
    
    %% Click Events
    click Chat "https://github.com/mainframecomputer/fullmoon-ios/tree/main//fullmoon/Views/Chat/"
    click CV "https://github.com/mainframecomputer/fullmoon-ios/blob/main//fullmoon/Views/Chat/ChatView.swift"
    click CLV "https://github.com/mainframecomputer/fullmoon-ios/blob/main//fullmoon/Views/Chat/ChatsListView.swift"
    click ConV "https://github.com/mainframecomputer/fullmoon-ios/blob/main//fullmoon/Views/Chat/ConversationView.swift"
    
    click Onboard "https://github.com/mainframecomputer/fullmoon-ios/tree/main//fullmoon/Views/Onboarding/"
    click OV "https://github.com/mainframecomputer/fullmoon-ios/blob/main//fullmoon/Views/Onboarding/OnboardingView.swift"
    click DNS "https://github.com/mainframecomputer/fullmoon-ios/blob/main//fullmoon/Views/Onboarding/DeviceNotSupportedView.swift"
    click OIM "https://github.com/mainframecomputer/fullmoon-ios/blob/main//fullmoon/Views/Onboarding/OnboardingInstallModelView.swift"
    click ODP "https://github.com/mainframecomputer/fullmoon-ios/blob/main//fullmoon/Views/Onboarding/OnboardingDownloadingModelProgressView.swift"
    
    click Settings "https://github.com/mainframecomputer/fullmoon-ios/tree/main//fullmoon/Views/Settings/"
    click SV "https://github.com/mainframecomputer/fullmoon-ios/blob/main//fullmoon/Views/Settings/SettingsView.swift"
    click MS "https://github.com/mainframecomputer/fullmoon-ios/blob/main//fullmoon/Views/Settings/ModelsSettingsView.swift"
    click CS "https://github.com/mainframecomputer/fullmoon-ios/blob/main//fullmoon/Views/Settings/ChatsSettingsView.swift"
    click AS "https://github.com/mainframecomputer/fullmoon-ios/blob/main//fullmoon/Views/Settings/AppearanceSettingsView.swift"
    
    click LLME "https://github.com/mainframecomputer/fullmoon-ios/blob/main//fullmoon/Models/LLMEvaluator.swift"
    click DC "https://github.com/mainframecomputer/fullmoon-ios/blob/main//fullmoon/Models/DeviceStat.swift"
    click DM "https://github.com/mainframecomputer/fullmoon-ios/blob/main//fullmoon/Models/Data.swift"
    click LRH "https://github.com/mainframecomputer/fullmoon-ios/blob/main//fullmoon/Models/RequestLLMIntent.swift"
    click MM "https://github.com/mainframecomputer/fullmoon-ios/blob/main//fullmoon/Models/Models.swift"

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef storage fill:#f4f4f4,stroke:#666,stroke-width:2px
    classDef framework fill:#e1f5fe,stroke:#0288d1,stroke-width:2px
    
    class LMS storage
    class MLX framework

    %% Legend
    subgraph Legend
        direction TB
        L1["UI Component"]
        L2[("Storage")]
        L3["Framework"]
    end
    
    class L1 default
    class L2 storage
    class L3 framework
```
