# thatsickusername/cinelog architecture

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

- Interactive diagram: https://gitdiagram.com/thatsickusername/cinelog
- Repository: https://github.com/thatsickusername/cinelog

## Overview

##### Project type and purpose
- This is a front-end single-page application built with React and Vite.
- It provides movie browsing/search functionality (hooks like useNowPlaying, useSearchMovies, etc.) and uses Firebase for authentication and Firestore storage.

##### File structure
- src/pages: each folder is a top-level route (HomePage, DetailsPage, ProfilePage, etc.).
- src/components: reusable UI widgets (Navbar, Carousels, ReviewsSection, etc.).
- src/context: AuthProvider and useAuth handle user authentication state.
- src/services: custom hooks and modules that perform data fetching (Firebase config, Firestore CRUD, and movie-API calls).
- index.html + main.jsx: entry point where Vite spins up the development server or builds static assets.

##### README
- Confirms React + Vite setup with HMR and ESLint.
- No backend code here—external services only.

a. Front-end layers (grouped visually):
1. UI Layer (React Components & Pages)
- Pages: HomePage, DetailsPage, SearchResultsPage, ProfilePage, LoginPage, Movie.
- Components: Navbar, Carousels, Headers, ReviewsSection, etc.
2. State Management Layer
- AuthProvider Context (wraps App.jsx)
- useAuth hook
3. Data-Access Layer (API Hooks)
- src/services: useTrending, useSearchMovies/TV, useDetails, useCredits, useImages, useNowPlaying
- services/firebase.js (initializes Firebase Auth)
- services/firestore.js (initializes Firestore)
b. External services:
- Firebase Authentication
- Firestore Database
- External Movie API (e.g., TMDB)
c. Build & Deployment
- Vite Dev Server (serves index.html + assets, hot-reload)
- Production: static site host (Netlify, Vercel, etc.)

