# nzemlin/gamesetai architecture

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

- Interactive diagram: https://gitdiagram.com/nzemlin/gamesetai
- Repository: https://github.com/nzemlin/gamesetai

## Overview

##### Main System Components

a) Frontend Layer (Client)
- React + TypeScript application built with Vite
- Component structure focusing on:
- Authentication (Login, Signup, Password Reset)
- Video Management (Upload, Edit)
- Scoreboard System
- Dashboard and Profile features

b) Backend Layer (Server)
- Node.js/TypeScript server with distinct controllers:
- Authentication Controller
- Upload Controller
- Video Controller

c) Storage Systems
- File Storage (server/uploads directory)
- Database (indicated by Supabase integration)

**┌─ Client Layer ─────────────────────┐**
- React + TypeScript + Vite          │
- ┌─ Components ─┐ ┌─ Pages ───────┐ │
- Scoreboard   │ │ Dashboard     │ │
- Video Tools  │ │ Video Upload  │ │
- Layout       │ │ Auth Pages    │ │
- ┘ └───────────────┘ │
- ┘
- ↕ HTTP/API
**┌─ Server Layer ─────────────────────┐**
- Node.js + TypeScript               │
- ┌─ Controllers ┐ ┌─ Middleware ──┐ │
- Auth         │ │ Auth         │ │
- Upload       │ └──────────────┘ │
- Video        │                  │
- ┘                   │
- ┘
- ↕ Data Flow
**┌─ Storage Layer ────────────────────┐**
- ┌─ File Storage ┐ ┌─ Database ───┐ │
- Video Files   │ │ Supabase     │ │
- ┘ └─────────────┘  │
- ┘

##### Component Relationships

- Client-Server communication via HTTP/API endpoints
- Server-Storage interactions
- Authentication flow between components
- Video processing pipeline

##### Technical Details

Annotations for:
- TypeScript usage throughout the stack
- Vite build system
- ESLint configuration
- Tailwind CSS styling
- API endpoint structure
- File upload handling
- Authentication middleware

##### Data Flow Markers

Distinct flows for:
- User authentication
- Video upload/processing
- Scoring data
- Configuration management

