# davidg999/movie-search architecture

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

- Interactive diagram: https://gitdiagram.com/davidg999/movie-search
- Repository: https://github.com/davidg999/movie-search

## Overview

##### Main Components Identification

The system should be represented with these primary components:

A. Frontend Application (React + TypeScript)
B. External API Service (TMDB)
C. State Management and Data Flow
D. Routing System

##### Specific Component Relationships

- How the NavItem components relate to page routing
- Genre filtering flow from GenreChip to content display
- Pagination interaction with content fetching
- SingleContentInfo relationship with Credits and ContentDetails

##### Technical Stack Indicators

Technology badges or labels for:
- React + TypeScript
- Tailwind CSS
- Vite
- React Query (indicated by queryClient.ts)

Create clear separations for:
a. User Interface Layer
- Pages
- Components
- Navigation

b. Business Logic Layer
- Hooks
- Utils
- API Integration

c. External Services Layer
- TMDB API
- Content Delivery

##### Important Details

- Relationship between SingleContentCard and its utility functions
- Demonstrate how the search functionality integrates with the API
- Genre filtering mechanism
- Pagination data flow

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Frontend Application"
        subgraph "Pages"
            Trending["Trending Page"]:::page
            Movies["Movies Page"]:::page
            Series["Series Page"]:::page
            Search["Search Page"]:::page
            SingleContent["Single Content Info"]:::page
        end

        subgraph "Navigation"
            Header["Header"]:::component
            Navbar["Navbar"]:::component
            NavItem["Navigation Items"]:::component
        end

        subgraph "Content Components"
            ContentCard["Content Card"]:::component
            ContentDetails["Content Details"]:::component
            Credits["Credits Display"]:::component
        end

        subgraph "Filtering & Pagination"
            Genres["Genres Component"]:::component
            GenreChip["Genre Chip"]:::component
            Pagination["Pagination"]:::component
            PageNumber["Page Number Element"]:::component
        end

        subgraph "Data Management"
            APIUtils["API Integration"]:::util
            QueryClient["Query Client"]:::util
            UseGenres["useGenres Hook"]:::hook
        end

        subgraph "Utility Functions"
            DateConvert["Date Conversion"]:::util
            TitleDisplay["Title Display"]:::util
            RatingBg["Rating Background"]:::util
            Runtime["Runtime Conversion"]:::util
            Popularity["Popularity Formatting"]:::util
        end
    end

    subgraph "External Services"
        TMDBAPI["TMDB API"]:::external
    end

    %% Relationships
    Navbar --> NavItem
    NavItem --> Trending & Movies & Series & Search
    Header --> Search
    
    Genres --> GenreChip
    GenreChip --> UseGenres
    UseGenres --> APIUtils
    
    Pagination --> PageNumber
    PageNumber --> APIUtils
    
    ContentCard --> ContentDetails
    ContentCard --> Credits
    ContentCard --> DateConvert & TitleDisplay & RatingBg & Runtime & Popularity
    
    APIUtils --> TMDBAPI
    QueryClient --> APIUtils

    %% Click Events
    click Trending "https://github.com/davidg999/movie-search/blob/master/src/pages/Trending.tsx"
    click Movies "https://github.com/davidg999/movie-search/blob/master/src/pages/Movies.tsx"
    click Series "https://github.com/davidg999/movie-search/blob/master/src/pages/Series.tsx"
    click Search "https://github.com/davidg999/movie-search/blob/master/src/pages/Search.tsx"
    click SingleContent "https://github.com/davidg999/movie-search/blob/master/src/pages/single-content-info/SingleContentInfo.tsx"
    click Header "https://github.com/davidg999/movie-search/blob/master/src/components/header/Header.tsx"
    click Navbar "https://github.com/davidg999/movie-search/blob/master/src/components/navbar/Navbar.tsx"
    click NavItem "https://github.com/davidg999/movie-search/blob/master/src/components/navbar/NavItem.tsx"
    click Genres "https://github.com/davidg999/movie-search/blob/master/src/components/genre/Genres.tsx"
    click GenreChip "https://github.com/davidg999/movie-search/blob/master/src/components/genre/GenreChip.tsx"
    click UseGenres "https://github.com/davidg999/movie-search/blob/master/src/hooks/useGenres.ts"
    click Pagination "https://github.com/davidg999/movie-search/blob/master/src/components/pagination/Pagination.tsx"
    click PageNumber "https://github.com/davidg999/movie-search/blob/master/src/components/pagination/PageNumberElement.tsx"
    click ContentCard "https://github.com/davidg999/movie-search/blob/master/src/components/single-content-info/SingleContentCard.tsx"
    click ContentDetails "https://github.com/davidg999/movie-search/blob/master/src/pages/single-content-info/ContentDetails.tsx"
    click Credits "https://github.com/davidg999/movie-search/blob/master/src/pages/single-content-info/Credits.tsx"
    click APIUtils "https://github.com/davidg999/movie-search/blob/master/src/utils/api.ts"
    click QueryClient "https://github.com/davidg999/movie-search/blob/master/src/utils/queryClient.ts"
    click DateConvert "https://github.com/davidg999/movie-search/blob/master/src/utils/single-content-info/convertDate.ts"
    click TitleDisplay "https://github.com/davidg999/movie-search/blob/master/src/utils/single-content-info/displayTitle.ts"
    click RatingBg "https://github.com/davidg999/movie-search/blob/master/src/utils/single-content-info/setRatingBg.ts"
    click Runtime "https://github.com/davidg999/movie-search/blob/master/src/utils/single-content-info/minutesToHours.ts"
    click Popularity "https://github.com/davidg999/movie-search/blob/master/src/utils/single-content-info/popularityInfo.ts"

    %% Styling
    classDef page fill:#2563eb,color:white
    classDef component fill:#4ade80,color:black
    classDef util fill:#f97316,color:white
    classDef hook fill:#a855f7,color:white
    classDef external fill:#eab308,color:black
```
