# im-divxnshh/zestyhub architecture

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

- Interactive diagram: https://gitdiagram.com/im-divxnshh/zestyhub
- Repository: https://github.com/im-divxnshh/zestyhub

## Overview

##### Project type and purpose
- This is a full-stack, real-time collaboration platform (Zesty Hub) implemented as a Single Page Application (SPA) in React.
- It uses Firebase (Authentication + Firestore) as its primary backend-as-a-service and WebRTC (via a separate signalling server) for peer-to-peer video and data streaming.

##### File structure
- Top-level:
- package.json, .env, README.md, tailwind.config.js – project metadata, environment, build config
- public/ – static assets (index.html, redirects, images)
- src/ – application source code
- src/components – feature modules organized by domain (dashboardFeatures, friendChatsComps, groupChats, loginComponents)
- src/pages – route-level composites (dashboardPage, friendsChats, groupChats, loginPage)
- src/utils – cross-cutting utilities (AuthContext, PrivateRoute, firebaseConfig)
- This structure implies a component-driven design, clear separation between feature domains, and use of Context for global state/security.

##### README for additional insights
- Frontend: React.js + Tailwind CSS
- Backend: Node.js/Express (not present in this repo) + WebRTC signalling server
- Database/Auth: Firebase Authentication & Firestore
- Real-time video/data: WebRTC

