# mttcrsp/fosdem architecture

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

- Interactive diagram: https://gitdiagram.com/mttcrsp/fosdem
- Repository: https://github.com/mttcrsp/fosdem

## Overview

##### Main Components Identification
The system architecture should be organized into the following major components:

a. Core Application Layer
- Application Controllers (App/Sources/Controllers/)
- View Controllers (App/Sources/ViewControllers/)
- Views (App/Sources/Views/)

b. Data Layer
- Models (App/Sources/Models/)
- Persistence (SQLite database)
- Migrations system

c. Services Layer (App/Sources/Services/)
- Network Services
- Persistence Services
- Business Logic Services

**┌─────────────────────────────────────────────────────────┐**
- UI Layer                             │
- ┬─────────────────┬───────────────────┤
- Views         │  ViewControllers │  Controllers      │
- EventView   │  - MapVC        │  - AgendaController│
- TrackView   │  - EventVC      │  - MapController   │
- MapControl  │  - TracksVC     │  - SearchController│
- ┬────────┴────────┬────────┴─────────┬─────────┘

- ▼                 ▼                   ▼
**┌─────────────────────────────────────────────────────────┐**
- Services Layer                        │
- ┬─────────────────┬───────────────────┤
- Core Services   │ Data Services   │ External Services │
- Navigation    │ - Persistence   │ - Network         │
- Preferences   │ - Schedule      │ - Videos          │
- Launch        │ - Favorites     │ - Update          │
- ┬────────┴────────┬────────┴─────────┬─────────┘

- ▼                 ▼                   ▼
**┌─────────────────────────────────────────────────────────┐**
- Data Layer                           │
- ┬─────────────────┬───────────────────┤
- Models          │ Database        │ Migrations        │
- Event         │ - SQLite        │ - CreateEvents    │
- Track         │ - Queries       │ - CreateTracks    │
- Building      │ - Tables        │ - CreatePeople    │
- ┴─────────────────┴───────────────────┘

##### Data Flow Indicators

- User interaction flow (top-down)
- Data persistence flow (bottom-up)
- Service communication (bi-directional)

##### Implementation Details

