# mervatmagdy/movies architecture

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

- Interactive diagram: https://gitdiagram.com/mervatmagdy/movies
- Repository: https://github.com/mervatmagdy/movies

## Overview

##### Project type and purpose
- This is a Flutter-based mobile application (“movies”) targeting Android and iOS.
- Purpose: Allow users to browse, search, and save movies. It fetches data from an external movie API and uses Firebase (via `firebase_utils.dart`) to persist user watch-list data.

##### File structure
- Top-level:
- android/ios – platform-specific integration code and build config.
- lib/ – all Dart code broken into feature folders (Api, Home, Browser, Search, WatchList, movie_details, Model, plus main.dart).
- pubspec.yaml – package/dependency config.
- Patterns:
- MVVM-style separation: UI (screens, widgets) in each feature folder, ViewModels (naming `..._view_model.dart`), Models (API response classes).
- API layer under lib/Api and lib/api – constants and manager for network calls.
- State management via Provider (see `added_movie_provider.dart`).
- Config files: flutter_native_splash.yaml, analysis_options.yaml, platform build scripts.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Entry Point
    main["main.dart\n(Entry Point)"]:::frontend

    %% Presentation Layer
    subgraph "Presentation Layer"
        subgraph Home
            HS["Home Screen"]:::frontend
            HT["Home Tab"]:::frontend
            MI["Movie Item"]:::frontend
            NR["New Release Widget"]:::frontend
            PI["Popular Item Widget"]:::frontend
            RI["Recommend Item Widget"]:::frontend
        end
        subgraph Browser
            GS["Genre Screen"]:::frontend
            BT["Browser Tab"]:::frontend
            GI["Genre Item"]:::frontend
            BMS["Movie Screen"]:::frontend
            BMI["Movie Item"]:::frontend
            BMD["Movie Details"]:::frontend
        end
        subgraph Search
            ST["Search Tab"]:::frontend
            SD["Search Delegate"]:::frontend
            SI["Search Item"]:::frontend
        end
        subgraph WatchList
            WT["Watch List Tab"]:::frontend
        end
        subgraph MovieDetails
            DS["Details Screen"]:::frontend
            DT["Details Tab"]:::frontend
            SM["Similar Movies Widget"]:::frontend
        end
    end

    %% ViewModel Layer
    subgraph "ViewModel Layer"
        HNR["New Releases VM"]:::viewmodel
        HPS["Popular Slider VM"]:::viewmodel
        HRM["Recommended VM"]:::viewmodel
        BBTVM["Browser Tab VM"]:::viewmodel
        BMDVM["Browser Movie Details VM"]:::viewmodel
        SDVM["Search Delegate VM"]:::viewmodel
        MDVM["Movie Details VM"]:::viewmodel
        SMVM["Similar Movies VM"]:::viewmodel
    end

    %% Data/Service Layer
    subgraph "Data/Service Layer"
        APIConst1["API Constants"]:::service
        APIConst2["API Constants"]:::service
        APIMan1["API Manager"]:::service
        APIMan2["API Manager"]:::service
        FBU["Firebase Utils"]:::service
        Provider["Added Movie Provider"]:::service
        Theme["App Theme"]:::service
    end

    %% External Services
    subgraph "External Services"
        ExternalAPI["External Movie API"]:::external
        Firebase["Firebase"]:::external
    end

    %% Platform Integration
    subgraph "Platform Integration"
        Android["Android (android/)"]:::platform
        iOS["iOS (ios/)"]:::platform
    end

    %% Relations: App Startup
    main -->|"sets up Providers & Navigation"| HS
    main --> GS
    main --> ST
    main --> WT
    main --> DS
    main --> Android
    main --> iOS

    %% UI to ViewModel
    HS -->|binds to| HNR
    HT -->|binds to| HNR
    MI -->|binds to| HNR
    NR -->|binds to| HNR
    PI -->|binds to| HPS
    RI -->|binds to| HRM

    GS -->|binds to| BBTVM
    BT -->|binds to| BBTVM
    GI -->|binds to| BBTVM

    BMS -->|binds to| BMDVM
    BMI -->|binds to| BMDVM
    BMD -->|binds to| BMDVM

    ST -->|binds to| SDVM
    SD -->|binds to| SDVM
    SI -->|binds to| SDVM

    DS -->|binds to| MDVM
    DT -->|binds to| MDVM
    SM -->|binds to| SMVM

    WT -->|binds to| Provider

    %% ViewModel to Data/Service
    HNR --> APIConst1
    HNR --> APIMan1
    HNR --> APIConst2
    HNR --> APIMan2

    HPS --> APIConst1
    HPS --> APIMan1
    HRM --> APIConst2
    HRM --> APIMan2

    BBTVM --> APIConst1
    BBTVM --> APIMan1

    BMDVM --> APIConst2
    BMDVM --> APIMan2

    SDVM --> APIConst1
    SDVM --> APIMan1

    MDVM --> APIConst2
    MDVM --> APIMan2

    SMVM --> APIConst1
    SMVM --> APIMan1

    Provider --> FBU

    %% Data/Service to External
    APIMan1 -->|HTTP Requests| ExternalAPI
    APIMan2 -->|HTTP Requests| ExternalAPI
    FBU -->|reads/writes| Firebase

    %% Click events
    click main "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/main.dart"
    click HS "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Home/home_screen.dart"
    click HT "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Home/home_tab.dart"
    click MI "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Home/movie-item.dart"
    click NR "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Home/new_release.dart"
    click PI "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Home/popular_Item.dart"
    click RI "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Home/recommend_item.dart"
    click GS "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Browser/genre_screen.dart"
    click BT "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Browser/browser_tab.dart"
    click GI "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Browser/genre_item.dart"
    click BMS "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Browser/movie/movie_screen.dart"
    click BMI "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Browser/movie/movie_item.dart"
    click BMD "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Browser/movie/movie_details.dart"
    click ST "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Search/search_tab.dart"
    click SD "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Search/search_delegate.dart"
    click SI "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Search/searchItem.dart"
    click WT "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/WatchList/watch_tab.dart"
    click DS "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/movie_details/movie_details.dart"
    click DT "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/movie_details/movie_details_tap.dart"
    click SM "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/movie_details/Similar/similar_movies.dart"
    click HNR "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Home/new_release_view_model.dart"
    click HPS "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Home/popular_slider_veiw_model.dart"
    click HRM "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Home/recommended_view_model.dart"
    click BBTVM "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Browser/browser_tab_viewmodel.dart"
    click BMDVM "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Browser/movie/movie_details_view_model.dart"
    click SDVM "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Search/search_delegate_view_model.dart"
    click MDVM "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/movie_details/movie_details_view_model.dart"
    click SMVM "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/movie_details/Similar/similar_movie_view_model.dart"
    click APIConst1 "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Api/api_constant.dart"
    click APIConst2 "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/api/api_constants.dart"
    click APIMan1 "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Api/api_manage.dart"
    click APIMan2 "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/api/api_manager.dart"
    click FBU "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Model/firebase_utils.dart"
    click Provider "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/Model/added_movie_provider.dart"
    click Theme "https://github.com/mervatmagdy/movies/blob/Home/feature/lib/MyTheme.dart"

    %% Styles
    classDef frontend fill:#D0E6FF,stroke:#333,stroke-width:1px
    classDef viewmodel fill:#D0FFD6,stroke:#333,stroke-width:1px
    classDef service fill:#F0F0F0,stroke:#333,stroke-width:1px
    classDef external fill:#FFE0B2,stroke:#333,stroke-width:1px
    classDef platform fill:#E1BEE7,stroke:#333,stroke-width:1px
```