##### Elements
- Clear labels for each component (e.g., “React SPA”, “Firebase Auth”, “Firestore Database”, “WebRTC Signalling Server”, “Peer A / Peer B”).
- SDK calls from SPA → Firebase services → data flows back
- WebSocket/HTTP from SPA ↔ Signalling server
- Blue rectangles for UI components (SPA)
- Yellow cloud for Auth service (Firebase Auth)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% React SPA Layer
    subgraph "React SPA" 
        direction TB
        subgraph "Routing & Entry"
            direction TB
            IDX["index.js"]:::frontend
            APP["App.js"]:::frontend
            HTML["index.html"]:::frontend
        end

        subgraph "Utilities"
            direction TB
            FIRE_CFG["firebaseConfig.js"]:::util
            AUTH_CTX["AuthContext.js"]:::util
            PVT_RT["PrivateRoute.js"]:::util
        end

        subgraph "Modules"
            direction TB
            subgraph "Login Module"
                direction TB
                L_SCREEN["LoadingScreen.js"]:::frontend
                L_PAGE["login.jsx"]:::frontend
            end

            subgraph "Dashboard Domain"
                direction TB
                subgraph "Feature Components"
                    direction TB
                    UDATA["fetchUserData/page.jsx"]:::frontend
                    D_HEADER["header/header.jsx"]:::frontend
                    D_NOTI["header/noti.jsx"]:::frontend
                    D_SETTINGS["SettingsPage.js"]:::frontend
                    D_SIDEBAR["sidebar/sidebar.jsx"]:::frontend
                end
                subgraph "Page Layouts"
                    direction TB
                    DB_DESKTOP["DesktopDb.jsx"]:::frontend
                    DB_PHONE["PhoneDb.jsx"]:::frontend
                    DB_MAIN["db.jsx"]:::frontend
                end
            end

            subgraph "Friend Chats Domain"
                direction TB
                FC_PANEL["SidePanel/side.jsx"]:::frontend
                FC_DOC_MODAL["DocumentModal.jsx"]:::frontend
                FC_RES_MODAL["ResourceModal.jsx"]:::frontend
                FC_PAGE["friendChats.jsx"]:::frontend
            end

            subgraph "Group Chats Domain"
                direction TB
                GC_PANEL["sidePanel/side.jsx"]:::frontend
                GC_DOC_MODAL["DocumentModal.jsx"]:::frontend
                GC_RES_MODAL["ResourceModal.jsx"]:::frontend
                GC_PAGE["groupChat.jsx"]:::frontend
            end
        end
    end

    %% Backend Services
    subgraph "Firebase Services"
        direction TB
        FA["Firebase Auth"]:::auth
        FS["Firestore DB"]:::db
    end

    SS["WebRTC Signalling Server"]:::server

    %% Peers
    subgraph "Browser Peers"
        direction TB
        PeerA["Peer A"]:::peer
        PeerB["Peer B"]:::peer
    end

    %% Connections
    IDX -->|"mounts"| APP
    APP -->|"uses SDK"| FA
    APP -->|"uses SDK"| FS
    APP -->|"connects"| SS
    SS -->|"signals"| APP
    PeerA -.->|"P2P Stream"| PeerB
    PeerB -.->|"P2P Stream"| PeerA

    %% Static Assets
    HTML -->|"serves"| IDX
    HTML -->|"assets"| IMG["public/images"]:::frontend

    %% Click Events
    click APP "https://github.com/im-divxnshh/zestyhub/blob/main/src/App.js"
    click IDX "https://github.com/im-divxnshh/zestyhub/blob/main/src/index.js"
    click HTML "https://github.com/im-divxnshh/zestyhub/blob/main/public/index.html"
    click FIRE_CFG "https://github.com/im-divxnshh/zestyhub/blob/main/src/utils/firebaseConfig.js"
    click AUTH_CTX "https://github.com/im-divxnshh/zestyhub/blob/main/src/utils/AuthContext.js"
    click PVT_RT "https://github.com/im-divxnshh/zestyhub/blob/main/src/utils/PrivateRoute.js"
    click L_SCREEN "https://github.com/im-divxnshh/zestyhub/blob/main/src/components/loginComponents/LoadingScreen.js"
    click L_PAGE "https://github.com/im-divxnshh/zestyhub/blob/main/src/pages/loginPage/login.jsx"
    click UDATA "https://github.com/im-divxnshh/zestyhub/blob/main/src/components/dashboardFeatures/fetchUserData/page.jsx"
    click D_HEADER "https://github.com/im-divxnshh/zestyhub/blob/main/src/components/dashboardFeatures/header/header.jsx"
    click D_NOTI "https://github.com/im-divxnshh/zestyhub/blob/main/src/components/dashboardFeatures/header/noti.jsx"
    click D_SETTINGS "https://github.com/im-divxnshh/zestyhub/blob/main/src/components/dashboardFeatures/settings/SettingsPage.js"
    click D_SIDEBAR "https://github.com/im-divxnshh/zestyhub/blob/main/src/components/dashboardFeatures/sidebar/sidebar.jsx"
    click DB_MAIN "https://github.com/im-divxnshh/zestyhub/blob/main/src/pages/dashboardPage/db.jsx"
    click DB_DESKTOP "https://github.com/im-divxnshh/zestyhub/blob/main/src/pages/dashboardPage/DesktopDb.jsx"
    click DB_PHONE "https://github.com/im-divxnshh/zestyhub/blob/main/src/pages/dashboardPage/PhoneDb.jsx"
    click FC_PANEL "https://github.com/im-divxnshh/zestyhub/blob/main/src/components/friendChatsComps/SidePanel/side.jsx"
    click FC_DOC_MODAL "https://github.com/im-divxnshh/zestyhub/blob/main/src/components/friendChatsComps/modals/DocumentModal.jsx"
    click FC_RES_MODAL "https://github.com/im-divxnshh/zestyhub/blob/main/src/components/friendChatsComps/modals/ResourceModal.jsx"
    click FC_PAGE "https://github.com/im-divxnshh/zestyhub/blob/main/src/pages/friendsChats/friendChats.jsx"
    click GC_PANEL "https://github.com/im-divxnshh/zestyhub/blob/main/src/components/groupChats/sidePanel/side.jsx"
    click GC_DOC_MODAL "https://github.com/im-divxnshh/zestyhub/blob/main/src/components/groupChats/modals/DocumentModal.jsx"
    click GC_RES_MODAL "https://github.com/im-divxnshh/zestyhub/blob/main/src/components/groupChats/modals/ResourceModal.jsx"
    click GC_PAGE "https://github.com/im-divxnshh/zestyhub/blob/main/src/pages/groupChats/groupChat.jsx"
    click TAILWIND "https://github.com/im-divxnshh/zestyhub/blob/main/tailwind.config.js"
    click IMG "https://github.com/im-divxnshh/zestyhub/tree/main/public/images/"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366D6,stroke-width:1px
    classDef util fill:#E8D0FF,stroke:#6624A4,stroke-width:1px
    classDef auth fill:#FFF4D0,stroke:#D6A600,stroke-width:1px
    classDef db fill:#D0FFD0,stroke:#24A436,stroke-width:1px
    classDef server fill:#FFE0C0,stroke:#D2691E,stroke-width:1px
    classDef peer fill:#F0F0F0,stroke:#888888,stroke-width:1px
```
