# mirarr-app/mirarr architecture

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

- Interactive diagram: https://gitdiagram.com/mirarr-app/mirarr
- Repository: https://github.com/mirarr-app/mirarr

## Overview

##### Project type and purpose
- This is a cross‑platform Flutter application (“Mirarr”) that runs on Android, iOS, Linux and Windows.
- Its goal is to let users browse and watch movies and TV shows by integrating various external feeds and APIs (TMDB, OMDB, RSS feeds, streaming links).

##### File structure
- Top‑level platform folders:
- android/ – Android specific embedding and Gradle build files
- ios/ – iOS Runner project and Xcode workspace
- linux/, windows/ – Native embedder code, CMake files, plugin registrants
- Core application code lives under lib/:
- lib/functions/ – Pure Dart “service” layer: HTTP fetchers, URL parsing, error dialogs, theming and region providers
- lib/moviesPage/ and lib/seriesPage/ – Domain‑specific pages: UI widgets, view logic, models
- lib/widgets/ – Reusable components common across the whole app (bottom bar, search screen, settings, etc.)
- lib/main.dart – Entry point bootstrapping the Flutter app
- Configuration files: pubspec.yaml, analysis_options.yaml
- Assets: fonts, images in assets/

##### Insights from the README
- The app has no bespoke backend; it relies on public APIs (TheMovieDB, OMDB, scnsrc RSS, external streaming/link providers).
- Optional TMDB login for personalized features (watchlist, favorites, ratings).
- Open‑source, built via GitHub Actions, available as binaries on releases and AUR.

