# mihaip/infinite-mac architecture

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

- Interactive diagram: https://gitdiagram.com/mihaip/infinite-mac
- Repository: https://github.com/mihaip/infinite-mac

## Overview

a. User Interface → Emulator Core
- Input handling
- Rendering
- Audio processing
- File system interactions

b. Emulator Core → Storage
- Disk image loading
- CD-ROM mounting
- Save state management

c. Network Layer ↔ External Services
- Archive.org integration
- Macintosh Garden integration
- Cloudflare R2 storage

##### Supporting Systems (use smaller connected components)

- Build system (Docker + Emscripten)
- Import/Export tools
- Development utilities
- Deployment pipeline

##### Technical Details

- WebAssembly modules
- Service Worker integration
- React component hierarchy
- Storage mechanisms
- Network protocols

##### Implementation Notes

- Rectangles: Core components
- Hexagons: Processing units
- Clouds: External services
- Blue: Frontend components
- Green: Emulator cores
- Yellow: Storage systems
- Purple: Network components
- Version numbers for major components
- Notes about scalability and performance considerations

- The multiple emulator cores and their interaction with the web interface
- The worker-based architecture for handling emulation
- The complex storage system for managing disk images and software libraries
- The network emulation layer for classic Mac networking

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        UI[React UI]:::frontend
        Controls[Control Components]:::frontend
        Screen[Screen Components]:::frontend
        Settings[Settings Interface]:::frontend
        Library[Library Browser]:::frontend
        CDInterface[CD-ROM Interface]:::frontend
    end

    subgraph EmulatorCore
        B2[Basilisk II]:::emulator
        SS[SheepShaver]:::emulator
        MV[Mini vMac]:::emulator
        DP[DingusPPC]:::emulator
        NX[Previous NeXT]:::emulator
        Worker[Emulator Worker]:::emulator
    end

    subgraph Storage
        DiskMgmt[Disk Management]:::storage
        CDLib[CD-ROM Library]:::storage
        SoftLib[Software Library]:::storage
        R2[R2 Bucket Storage]:::storage
    end

    subgraph Network
        EthEmu[Ethernet Emulation]:::network
        CFWorkers[Cloudflare Workers]:::network
        BChannel[Broadcast Channel]:::network
    end

    subgraph Supporting
        Build[Build System]:::support
        Import[Import/Export Tools]:::support
        DevUtils[Development Utilities]:::support
        Deploy[Deployment Pipeline]:::support
    end

    UI --> Worker
    Controls --> Worker
    Worker --> Screen
    Settings --> Worker
    Library --> DiskMgmt
    CDInterface --> CDLib

    Worker --> B2
    Worker --> SS
    Worker --> MV
    Worker --> DP
    Worker --> NX

    B2 --> DiskMgmt
    SS --> DiskMgmt
    MV --> DiskMgmt
    DP --> DiskMgmt
    NX --> DiskMgmt

    DiskMgmt --> R2
    CDLib --> R2
    SoftLib --> R2

    Worker --> EthEmu
    EthEmu --> CFWorkers
    EthEmu --> BChannel

    classDef frontend fill:#3498db
    classDef emulator fill:#2ecc71
    classDef storage fill:#f1c40f
    classDef network fill:#9b59b6
    classDef support fill:#95a5a6

    click UI "https://github.com/mihaip/infinite-mac/blob/main/src/App.tsx"
    click Controls "https://github.com/mihaip/infinite-mac/tree/main/src/controls/"
    click Screen "https://github.com/mihaip/infinite-mac/blob/main/src/ScreenFrame.tsx"
    click Settings "https://github.com/mihaip/infinite-mac/blob/main/src/MacSettings.tsx"
    click Library "https://github.com/mihaip/infinite-mac/blob/main/src/MacLibrary.tsx"
    click CDInterface "https://github.com/mihaip/infinite-mac/blob/main/src/MacCDROMs.tsx"
    click Worker "https://github.com/mihaip/infinite-mac/blob/main/src/emulator/emulator-worker.ts"
    click B2 "https://github.com/mihaip/infinite-mac/blob/main/src/emulator/BasiliskII.wasm"
    click SS "https://github.com/mihaip/infinite-mac/blob/main/src/emulator/SheepShaver.wasm"
    click MV "https://github.com/mihaip/infinite-mac/blob/main/src/emulator/minivmac-*.wasm"
    click DiskMgmt "https://github.com/mihaip/infinite-mac/blob/main/src/emulator/emulator-worker-disks.ts"
    click CDLib "https://github.com/mihaip/infinite-mac/tree/main/CD-ROMs/"
    click SoftLib "https://github.com/mihaip/infinite-mac/tree/main/Library/"
    click CFWorkers "https://github.com/mihaip/infinite-mac/tree/main/workers-site/"
    click EthEmu "https://github.com/mihaip/infinite-mac/blob/main/src/CloudflareWorkerEthernetProvider.ts"
    click BChannel "https://github.com/mihaip/infinite-mac/blob/main/src/BroadcastChannelEthernetProvider.tsx"
    click Build "https://github.com/mihaip/infinite-mac/tree/main/Dockerfile"
    click Import "https://github.com/mihaip/infinite-mac/blob/main/scripts/import-*.py"
    click DevUtils "https://github.com/mihaip/infinite-mac/tree/main/scripts/"
```
