# phptuts/react-video-analyzer-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/phptuts/react-video-analyzer-frontend
- Repository: https://github.com/phptuts/react-video-analyzer-frontend

## Overview

##### Main Components

Frontend Layer:
- React Application (Vite-based)
- Authentication Context
- Protected Routes
- Main Pages (Home, Videos, Upload, Video)
- Navigation Component

Cloud Services:
- Firebase Authentication
- Firebase Firestore (Database)
- Firebase Storage (Video Storage)
- OpenAI API (Video Analysis)

**Frontend (Blue Components):**
**┌─────────────────────────────────────────────────┐**
- React Application                 │
- ┬─────────────────┬─────────────────┤
- Auth       │     Routes      │    Components   │
- Context    │ (Protected)     │    (Nav, etc.)  │
- ┴─────────────────┴─────────────────┘

**Cloud Services (Green Components):**
**┌─────────────┐  ┌─────────────┐  ┌─────────────┐**
- Firebase  │  │  Firebase   │  │   OpenAI    │
- Auth     │  │  Firestore  │  │    API      │
- ┘  └─────────────┘  └─────────────┘

**Storage (Yellow Component):**
**┌─────────────────────────────────────────────────┐**
- Firebase Storage                    │
- (Video Files < 1GB)                  │
- ┘

##### Connection Flows

- Authentication flow between Frontend → Firebase Auth
- Data flow between Frontend → Firestore (video metadata)
- Storage operations between Frontend → Firebase Storage
- Analysis flow between Frontend → OpenAI API

##### Important Details

Security Layer:
- Firebase security rules for both Firestore and Storage
- Authentication requirements for protected routes
- Size limitations (1GB) for video uploads

Data Flow:
- Video upload path: Frontend → Firebase Storage
- Video analysis path: Frontend → OpenAI API
- Video metadata storage: Frontend → Firestore

##### Technical Stack Indicators

Technology badges or labels for:
- React + Vite
- Firebase Services
- OpenAI Integration
- Environment Variables

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Frontend
        App["React Application"]
        AuthContext["Authentication Context"]
        ProtectedRoutes["Protected Routes"]
        
        subgraph Pages
            Home["Home Page"]
            Videos["Videos List"]
            Upload["Upload Page"]
            VideoDetail["Video Detail"]
            Error["Error Page"]
        end
        
        subgraph Components
            Nav["Navigation"]
        end
        
        Config["Environment Config"]
        Entry["Application Entry"]
        Styles["Global Styles"]
        BuildConfig["Build Configuration"]
    end
    
    subgraph "Cloud Services"
        FireAuth["Firebase Auth"]
        Firestore[(Firestore DB)]
        OpenAI["OpenAI API"]
    end
    
    subgraph "Storage"
        FireStorage[(Firebase Storage)]
    end
    
    %% Connections
    App --> AuthContext
    AuthContext --> ProtectedRoutes
    ProtectedRoutes --> Pages
    App --> Components
    Entry --> App
    
    AuthContext -.-> FireAuth
    App --> Firestore
    App --> FireStorage
    App --> OpenAI
    
    %% Click events
    click App "https://github.com/phptuts/react-video-analyzer-frontend/blob/main/src/App.jsx"
    click AuthContext "https://github.com/phptuts/react-video-analyzer-frontend/blob/main/src/context/auth.context.jsx"
    click ProtectedRoutes "https://github.com/phptuts/react-video-analyzer-frontend/blob/main/src/components/Protected.jsx"
    click Nav "https://github.com/phptuts/react-video-analyzer-frontend/blob/main/src/components/Nav.jsx"
    click Home "https://github.com/phptuts/react-video-analyzer-frontend/blob/main/src/pages/Home.jsx"
    click Videos "https://github.com/phptuts/react-video-analyzer-frontend/blob/main/src/pages/Videos.jsx"
    click Upload "https://github.com/phptuts/react-video-analyzer-frontend/blob/main/src/pages/Upload.jsx"
    click VideoDetail "https://github.com/phptuts/react-video-analyzer-frontend/blob/main/src/pages/Video.jsx"
    click Error "https://github.com/phptuts/react-video-analyzer-frontend/blob/main/src/pages/ErrorPage.jsx"
    click Entry "https://github.com/phptuts/react-video-analyzer-frontend/blob/main/src/main.jsx"
    click Config "https://github.com/phptuts/react-video-analyzer-frontend/blob/main/.env-example"
    click Styles "https://github.com/phptuts/react-video-analyzer-frontend/blob/main/src/index.css"
    click BuildConfig "https://github.com/phptuts/react-video-analyzer-frontend/blob/main/vite.config.js"
    
    %% Styling
    classDef frontend fill:#a8d1ff
    classDef auth fill:#ffd7a8
    classDef storage fill:#fff3a8
    classDef api fill:#a8ffc1
    
    class App,AuthContext,ProtectedRoutes,Pages,Components,Config,Entry,Styles,BuildConfig frontend
    class FireAuth auth
    class FireStorage storage
    class OpenAI,Firestore api
    
    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Auth["Auth Service"]:::auth
        Storage["Storage Service"]:::storage
        API["API Service"]:::api
    end
```