a. Main components to include
- Platform Embedders (Android, iOS, Linux, Windows) hosting the Flutter engine
- Dart Application Layer split into:
- UI Layer (pages under moviesPage, seriesPage, widgets)
- Business Logic / State (RegionProvider, ThemeProvider, providers if any)
- Data Layer / Service Layer (functions/fetchers, HTTP client)
- External Services:
- TMDB API (movie & TV data, login)
- OMDB API (ratings)
- scnsrc RSS feed (new releases)
- vidsrc / TV Chart / other link providers (external watch/download links)
- Assets (fonts, images)
b. Relationships and interactions
- The Flutter engine calls into platform embedders for native integration (e.g., share dialogs, file system).
- UI Layer issues events and listens to state from Providers.
- Service Layer performs HTTP calls to external APIs & RSS feeds.
- Business Logic coordinates data fetching, caching (if any), error handling, themes and region selection.
- UI displays models returned by service layer, triggers navigation or external link launches.
- Optional TMDB login flow exchanges credentials and stores session tokens.
c. Architectural patterns and design principles
- Layered architecture: presentation → business logic → data services
- Separation of concerns: UI widgets separate from HTTP fetch logic and from platform code
- Dependency injection via Providers (for themes, region, possibly authentication)
- Modular pages: moviesPage vs seriesPage vs shared widgets
d. Key technologies, frameworks or libraries
- Flutter & Dart
- Provider or ValueNotifier for state management
- http or dio for REST/RSS calls
- Platform channels for share_content, external link launching
- TMDB and OMDB public APIs

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Platform Hosts"
        Android["Android"]:::native
        iOS["iOS"]:::native
        Linux["Linux"]:::native
        Windows["Windows"]:::native
    end

    subgraph "Flutter Engine"
        DartEngine["Flutter Engine"]:::engine
    end

    Android --> DartEngine
    iOS --> DartEngine
    Linux --> DartEngine
    Windows --> DartEngine

    subgraph "Dart Application"
        subgraph "Entry"
            Main["lib/main.dart"]:::entry
        end

        subgraph "UI Layer"
            MP_UI["MoviesPage UI & Logic"]:::ui
            SP_UI["SeriesPage UI & Logic"]:::ui
            Shared_UI["Shared Widgets"]:::ui
        end

        subgraph "Business Logic & State"
            Region["RegionProvider"]:::logic
            Theme["ThemeProvider"]:::logic
            ErrorDlg["Error Dialog"]:::logic
            Share["Share Helpers"]:::logic
        end

        subgraph "Service Layer"
            Fetch["Fetchers & HTTP/RSS"]:::service
            URLParser["URL Parser"]:::service
            BaseURL["Base URL"]:::service
        end

        Assets["Assets (fonts/images)"]:::asset
        Config["Config Files"]:::config
    end

    DartEngine --> Main
    Main --> MP_UI
    Main --> SP_UI
    Main --> Shared_UI

    MP_UI --> Region
    SP_UI --> Region
    MP_UI --> Theme
    SP_UI --> Theme
    MP_UI --> Fetch
    SP_UI --> Fetch

    Region --> Fetch
    Theme --> Fetch
    ErrorDlg --> MP_UI
    Share --> MP_UI
    Share --> SP_UI

    Fetch --> URLParser
    Fetch --> BaseURL

    Assets -.-> MP_UI
    Assets -.-> SP_UI
    Config -.-> Main

    subgraph "External Services"
        TMDB["TMDB API"]:::external
        OMDB["OMDB API"]:::external
        RSS["scnsrc RSS"]:::external
        Vidsrc["vidsrc & TV Chart"]:::external
    end

    Fetch --> TMDB
    Fetch --> OMDB
    Fetch --> RSS
    Fetch --> Vidsrc
    Main -->|"TMDB Login Flow"| TMDB

    classDef native fill:#cccccc,stroke:#333,stroke-width:1px
    classDef engine fill:#8888ff,stroke:#333,stroke-width:1px
    classDef entry fill:#eeeeff,stroke:#333,stroke-width:1px
    classDef ui fill:#aaccff,stroke:#333,stroke-width:1px
    classDef logic fill:#aaffaa,stroke:#333,stroke-width:1px
    classDef service fill:#ffcc88,stroke:#333,stroke-width:1px
    classDef asset fill:#ffccff,stroke:#333,stroke-width:1px
    classDef config fill:#ddaa88,stroke:#333,stroke-width:1px
    classDef external fill:#d9b3ff,stroke:#333,stroke-width:1px

    click Android "https://github.com/mirarr-app/mirarr/tree/main/android/"
    click iOS "https://github.com/mirarr-app/mirarr/tree/main/ios/"
    click Linux "https://github.com/mirarr-app/mirarr/tree/main/linux/"
    click Windows "https://github.com/mirarr-app/mirarr/tree/main/windows/"
    click Main "https://github.com/mirarr-app/mirarr/blob/main/lib/main.dart"
    click Fetch "https://github.com/mirarr-app/mirarr/tree/main/lib/functions/fetchers/"
    click Region "https://github.com/mirarr-app/mirarr/blob/main/lib/functions/regionprovider_class.dart"
    click Theme "https://github.com/mirarr-app/mirarr/blob/main/lib/functions/themeprovider_class.dart"
    click ErrorDlg "https://github.com/mirarr-app/mirarr/blob/main/lib/functions/show_error_dialog.dart"
    click Share "https://github.com/mirarr-app/mirarr/blob/main/lib/functions/share_content.dart"
    click URLParser "https://github.com/mirarr-app/mirarr/blob/main/lib/functions/url_parser.dart"
    click BaseURL "https://github.com/mirarr-app/mirarr/blob/main/lib/functions/get_base_url.dart"
    click MP_UI "https://github.com/mirarr-app/mirarr/tree/main/lib/moviesPage/UI/"
    click MP_UI "https://github.com/mirarr-app/mirarr/tree/main/lib/moviesPage/functions/"
    click MP_UI "https://github.com/mirarr-app/mirarr/tree/main/lib/moviesPage/models/"
    click MP_UI "https://github.com/mirarr-app/mirarr/blob/main/lib/moviesPage/mainPage.dart"
    click MP_UI "https://github.com/mirarr-app/mirarr/blob/main/lib/moviesPage/movieDetailPage.dart"
    click MP_UI "https://github.com/mirarr-app/mirarr/blob/main/lib/moviesPage/movieDetailPageDesktop.dart"
    click SP_UI "https://github.com/mirarr-app/mirarr/tree/main/lib/seriesPage/UI/"
    click SP_UI "https://github.com/mirarr-app/mirarr/tree/main/lib/seriesPage/function/"
    click SP_UI "https://github.com/mirarr-app/mirarr/tree/main/lib/seriesPage/models/"
    click SP_UI "https://github.com/mirarr-app/mirarr/blob/main/lib/seriesPage/seriesPage.dart"
    click SP_UI "https://github.com/mirarr-app/mirarr/blob/main/lib/seriesPage/serieDetailPage.dart"
    click SP_UI "https://github.com/mirarr-app/mirarr/blob/main/lib/seriesPage/serieDetailPageDesktop.dart"
    click Shared_UI "https://github.com/mirarr-app/mirarr/tree/main/lib/widgets/"
    click Shared_UI "https://github.com/mirarr-app/mirarr/blob/main/lib/widgets/models/person.dart"
    click Assets "https://github.com/mirarr-app/mirarr/tree/main/assets/fonts/"
    click Assets "https://github.com/mirarr-app/mirarr/tree/main/assets/images/"
    click Config "https://github.com/mirarr-app/mirarr/blob/main/pubspec.yaml"
    click Config "https://github.com/mirarr-app/mirarr/blob/main/analysis_options.yaml"
```