##### Architectural patterns & design principles
- Separation of concerns: UI vs. state management vs. data layer
- Single source of truth for auth state (AuthProvider)
- Reusable hooks for API interactions
- Component-based layout with container/presentation split (e.g., DetailsHeaderContainer)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Entry & Build Configuration
    Browser["Browser"]:::external
    DevServer["Vite Dev Server / Static Host"]:::external
    Browser -->|"HTTP request"| DevServer
    DevServer -->|"serves index.html"| HTML["index.html"]:::data
    HTML -->|"loads bundle"| Main["src/main.jsx"]:::data
    Main -->|"renders"| App["src/App.jsx"]:::data

    %% UI Layer
    subgraph "UI Layer"
        direction TB
        HomePage["HomePage"]:::ui
        DetailsPage["DetailsPage"]:::ui
        SearchResultsPage["SearchResultsPage"]:::ui
        ProfilePage["ProfilePage"]:::ui
        LoginPage["LoginPage"]:::ui
        MoviePage["MoviePage"]:::ui

        Navbar["Navbar"]:::ui
        Layout["Layout Container"]:::ui
        DetailsHeader["Details Header Container"]:::ui
        ExtraDetails["Extra Details Panel"]:::ui
        HorizontalCarousel["Horizontal Cards Carousel"]:::ui
        CastCarousel["Cast Carousel"]:::ui
        ReviewsSection["Reviews Section"]:::ui
        WelcomeHeader["Welcome Header"]:::ui
        ProtectedRoute["Protected Route Wrapper"]:::ui
    end
    App -->|"renders pages/components"| HomePage
    App --> DetailsPage
    App --> SearchResultsPage
    App --> ProfilePage
    App --> LoginPage
    App --> MoviePage
    App --> Navbar
    App --> Layout
    App --> DetailsHeader
    App --> ExtraDetails
    App --> HorizontalCarousel
    App --> CastCarousel
    App --> ReviewsSection
    App --> WelcomeHeader
    App --> ProtectedRoute

    %% State Management Layer
    subgraph "State Management Layer"
        direction TB
        AuthProvider["AuthProvider Context"]:::state
        useAuth["useAuth Hook"]:::state
    end
    App -->|"wraps with"| AuthProvider
    AuthProvider --> useAuth
    HomePage --> useAuth
    ProfilePage --> useAuth
    ProtectedRoute --> useAuth

    %% Data-Access Layer
    subgraph "Data-Access Layer"
        direction TB
        FirebaseInit["Firebase Initialization"]:::data
        FirestoreInit["Firestore Initialization"]:::data
        useTrending["useTrending Hook"]:::data
        useSearchMovies["useSearchMovies Hook"]:::data
        useSearchTV["useSearchTV Hook"]:::data
        useNowPlaying["useNowPlaying Hook"]:::data
        useDetails["useDetails Hook"]:::data
        useCredits["useCredits Hook"]:::data
        useImages["useImages Hook"]:::data
    end
    useAuth --> FirebaseInit
    useAuth --> FirestoreInit
    HomePage --> useTrending
    SearchResultsPage --> useSearchMovies
    SearchResultsPage --> useSearchTV
    MoviePage --> useDetails
    MoviePage --> useCredits
    MoviePage --> useImages
    HomePage --> useNowPlaying

    %% External Services
    subgraph "External Services"
        direction TB
        FirebaseAuth["Firebase Authentication"]:::external
        FirestoreDB["Firestore Database"]:::database
        MovieAPI["External Movie API (TMDB)"]:::external
    end
    FirebaseInit --> FirebaseAuth
    FirestoreInit --> FirestoreDB
    useTrending --> MovieAPI
    useSearchMovies --> MovieAPI
    useSearchTV --> MovieAPI
    useNowPlaying --> MovieAPI
    useDetails --> MovieAPI
    useCredits --> MovieAPI
    useImages --> MovieAPI

    %% Click Events
    click HomePage "https://github.com/thatsickusername/cinelog/blob/main/src/pages/HomePage/HomePage.jsx"
    click DetailsPage "https://github.com/thatsickusername/cinelog/blob/main/src/pages/DetailsPage/DetailsPage.jsx"
    click SearchResultsPage "https://github.com/thatsickusername/cinelog/blob/main/src/pages/SearchResultsPage/SearchResultsPage.jsx"
    click ProfilePage "https://github.com/thatsickusername/cinelog/blob/main/src/pages/ProfilePage/ProfilePage.jsx"
    click LoginPage "https://github.com/thatsickusername/cinelog/blob/main/src/pages/LoginPage/LoginPage.jsx"
    click MoviePage "https://github.com/thatsickusername/cinelog/blob/main/src/pages/Movie/Movie.jsx"
    click Navbar "https://github.com/thatsickusername/cinelog/blob/main/src/components/Navbar/Navbar.jsx"
    click Layout "https://github.com/thatsickusername/cinelog/blob/main/src/components/Layout/Layout.jsx"
    click DetailsHeader "https://github.com/thatsickusername/cinelog/blob/main/src/components/DetailsHeaderContainer/DetailsHeaderContainer.jsx"
    click ExtraDetails "https://github.com/thatsickusername/cinelog/blob/main/src/components/ExtraDetails/ExtraDetails.jsx"
    click HorizontalCarousel "https://github.com/thatsickusername/cinelog/blob/main/src/components/HorizontalCardsCarousel/HorizontalCardsCarousel.jsx"
    click CastCarousel "https://github.com/thatsickusername/cinelog/blob/main/src/components/CastCarousel/CastCarousel.jsx"
    click ReviewsSection "https://github.com/thatsickusername/cinelog/blob/main/src/components/ReviewsSection/ReviewsSection.jsx"
    click WelcomeHeader "https://github.com/thatsickusername/cinelog/blob/main/src/components/WelcomeHeader/WelcomeHeader.jsx"
    click ProtectedRoute "https://github.com/thatsickusername/cinelog/blob/main/src/components/Routes/Protected.jsx"
    click AuthProvider "https://github.com/thatsickusername/cinelog/blob/main/src/context/authProvider.jsx"
    click useAuth "https://github.com/thatsickusername/cinelog/blob/main/src/context/useAuth.js"
    click FirebaseInit "https://github.com/thatsickusername/cinelog/blob/main/src/services/firebase.js"
    click FirestoreInit "https://github.com/thatsickusername/cinelog/blob/main/src/services/firestore.js"
    click useTrending "https://github.com/thatsickusername/cinelog/blob/main/src/services/useTrending.js"
    click useSearchMovies "https://github.com/thatsickusername/cinelog/blob/main/src/services/useSearchMovies.js"
    click useSearchTV "https://github.com/thatsickusername/cinelog/blob/main/src/services/useSearchTV.js"
    click useNowPlaying "https://github.com/thatsickusername/cinelog/blob/main/src/services/useNowPlaying.js"
    click useDetails "https://github.com/thatsickusername/cinelog/blob/main/src/services/useDetails.js"
    click useCredits "https://github.com/thatsickusername/cinelog/blob/main/src/services/useCredits.js"
    click useImages "https://github.com/thatsickusername/cinelog/blob/main/src/services/useImages.js"
    click Main "https://github.com/thatsickusername/cinelog/blob/main/src/main.jsx"
    click App "https://github.com/thatsickusername/cinelog/blob/main/src/App.jsx"
    click HTML "https://github.com/thatsickusername/cinelog/blob/main/index.html"
    click DevServer "https://github.com/thatsickusername/cinelog/blob/main/vite.config.js"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0366D6,color:#000
    classDef state fill:#DFFFE0,stroke:#2A9D8F,color:#000
    classDef data fill:#FFE8A1,stroke:#E76F51,color:#000
    classDef database fill:#E0E0E0,stroke:#6D6D6D,color:#000
    classDef external fill:#E8E8FF,stroke:#4A90E2,color:#000
```
