# ujjwalsaini07/skystream architecture

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

- Interactive diagram: https://gitdiagram.com/ujjwalsaini07/skystream
- Repository: https://github.com/ujjwalsaini07/skystream

## Overview

##### Project Type & Purpose
- SkyStream is a full-stack, real-time web application that enables instantaneous screen sharing and integrated chat without downloads.
- Frontend: React.js SPA; Backend: Firebase (Auth, Cloud Functions, Firestore); Containerization: Docker; Deployment: Vercel/Docker Compose.

##### File Structure (High-Level)
- Top level:
- Dockerfile + docker-compose.yml → container build & orchestration
- firebase.json + functions/ → Firebase backend functions
- src/, public/, index.html → React single-page application
- vite.config.js / webpack.config.js → build pipelines
- src/:
- components/ (ChatRoom, HelpCenter, common, ui, magicui) → UI modules
- pages/ → route-driven views (Home, ChatRoom, About, ContactUs, HelpCenter)
- lib/utils.js, hooks/ → shared logic and custom hooks

##### Key Insights from README
- Real-time chat + screen-sharing uses Firebase SDK for Auth, Firestore, and Cloud Functions.
- UI styling: Tailwind CSS + SCSS + ShadCN component library.
- Dockerization for local development and production deployments.

##### Core Components & Their Relationships
a. Frontend (Browser/Client)
- React SPA served via Vercel or Dockerized Node static server.
- Modules:
- UI Layer (components/ui, magicui)
- Feature Routes (pages/, components/ChatRoom, HelpCenter)
- Utilities (hooks/, lib/utils.js)
b. Backend (Firebase)
- Authentication Service (Firebase Auth)
- Real-time Database (Firestore)
- Business Logic (Cloud Functions in functions/index.js)
c. Deployment & Infrastructure
- Containerization (Dockerfile, docker-compose)
- Hosting (Vercel or custom Docker host)
- Configuration (firebase.json)
d. External Services
- Firestore for data storage
- Firebase Auth for user identity
- Vercel (optional) for CDN + global hosting

##### Architectural Patterns & Design Principles
- SPA Pattern: React router → pages/ directory
- Component-based UI → logical separation in src/components
- Feature-folder organization for ChatRoom, HelpCenter
- Serverless backend pattern → Firebase Functions handle API logic
- Infrastructure as code → docker-compose.yml + Firebase config

