# goktugyalcin/where-can-i-watch architecture

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

- Interactive diagram: https://gitdiagram.com/goktugyalcin/where-can-i-watch
- Repository: https://github.com/goktugyalcin/where-can-i-watch

## Overview

##### Main Components

a. Frontend Layer:
- Next.js Application (Client-Side)
- Components directory (React components)
- App directory (Next.js 13+ App Router)
- Public Assets
- Styling (Tailwind CSS)

b. Backend Layer:
- API Routes (Next.js Server-Side)
- /fetchCountry
- /fetchProviders
- /fetchSearch
- External Services Integration
- TMDB API

c. State Management:
- Zustand Store

##### Component Relationships

**[Client Browser] ←→ [Next.js Frontend]**
- ↓
**[Next.js API Routes] ←→ [TMDB API]**

##### Detailed Component Breakdown

Frontend Components (Group these together):
- Interactive Elements (AnimatedShinyText, HeaderButton)
- Layout Components (BlurFade, GridPattern)
- Feature Components (CountryWrapper, ImprintWatchCategories)
- Form Elements (GeneratedSelect, GeneratedValue)

API Routes (Create a separate section):
- /fetchCountry
- /fetchProviders
- /fetchSearch

##### Data Flow Visualization

- User interactions → Frontend components
- Frontend → API routes
- API routes → TMDB API
- State updates through Zustand

##### Infrastructure Layer

A section showing:
- Docker container
- Development environment
- Build process

**[Client Layer]**
- ↓
**[Frontend Layer]**
- ↓
**[API Layer]**
- ↓
**[External Services Layer]**

1. Next.js App Router architecture, as this is a modern Next.js application using the app directory structure.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        Browser["Web Browser"]
    end

    subgraph NextApp["Next.js Application"]
        direction TB
        subgraph FrontendComponents["Frontend Components"]
            direction TB
            Interactive["Interactive Components"]:::frontend
            Layout["Layout Components"]:::frontend
            MainApp["Main App Components"]:::frontend
        end

        subgraph APIRoutes["API Routes"]
            direction TB
            CountryAPI["/fetchCountry"]:::api
            ProvidersAPI["/fetchProviders"]:::api
            SearchAPI["/fetchSearch"]:::api
        end

        subgraph Core["Core Application"]
            direction TB
            Types["Type Definitions"]:::types
            Utils["Utility Functions"]:::utils
            Styles["Styling"]:::styles
        end
    end

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

    subgraph Infrastructure["Infrastructure"]
        direction TB
        Docker["Docker Container"]:::infra
        NextConfig["Next.js Config"]:::infra
        TSConfig["TypeScript Config"]:::infra
    end

    Browser <--> FrontendComponents
    FrontendComponents --> APIRoutes
    APIRoutes <--> TMDB
    FrontendComponents --> Core
    APIRoutes --> Core

    %% Click Events
    click Interactive "https://github.com/GoktugYalcin/where-can-i-watch/blob/main/components/AnimatedShinyText.tsx"
    click Layout "https://github.com/GoktugYalcin/where-can-i-watch/blob/main/components/BlurFade.tsx"
    click MainApp "https://github.com/GoktugYalcin/where-can-i-watch/blob/main/app/page.tsx"
    click CountryAPI "https://github.com/GoktugYalcin/where-can-i-watch/blob/main/app/fetchCountry/route.ts"
    click ProvidersAPI "https://github.com/GoktugYalcin/where-can-i-watch/blob/main/app/fetchProviders/route.ts"
    click SearchAPI "https://github.com/GoktugYalcin/where-can-i-watch/blob/main/app/fetchSearch/route.ts"
    click Types "https://github.com/GoktugYalcin/where-can-i-watch/tree/main/types"
    click Utils "https://github.com/GoktugYalcin/where-can-i-watch/tree/main/lib/utils"
    click Styles "https://github.com/GoktugYalcin/where-can-i-watch/blob/main/app/globals.css"
    click Docker "https://github.com/GoktugYalcin/where-can-i-watch/tree/main/Dockerfile"
    click NextConfig "https://github.com/GoktugYalcin/where-can-i-watch/blob/main/next.config.mjs"
    click TSConfig "https://github.com/GoktugYalcin/where-can-i-watch/blob/main/tsconfig.json"

    %% Styling
    classDef frontend fill:#3b82f6,color:white
    classDef api fill:#22c55e,color:white
    classDef external fill:#eab308,color:black
    classDef types fill:#a855f7,color:white
    classDef utils fill:#64748b,color:white
    classDef styles fill:#ec4899,color:white
    classDef infra fill:#6b7280,color:white

    %% Legend
    subgraph Legend
        direction TB
        Frontend["Frontend"]:::frontend
        API["API Routes"]:::api
        ExternalService["External Services"]:::external
        TypeDefs["Type Definitions"]:::types
        Utilities["Utilities"]:::utils
        Styling["Styling"]:::styles
        InfraStructure["Infrastructure"]:::infra
    end
```
