# grantalba/pioneer-movie-expo architecture

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

- Interactive diagram: https://gitdiagram.com/grantalba/pioneer-movie-expo
- Repository: https://github.com/grantalba/pioneer-movie-expo

## Overview

##### Project Type & Purpose
- This is a React Native mobile application built with Expo, using file-based routing (Expo Router) to implement a movie browsing UI. It fetches data from the external TMDb API, displays lists of movies, and navigates to detail screens with trailers and similar recommendations.

##### High-Level Architecture Components
a. Frontend (Mobile Client)
- Expo runtime (supports iOS, Android, Expo Go)
- Expo Router (file-based navigation layer)
- React Native screens under `app/` (Splash, Home, Details)
- UI Components under `components/` (e.g., MovieList, TopRatedMovie)
b. API Service Layer
- `hooks/useApi.ts` wraps Axios for HTTP calls
- Environment config (`.env`, `EXPO_PUBLIC_TMDB_AUTH_KEY`)
c. External Service
- TMDb REST API (movies, trailers, similar content)
d. Build & Configuration
- Babel (`babel.config.js`), TypeScript config (`tsconfig.json`), ESlint/Prettier
- Reset script (`scripts/reset-project.js`)

##### Relationships & Data Flow
- Screens invoke custom hooks (`useApi`) → Axios calls to TMDb → JSON responses.
- Data flows back through hooks → passed to UI components (MovieList, Each, TopRatedMovie).
- Navigation actions (Expo Router) link screens; tapping a movie card triggers route to `/details/[id]`.

##### Architectural Patterns & Principles
- File-based routing: Each file in `app/` corresponds to a navigation route.
- Hooks for data abstraction: `useApi` centralizes HTTP logic; theme hooks centralize styling logic.
- Separation of concerns:
- Presentation (screens, components)
- Business logic / data access (hooks)
- Configuration & constants (environment vars, `constants/`)

## Diagram (Mermaid)

```mermaid
flowchart TB
    classDef device fill:#e0f7fa,stroke:#006064,color:#004d40;
    classDef router fill:#ffe0b2,stroke:#e65100,color:#bf360c;
    classDef screen fill:#c8e6c9,stroke:#2e7d32,color:#1b5e20;
    classDef component fill:#f3e5f5,stroke:#6a1b9a,color:#4a148c,stroke-dasharray: 5 5;
    classDef service fill:#ffccbc,stroke:#bf360c,color:#3e2723;
    classDef external fill:#bbdefb,stroke:#0d47a1,color:#0d47a1,stroke-width:2px;
    classDef config fill:#cfd8dc,stroke:#455a64,color:#263238,stroke-dasharray: 2 2;
    classDef hook fill:#fff9c4,stroke:#fbc02d,color:#f57f17;

    subgraph "Expo App (iOS/Android/Expo Go)" 
        class ExpoApp device
        ExpoApp((📱 Expo App)) 
        subgraph "Navigation Layer"
            Router["Expo Router"]:::router
        end
        subgraph "Screens"
            Splash["Splash Screen"]:::screen
            Home["Home Screen"]:::screen
            Details["Details Screen"]:::screen
            NotFound["Not Found Screen"]:::screen
        end
        subgraph "UI Components"
            Container["Container"]:::component
            MovieList["MovieList"]:::component
            Each["Each"]:::component
            TopRated["TopRatedMovie"]:::component
            RenderWhen["RenderWhen"]:::component
            TextButton["TextButton"]:::component
        end
    end

    subgraph "Theme & Styling"
        Colors["Theme Colors Constants"]:::config
        Consts["General Constants"]:::config
        ThemeDef["Theme Definitions"]:::config
        UseColor["useColorScheme"]:::hook
        UseColorWeb["useColorScheme.web"]:::hook
        UseThemeColor["useThemeColor"]:::hook
    end

    DataLayer["Data Layer\n(useApi + Axios)"]:::service
    Env[".env.sample"]:::config
    TMDb["TMDb API"]:::external

    %% Navigation routes
    ExpoApp --> Router
    Router --> Splash
    Router --> Home
    Router --> Details
    Router --> NotFound

    %% Screen interactions
    Splash --> Container
    Home --> MovieList
    Home --> TopRated
    Details --> Each
    Details --> TextButton
    Home --> RenderWhen
    Details --> RenderWhen

    %% Theming flow
    Splash --> UseThemeColor
    Home --> UseThemeColor
    Details --> UseThemeColor
    UseThemeColor --> Colors
    UseThemeColor --> ThemeDef
    UseThemeColor --> UseColor
    UseColor --> UseColorWeb
    UseThemeColor --> Consts

    %% Data flow
    Splash --> DataLayer
    Home --> DataLayer
    Details --> DataLayer
    DataLayer --> Env
    DataLayer --> TMDb

    %% Click Events
    click Router "https://github.com/grantalba/pioneer-movie-expo/blob/main/app/_layout.tsx"
    click Splash "https://github.com/grantalba/pioneer-movie-expo/blob/main/app/index.tsx"
    click Home "https://github.com/grantalba/pioneer-movie-expo/blob/main/app/homescreen.tsx"
    click Details "https://github.com/grantalba/pioneer-movie-expo/blob/main/app/details/[id].tsx"
    click NotFound "https://github.com/grantalba/pioneer-movie-expo/blob/main/app/+not-found.tsx"
    click Container "https://github.com/grantalba/pioneer-movie-expo/blob/main/components/Container.tsx"
    click MovieList "https://github.com/grantalba/pioneer-movie-expo/blob/main/components/MovieList.tsx"
    click Each "https://github.com/grantalba/pioneer-movie-expo/blob/main/components/Each.tsx"
    click TopRated "https://github.com/grantalba/pioneer-movie-expo/blob/main/components/TopRatedMovie.tsx"
    click RenderWhen "https://github.com/grantalba/pioneer-movie-expo/blob/main/components/RenderWhen.tsx"
    click TextButton "https://github.com/grantalba/pioneer-movie-expo/blob/main/components/TextButton.tsx"
    click Colors "https://github.com/grantalba/pioneer-movie-expo/blob/main/constants/Colors.ts"
    click Consts "https://github.com/grantalba/pioneer-movie-expo/blob/main/constants/constants.ts"
    click ThemeDef "https://github.com/grantalba/pioneer-movie-expo/blob/main/constants/theme.ts"
    click DataLayer "https://github.com/grantalba/pioneer-movie-expo/blob/main/hooks/useApi.ts"
    click UseColor "https://github.com/grantalba/pioneer-movie-expo/blob/main/hooks/useColorScheme.ts"
    click UseColorWeb "https://github.com/grantalba/pioneer-movie-expo/blob/main/hooks/useColorScheme.web.ts"
    click UseThemeColor "https://github.com/grantalba/pioneer-movie-expo/blob/main/hooks/useThemeColor.ts"
    click Env "https://github.com/grantalba/pioneer-movie-expo/blob/main/.env.sample"

    class ExpoApp device
```