3. Inside host, show “React App.” Break this into:
- UI Components (pages & components folders)
- State & Hooks (hooks/, lib/)
- Firebase Auth service (sign-in)
- Firestore DB (chat messages, room data)
- Firebase Cloud Functions (createRoom, joinRoom handlers)
5. Firebase subsystem:
- Firestore accessed both by client and functions
6. Optionally, include Docker:
- docker-compose.yml linking frontend container & functions container

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User
    Browser("User's Browser")

    %% Hosting Layer
    subgraph "Static Hosting"
        Host(("Vercel / Docker Node Server"))
        ReactApp["React SPA"]:::frontend
    end

    Browser -->|"HTTP GET /index.html + bundle.js"| Host
    Host --> ReactApp

    %% React App Structure
    subgraph "React SPA Structure"
        UI["UI Components"]:::frontend
        Routes["Feature Routes"]:::frontend
        Utils["Utilities & Hooks"]:::frontend
    end

    ReactApp --> UI
    ReactApp --> Routes
    ReactApp --> Utils

    %% UI Components Details
    UI --> UICOMP["UI Component Library (ShadCN/Tailwind)"]:::frontend
    UI --> MAGIC["Magic UI Effects"]:::frontend
    UI --> COMMON["Common Layout & Error UI"]:::frontend
    UI --> CONNECTION["Connection Flow Components"]:::frontend

    %% Feature Routes Details
    subgraph "Pages & Features"
        subgraph "Standalone Pages"
            HomePage["Home Page"]:::frontend
            ChatRoomPage["ChatRoom Page"]:::frontend
            AboutPage["About Page"]:::frontend
            ContactPage["Contact Us Page"]:::frontend
            HelpPage["HelpCenter Page"]:::frontend
        end
        subgraph "ChatRoom Feature"
            AuthChk["Auth Checking"]:::frontend
            CreateCR["Create Room"]:::frontend
            JoinCR["Join Room"]:::frontend
            MainRV["Main Room View"]:::frontend
            MessagingN["Messaging"]:::frontend
            StreamWrap["Stream Chat Wrapper"]:::frontend
        end
        subgraph "HelpCenter Feature"
            HelpChat["Chat"]:::frontend
            ShareScreen["Screen Sharing"]:::frontend
        end
    end

    Routes --> HomePage
    Routes --> ChatRoomPage
    Routes --> AboutPage
    Routes --> ContactPage
    Routes --> HelpPage
    Routes --> AuthChk
    Routes --> CreateCR
    Routes --> JoinCR
    Routes --> MainRV
    Routes --> MessagingN
    Routes --> StreamWrap
    Routes --> HelpChat
    Routes --> ShareScreen

    %% Utilities & Hooks Details
    Utils --> UTILS["Utils Library"]:::frontend
    Utils --> HOOKS["Custom Hooks"]:::frontend

    %% Firebase Integration
    ReactApp -->|"Auth Flow (OAuth)"| Auth
    ReactApp -->|"Real-time Listeners"| Firestore
    ReactApp -->|"Invoke create/join handlers"| Functions

    subgraph "Firebase Services"
        Auth[FIREBASE AUTH]:::external
        Firestore[(Firestore Database)]:::db
        Functions["Cloud Functions"]:::backend
        Functions -->|"Transactional Updates"| Firestore
    end

    %% Deployment Orchestration
    subgraph "Docker Compose Cluster"
        Host
        Functions
    end

    %% Configuration Files & Build Tools
    subgraph "Config & Build"
        FirebaseCfg["firebase.json / .firebaserc"]:::config
        DockerCfg["Dockerfile / docker-compose.yml"]:::config
        BuildCfg["vite.config.js / webpack.config.js / vercel.json"]:::config
    end

    Host --- FirebaseCfg
    Functions --- FirebaseCfg
    Host --- DockerCfg
    Functions --- DockerCfg
    Host --- BuildCfg

    %% Click Events
    click ReactApp "https://github.com/ujjwalsaini07/skystream/tree/main/src/"
    click UICOMP "https://github.com/ujjwalsaini07/skystream/tree/main/src/components/ui/"
    click MAGIC "https://github.com/ujjwalsaini07/skystream/tree/main/src/components/magicui/"
    click AuthChk "https://github.com/ujjwalsaini07/skystream/blob/main/src/components/ChatRoom/AuthChecking/Auth.jsx"
    click CreateCR "https://github.com/ujjwalsaini07/skystream/blob/main/src/components/ChatRoom/CreateRoom/CreateChatRoom.jsx"
    click JoinCR "https://github.com/ujjwalsaini07/skystream/blob/main/src/components/ChatRoom/JoinRoom/JoinChatRoom.jsx"
    click MainRV "https://github.com/ujjwalsaini07/skystream/blob/main/src/components/ChatRoom/MainRoom/MainSection.jsx"
    click MessagingN "https://github.com/ujjwalsaini07/skystream/blob/main/src/components/ChatRoom/Messaging/ChatMessaging.jsx"
    click StreamWrap "https://github.com/ujjwalsaini07/skystream/blob/main/src/components/ChatRoom/StreamChat.jsx"
    click HelpChat "https://github.com/ujjwalsaini07/skystream/blob/main/src/components/HelpCenter/Chat.jsx"
    click ShareScreen "https://github.com/ujjwalsaini07/skystream/blob/main/src/components/HelpCenter/ShareScreen.jsx"
    click COMMON "https://github.com/ujjwalsaini07/skystream/tree/main/src/components/common/"
    click CONNECTION "https://github.com/ujjwalsaini07/skystream/tree/main/src/components/connection/"
    click HomePage "https://github.com/ujjwalsaini07/skystream/blob/main/src/pages/Home.jsx"
    click ChatRoomPage "https://github.com/ujjwalsaini07/skystream/blob/main/src/pages/ChatRoom.jsx"
    click AboutPage "https://github.com/ujjwalsaini07/skystream/blob/main/src/pages/About.jsx"
    click ContactPage "https://github.com/ujjwalsaini07/skystream/blob/main/src/pages/ContactUs.jsx"
    click HelpPage "https://github.com/ujjwalsaini07/skystream/blob/main/src/pages/HelpCenter.jsx"
    click HOOKS "https://github.com/ujjwalsaini07/skystream/blob/main/src/hooks/use-toast.js"
    click UTILS "https://github.com/ujjwalsaini07/skystream/blob/main/src/lib/utils.js"
    click Functions "https://github.com/ujjwalsaini07/skystream/blob/main/functions/index.js"
    click FirebaseCfg "https://github.com/ujjwalsaini07/skystream/blob/main/firebase.json"
    click DockerCfg "https://github.com/ujjwalsaini07/skystream/blob/main/docker-compose.yml"
    click BuildCfg "https://github.com/ujjwalsaini07/skystream/blob/main/vite.config.js"

    %% Styles
    classDef frontend fill:#e0f7fa,stroke:#006064,color:#004d40
    classDef db fill:#e8f5e9,stroke:#2e7d32,color:#1b5e20
    classDef backend fill:#fff3e0,stroke:#ef6c00,color:#e65100
    classDef external fill:#eceff1,stroke:#90a4ae,color:#37474f
    classDef config fill:#f3e5f5,stroke:#6a1b9a,color:#4a148c
```
