# shubhanshubb/moviebrowser architecture

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

- Interactive diagram: https://gitdiagram.com/shubhanshubb/moviebrowser
- Repository: https://github.com/shubhanshubb/moviebrowser

## Overview

##### Project Type & Purpose
- The project is a mobile full-stack application built with React Native. Its main purpose is to let users browse movie information from the TMDB (The Movie Database) API.
- The app features tabbed navigation to display movie categories (Now Playing, Popular, Top Rated, Upcoming), detailed movie screens, and custom state management (via a UserContext).

##### File Structure to Identify Main Components
- Entry Point: The App.js file sets up the NavigationContainer, applies a custom theme, and wraps the navigation stack in a global UserProvider.
- Navigation: The “src/navigation” directory contains AppNavigator.js and BottomTab.js, which handle the routing and navigation between different screens.
- API Integration: The “src/api/tmdb.js” file is responsible for making API calls to TMDB.
- UI Components:
- “src/Components/MovieCard.js” is a reusable display element.
- Other UI components (Splash.js, CountDown.js) help enhance user experience.
- Screens: Within “src/screens” and “src/bottomTab” (for each category), screens like MovieDetail, Favourite, Play, Popular, Rated, and Upcoming are implemented.
- State Management: The UserContext.js file provides custom state management for user-related data.
- Native Platform Integration: Android and iOS directories indicate native configuration and specific setup necessary for mobile hardware.

##### Identifying Architectural Relationships and Data Flow
a. Entry & Setup:
- The application starts at App.js where the NavigationContainer initializes.
- Wrapped within a UserProvider, the entire tree has access to shared state.
b. Navigation Layer:
- AppNavigator.js orchestrates the routing for various screens.
- BottomTab.js handles tabbed navigation between categories.
c. Presentation Layer:
- UI components under “src/Components” and screens under “src/screens” represent the presentation logic.
- Each screen pulls in individual components (for layout, movie display, details, etc.).
d. API Layer:
- The TMDB API module communicates with the external TMDB service via Axios.
- Data fetched via APIs flows through the screens to update UI components.
e. Mobile Platform & Native Bridge:
- The android and ios directories contain native configurations, ensuring that the React Native JavaScript code is correctly bridged to native components.
f. Dependencies:
- Various libraries (e.g., React Navigation, React Native Gesture Handler, Axios) are used throughout the application to facilitate navigation, animations, state, and API calls.

- The entry point (App.js) and its immediate components (UserProvider, NavigationContainer).
- Navigation modules (AppNavigator, BottomTab) and their connection to screens.
- API module and its integration with the TMDB external service.
- UI components and screens under the presentation layer.
- Native mobile platform components (highlighting Android and iOS directories).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% App Initialization & Global State
    subgraph "App Initialization & Global State"
        AppJS["App.js"]:::global
        UserCtx["UserProvider (UserContext)"]:::global
        AppJS --> UserCtx
    end

    %% Navigation Layer
    subgraph "Navigation"
        NavCont["NavigationContainer"]:::nav
        AppNav["AppNavigator"]:::nav
        BottomTab["BottomTab"]:::nav
        NavCont --> AppNav
        NavCont --> BottomTab
    end

    %% API Integration
    subgraph "API Integration"
        TMDB["TMDB API"]:::api
    end

    %% UI / Presentation Layer
    subgraph "UI / Presentation"
        subgraph "Screens"
            MovieDetail["MovieDetail"]:::ui
            Favourite["Favourite"]:::ui
            Play["Play"]:::ui
            Popular["Popular"]:::ui
            Rated["Rated"]:::ui
            Upcoming["Upcoming"]:::ui
        end
        subgraph "UI Components"
            MovieCard["MovieCard"]:::ui
            Splash["Splash"]:::ui
            CountDown["CountDown"]:::ui
        end
    end

    %% Native Platforms
    subgraph "Native Platforms"
        Android["Android"]:::native
        iOS["iOS"]:::native
    end

    %% Relationships and Data Flow
    UserCtx --> NavCont
    AppJS --> Splash
    AppJS --> Android
    AppJS --> iOS

    AppNav --> MovieDetail
    AppNav --> Favourite
    BottomTab --> Play
    BottomTab --> Popular
    BottomTab --> Rated
    BottomTab --> Upcoming

    TMDB --> MovieDetail
    TMDB --> Favourite
    TMDB --> Play
    TMDB --> Popular
    TMDB --> Rated
    TMDB --> Upcoming

    MovieDetail --> MovieCard
    Favourite --> MovieCard
    Play --> MovieCard
    Popular --> MovieCard
    Rated --> MovieCard
    Upcoming --> MovieCard

    %% Class Definitions for Colours
    classDef global fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef nav fill:#d1e7dd,stroke:#333,stroke-width:2px;
    classDef api fill:#fff3cd,stroke:#333,stroke-width:2px;
    classDef ui fill:#d7e4f4,stroke:#333,stroke-width:2px;
    classDef native fill:#e4c1f9,stroke:#333,stroke-width:2px;

    %% Click Events for Component Mappings
    click AppJS "https://github.com/shubhanshubb/moviebrowser/blob/main/App.js"
    click UserCtx "https://github.com/shubhanshubb/moviebrowser/blob/main/UserContext.js"
    click AppNav "https://github.com/shubhanshubb/moviebrowser/blob/main/src/navigation/AppNavigator.js"
    click BottomTab "https://github.com/shubhanshubb/moviebrowser/blob/main/src/navigation/BottomTab.js"
    click TMDB "https://github.com/shubhanshubb/moviebrowser/blob/main/src/api/tmdb.js"
    click MovieCard "https://github.com/shubhanshubb/moviebrowser/blob/main/src/Components/MovieCard.js"
    click CountDown "https://github.com/shubhanshubb/moviebrowser/blob/main/src/CountDown.js"
    click Splash "https://github.com/shubhanshubb/moviebrowser/blob/main/src/Splash.js"
    click MovieDetail "https://github.com/shubhanshubb/moviebrowser/blob/main/src/screens/MovieDetail.js"
    click Favourite "https://github.com/shubhanshubb/moviebrowser/blob/main/src/screens/Favourite.js"
    click Play "https://github.com/shubhanshubb/moviebrowser/blob/main/src/bottomTab/Play.js"
    click Popular "https://github.com/shubhanshubb/moviebrowser/blob/main/src/bottomTab/Popular.js"
    click Rated "https://github.com/shubhanshubb/moviebrowser/blob/main/src/bottomTab/Rated.js"
    click Upcoming "https://github.com/shubhanshubb/moviebrowser/blob/main/src/bottomTab/Upcoming.js"
    click Android "https://github.com/shubhanshubb/moviebrowser/tree/main/android"
    click iOS "https://github.com/shubhanshubb/moviebrowser/tree/main/ios"
```