- MVVM/MVC architecture pattern used
- SQLite database integration with GRDB
- Offline-first capability
- Multiple view support (iPhone/iPad/Mac)
- Accessibility features integration points

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI
        direction TB
        Views["Views"]
        ViewControllers["ViewControllers"]
        Controllers["Controllers"]

        subgraph ViewsGroup["Views Components"]
            direction TB
            EventView["EventView"]
            TrackView["TrackView"]
            MapControl["MapControl"]
        end

        subgraph ViewControllersGroup["ViewControllers Components"]
            direction TB
            MapVC["MapVC"]
            EventVC["EventVC"]
            TracksVC["TracksVC"]
        end

        subgraph ControllersGroup["Controllers Components"]
            direction TB
            AgendaController["AgendaController"]
            MapController["MapController"]
            SearchController["SearchController"]
        end

        Views --> ViewsGroup
        ViewControllers --> ViewControllersGroup
        Controllers --> ControllersGroup
    end

    subgraph Services
        direction TB
        CoreServices["Core Services"]
        DataServices["Data Services"]
        ExternalServices["External Services"]

        subgraph CoreServicesGroup["Core Services Components"]
            direction TB
            Navigation["Navigation"]
            Preferences["Preferences"]
            Launch["Launch"]
        end

        subgraph DataServicesGroup["Data Services Components"]
            direction TB
            Persistence["Persistence"]
            Schedule["Schedule"]
            Favorites["Favorites"]
        end

        subgraph ExternalServicesGroup["External Services Components"]
            direction TB
            Network["Network"]
            Videos["Videos"]
            Update["Update"]
        end

        CoreServices --> CoreServicesGroup
        DataServices --> DataServicesGroup
        ExternalServices --> ExternalServicesGroup
    end

    subgraph Data
        direction TB
        Models["Models"]
        Database["Database"]
        Migrations["Migrations"]

        subgraph DatabaseComponents["Database Components"]
            direction TB
            SQLite["SQLite"]
            Queries["Queries"]
            Tables["Tables"]
        end

        Database --> DatabaseComponents
    end

    UI --> Services
    Services --> Data

    %% Component Mappings
    click Views "https://github.com/mttcrsp/fosdem/tree/main/App/Sources/Views/"
    click EventView "https://github.com/mttcrsp/fosdem/blob/main/App/Sources/Views/EventView.swift"
    click TrackView "https://github.com/mttcrsp/fosdem/blob/main/App/Sources/Views/TrackView.swift"
    click MapControl "https://github.com/mttcrsp/fosdem/blob/main/App/Sources/Views/MapControlView.swift"

    click ViewControllers "https://github.com/mttcrsp/fosdem/tree/main/App/Sources/ViewControllers/"
    click MapVC "https://github.com/mttcrsp/fosdem/blob/main/App/Sources/ViewControllers/MapViewController.swift"
    click EventVC "https://github.com/mttcrsp/fosdem/blob/main/App/Sources/ViewControllers/EventViewController.swift"
    click TracksVC "https://github.com/mttcrsp/fosdem/blob/main/App/Sources/ViewControllers/TracksViewController.swift"

    click Controllers "https://github.com/mttcrsp/fosdem/tree/main/App/Sources/Controllers/"
    click AgendaController "https://github.com/mttcrsp/fosdem/blob/main/App/Sources/Controllers/AgendaController.swift"
    click MapController "https://github.com/mttcrsp/fosdem/blob/main/App/Sources/Controllers/MapController.swift"
    click SearchController "https://github.com/mttcrsp/fosdem/blob/main/App/Sources/Controllers/SearchController.swift"

    click Navigation "https://github.com/mttcrsp/fosdem/blob/main/App/Sources/Services/NavigationService.swift"
    click Preferences "https://github.com/mttcrsp/fosdem/blob/main/App/Sources/Services/PreferencesService.swift"
    click Launch "https://github.com/mttcrsp/fosdem/blob/main/App/Sources/Services/LaunchService.swift"
    click Persistence "https://github.com/mttcrsp/fosdem/blob/main/App/Sources/Services/PersistenceService.swift"
    click Schedule "https://github.com/mttcrsp/fosdem/blob/main/App/Sources/Services/ScheduleService.swift"
    click Favorites "https://github.com/mttcrsp/fosdem/blob/main/App/Sources/Services/FavoritesService.swift"
    click Network "https://github.com/mttcrsp/fosdem/blob/main/App/Sources/Services/NetworkService.swift"
    click Videos "https://github.com/mttcrsp/fosdem/blob/main/App/Sources/Services/VideosService.swift"
    click Update "https://github.com/mttcrsp/fosdem/blob/main/App/Sources/Services/UpdateService.swift"

    click Models "https://github.com/mttcrsp/fosdem/tree/main/App/Sources/Models/"
    click SQLite "https://github.com/mttcrsp/fosdem/blob/main/App/Resources/db.sqlite"
    click Migrations "https://github.com/mttcrsp/fosdem/tree/main/App/Sources/Models/Migrations/"
    click Queries "https://github.com/mttcrsp/fosdem/tree/main/App/Sources/Models/Queries/"
    click Tables "https://github.com/mttcrsp/fosdem/tree/main/App/Sources/Models/Tables/"

    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px;
    classDef ui fill:#dae8fc,stroke:#6c8ebf;
    classDef services fill:#d5e8d4,stroke:#82b366;
    classDef data fill:#ffe6cc,stroke:#d79b00;

    class Views,ViewControllers,Controllers,ViewsGroup,ViewControllersGroup,ControllersGroup ui;
    class CoreServices,DataServices,ExternalServices,CoreServicesGroup,DataServicesGroup,ExternalServicesGroup services;
    class Models,Database,Migrations,DatabaseComponents data;
```
