# saulamsal/netflix-ui architecture

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

- Interactive diagram: https://gitdiagram.com/saulamsal/netflix-ui
- Repository: https://github.com/saulamsal/netflix-ui

## Overview

##### Main Components

A. Client-Side Architecture (Primary Focus)
- UI Layer
- Tab-based Navigation System
- Screen Components
- Shared Components
- Animation System
- State Management
- Resource Management

##### Key Relationships to Highlight

**┌─────────────────────────────────────────────────────────┐**
- UI Layer                            │
- ┤
- Navigation Layer                       │
- ┤
- Animation System                       │
- ┤
- State Management                        │
- ┤
- Resource Management                      │
- ┘

##### Specific Implementation Details

a) UI Components (Blue Rectangles):
- Profile Selection
- Home Screen
- New & Hot Section
- Search
- Downloads
- Movie Details

b) Navigation System (Purple Hexagons):
- Tab Navigation
- Modal Navigation
- Screen Transitions

c) Animation Controllers (Green Ovals):
- Reanimated Worklets
- Gesture Handlers
- Shared Element Transitions

d) State Management (Orange Diamonds):
- User Context
- Overlay Context
- Root Scale Context

e) Resource Management (Gray Rectangles):
- Asset Loading
- Data Caching
- Media Management

##### Component Grouping

**┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐**
- Feature Components
- MovieList          │
- GameList
- FeaturedContent    │
- ┘

##### Technical Stack Indicators

- Expo
- React Native Reanimated
- React Native Gesture Handler
- Expo Router
- Expo AV
- Expo Haptics

##### The resource management system

Remember to indicate the relationship between the tab navigation system and the animation worklets, as this is a key architectural feature of the application.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI
        Screens["Screen Components"]
        click Screens "https://github.com/saulamsal/netflix-ui/tree/main/app/(tabs)"
        Components["Shared Components"]
        click Components "https://github.com/saulamsal/netflix-ui/tree/main/components/ui"
        FeaturedContent["Featured Content"]
        click FeaturedContent "https://github.com/saulamsal/netflix-ui/tree/main/components/FeaturedContent"
        MovieList["Movie List"]
        click MovieList "https://github.com/saulamsal/netflix-ui/blob/main/components/MovieList/MovieList.tsx"
        GameList["Game List"]
        click GameList "https://github.com/saulamsal/netflix-ui/blob/main/components/GameList/GameList.tsx"
        BottomSheet["Bottom Sheet"]
        click BottomSheet "https://github.com/saulamsal/netflix-ui/tree/main/components/BottomSheet"
    end

    subgraph Navigation
        TabNav["Tab Navigation"]
        click TabNav "https://github.com/saulamsal/netflix-ui/blob/main/app/(tabs)/_layout.tsx"
        RootLayout["Root Layout"]
        click RootLayout "https://github.com/saulamsal/netflix-ui/blob/main/app/_layout.tsx"
        TabBarIcon["Tab Bar Icons"]
        click TabBarIcon "https://github.com/saulamsal/netflix-ui/blob/main/components/navigation/TabBarIcon.tsx"
    end

    subgraph Animation
        AnimHeader["Animated Header"]
        click AnimHeader "https://github.com/saulamsal/netflix-ui/blob/main/components/Header/AnimatedHeader.tsx"
        ParallaxScroll["Parallax Scroll"]
        click ParallaxScroll "https://github.com/saulamsal/netflix-ui/blob/main/components/ParallaxScrollView.tsx"
        ExpandedPlayer["Expanded Player"]
        click ExpandedPlayer "https://github.com/saulamsal/netflix-ui/blob/main/styles/expanded-player.ts"
    end

    subgraph State
        UserCtx["User Context"]
        click UserCtx "https://github.com/saulamsal/netflix-ui/blob/main/contexts/UserContext.tsx"
        RootScaleCtx["Root Scale Context"]
        click RootScaleCtx "https://github.com/saulamsal/netflix-ui/blob/main/contexts/RootScaleContext.tsx"
        OverlayCtx["Overlay Context"]
        click OverlayCtx "https://github.com/saulamsal/netflix-ui/blob/main/components/Overlay/OverlayContext.tsx"
        OverlayProvider["Overlay Provider"]
        click OverlayProvider "https://github.com/saulamsal/netflix-ui/blob/main/components/Overlay/OverlayProvider.tsx"
    end

    subgraph Resources
        CachedRes["Cached Resources"]
        click CachedRes "https://github.com/saulamsal/netflix-ui/blob/main/hooks/useCachedResources.ts"
        ColorScheme["Color Scheme"]
        click ColorScheme "https://github.com/saulamsal/netflix-ui/blob/main/hooks/useColorScheme.ts"
        Assets["Assets"]
        click Assets "https://github.com/saulamsal/netflix-ui/tree/main/assets/images"
        Data["Data Files"]
        click Data "https://github.com/saulamsal/netflix-ui/blob/main/data/movies.json"
    end

    subgraph Gestures
        VisionGestures["Vision Gestures"]
        click VisionGestures "https://github.com/saulamsal/netflix-ui/blob/main/hooks/useVisionGestures.ts"
        DeviceMotion["Device Motion"]
        click DeviceMotion "https://github.com/saulamsal/netflix-ui/blob/main/hooks/useDeviceMotion.ts"
        EyeTracking["Eye Tracking"]
        click EyeTracking "https://github.com/saulamsal/netflix-ui/blob/main/hooks/useEyeTracking.ts"
    end

    %% Relationships
    RootLayout --> TabNav
    TabNav --> TabBarIcon
    TabNav --> Screens
    Screens --> Components
    Screens --> FeaturedContent
    Screens --> MovieList
    Screens --> GameList
    Screens --> BottomSheet

    AnimHeader --> Components
    ParallaxScroll --> Components
    ExpandedPlayer --> Components

    UserCtx --> RootLayout
    RootScaleCtx --> RootLayout
    OverlayCtx --> OverlayProvider
    OverlayProvider --> RootLayout

    VisionGestures --> Components
    DeviceMotion --> Components
    EyeTracking --> Components

    CachedRes --> Assets
    ColorScheme --> Components
    Data --> Components

    classDef ui fill:#2196F3,stroke:#1565C0,color:white
    classDef nav fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef anim fill:#4CAF50,stroke:#388E3C,color:white
    classDef state fill:#FF9800,stroke:#F57C00,color:white
    classDef resource fill:#757575,stroke:#616161,color:white
    classDef gesture fill:#E91E63,stroke:#C2185B,color:white

    class Screens,Components,FeaturedContent,MovieList,GameList,BottomSheet ui
    class TabNav,RootLayout,TabBarIcon nav
    class AnimHeader,ParallaxScroll,ExpandedPlayer anim
    class UserCtx,RootScaleCtx,OverlayCtx,OverlayProvider state
    class CachedRes,ColorScheme,Assets,Data resource
    class VisionGestures,DeviceMotion,EyeTracking gesture
```