Remember to include the custom hooks (usePointHandling, useScoreboardState, useServerManagement) as they appear to be crucial to the application's functionality.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        App["App"]:::frontend
        Layout["Layout Component"]:::frontend
        
        subgraph "Authentication Components"
            AuthPages["Auth Pages"]:::auth
            Login["Login"]:::auth
            Signup["Signup"]:::auth
            Reset["Password Reset"]:::auth
        end
        
        subgraph "Video Management"
            VideoUpload["Video Upload"]:::video
            VideoEdit["Video Edit"]:::video
        end
        
        subgraph "Scoreboard System"
            Scoreboard["Scoreboard"]:::score
            ScoreHeader["Scoreboard Header"]:::score
            ScoringControls["Scoring Controls"]:::score
            PointsList["Points List"]:::score
        end
        
        subgraph "Core Pages"
            Dashboard["Dashboard"]:::frontend
            Profile["Profile"]:::frontend
        end
        
        subgraph "Custom Hooks"
            PointHandling["Point Handling Hook"]:::hook
            ScoreboardState["Scoreboard State Hook"]:::hook
            ServerManagement["Server Management Hook"]:::hook
        end
    end
    
    subgraph Server
        ServerEntry["Server Entry Point"]:::backend
        
        subgraph "Controllers"
            AuthController["Auth Controller"]:::auth
            UploadController["Upload Controller"]:::upload
            VideoController["Video Controller"]:::video
        end
        
        subgraph "Middleware"
            AuthMiddleware["Auth Middleware"]:::auth
        end
        
        subgraph "Routes"
            AuthRoutes["Auth Routes"]:::auth
            VideoRoutes["Video Routes"]:::video
            UploadRoutes["Upload Routes"]:::upload
        end
    end
    
    subgraph Storage
        FileStorage["File Storage"]:::storage
        Database["Supabase Database"]:::storage
    end
    
    %% Relationships
    App --> Layout
    Layout --> AuthPages
    Layout --> Dashboard
    Layout --> VideoUpload
    Layout --> VideoEdit
    Layout --> Profile
    Layout --> Scoreboard
    
    Scoreboard --> ScoreHeader
    Scoreboard --> ScoringControls
    Scoreboard --> PointsList
    Scoreboard --> ScoreboardState
    
    AuthPages --> AuthController
    VideoUpload --> UploadController
    VideoEdit --> VideoController
    
    AuthController --> AuthMiddleware
    AuthController --> Database
    
    UploadController --> FileStorage
    VideoController --> FileStorage
    VideoController --> Database
    
    %% Click Events
    click App "https://github.com/NZemlin/GameSetAI/blob/main/client/src/App.tsx"
    click Layout "https://github.com/NZemlin/GameSetAI/blob/main/client/src/components/Layout.tsx"
    click AuthPages "https://github.com/NZemlin/GameSetAI/tree/main/client/src/pages/auth/"
    click VideoUpload "https://github.com/NZemlin/GameSetAI/blob/main/client/src/pages/VideoUpload.tsx"
    click VideoEdit "https://github.com/NZemlin/GameSetAI/blob/main/client/src/pages/VideoEdit.tsx"
    click Dashboard "https://github.com/NZemlin/GameSetAI/blob/main/client/src/pages/Dashboard.tsx"
    click Profile "https://github.com/NZemlin/GameSetAI/blob/main/client/src/pages/Profile.tsx"
    click Scoreboard "https://github.com/NZemlin/GameSetAI/blob/main/client/src/components/Scoreboard.tsx"
    click ScoreHeader "https://github.com/NZemlin/GameSetAI/blob/main/client/src/components/ScoreboardHeader.tsx"
    click ScoringControls "https://github.com/NZemlin/GameSetAI/blob/main/client/src/components/ScoringControls.tsx"
    click PointsList "https://github.com/NZemlin/GameSetAI/blob/main/client/src/components/PointsList.tsx"
    click PointHandling "https://github.com/NZemlin/GameSetAI/blob/main/client/src/hooks/usePointHandling.ts"
    click ScoreboardState "https://github.com/NZemlin/GameSetAI/blob/main/client/src/hooks/useScoreboardState.ts"
    click ServerManagement "https://github.com/NZemlin/GameSetAI/blob/main/client/src/hooks/useServerManagement.ts"
    click AuthController "https://github.com/NZemlin/GameSetAI/blob/main/server/src/controllers/authController.ts"
    click UploadController "https://github.com/NZemlin/GameSetAI/blob/main/server/src/controllers/uploadController.ts"
    click VideoController "https://github.com/NZemlin/GameSetAI/blob/main/server/src/controllers/videoController.ts"
    click AuthMiddleware "https://github.com/NZemlin/GameSetAI/blob/main/server/src/middleware/authMiddleware.ts"
    click AuthRoutes "https://github.com/NZemlin/GameSetAI/blob/main/server/src/routes/authRoutes.ts"
    click VideoRoutes "https://github.com/NZemlin/GameSetAI/blob/main/server/src/routes/videoRoutes.ts"
    click UploadRoutes "https://github.com/NZemlin/GameSetAI/blob/main/server/src/routes/uploadRoutes.ts"
    click ServerEntry "https://github.com/NZemlin/GameSetAI/blob/main/server/src/index.ts"
    click FileStorage "https://github.com/NZemlin/GameSetAI/tree/main/server/uploads/"
    click Database "https://github.com/NZemlin/GameSetAI/blob/main/client/src/utils/supabase.ts"
    
    %% Styles
    classDef frontend fill:#2196F3,color:white
    classDef backend fill:#4CAF50,color:white
    classDef auth fill:#F44336,color:white
    classDef video fill:#9C27B0,color:white
    classDef score fill:#FF9800,color:white
    classDef storage fill:#FFC107,color:black
    classDef hook fill:#607D8B,color:white
    classDef upload fill:#795548,color:white
```
