# oaciz/videocall_demo architecture

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

- Interactive diagram: https://gitdiagram.com/oaciz/videocall_demo
- Repository: https://github.com/oaciz/videocall_demo

## Overview

##### Project type and purpose
- This is a single‐page web application (SPA) built with Create React App.
- From the filenames (Chat.js, VideoCall.js, Login.js, Register.js, firebase.js), it implements real‐time chat and video calling — using Firebase as its backend (Authentication, database, hosting, etc.).

##### File structure
- Top-level:
- public/ – static HTML, manifest and robots file, served by Firebase Hosting (or any static host).
- src/ – React components, CSS, tests, and firebase configuration.
- package.json / node_modules – dependencies and scripts.
- src/firebase.json – Firebase project configuration (hosting rules, functions, database rules).
- src/firebase.js – initializes and exports Firebase services (Auth, Firestore/Realtime DB, Storage, etc.).
- src/App.js + Chat.js, VideoCall.js, Login.js, Register.js, Home.js – component boundaries indicate the main UI modules.

##### README for additional insights
- It’s a standard CRA run/build workflow.
- No custom server code – all “backend” is delegated to Firebase.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Browser
    Browser["User's Browser"]:::client

    %% Static Hosting and Assets
    subgraph "Firebase Hosting"
        HostingCloud["Firebase Hosting"]:::baas
        subgraph "Static Assets"
            HTML["index.html"]:::client
            Manifest["manifest.json"]:::client
            Robots["robots.txt"]:::client
        end
    end

    Browser -->|"GET static assets"| HostingCloud
    HostingCloud -->|Serves build files| HTML
    HostingCloud --> Manifest
    HostingCloud --> Robots

    %% React Client Application
    subgraph "React Client" 
        Index["Entry Point\n(index.js)"]:::client
        AppComp["App Component\n(App.js)"]:::client
        ErrorBoundary["Error Boundary\n(ErrorBoundary.js)"]:::client

        subgraph "Authentication Screens"
            Login["Login Component\n(Login.js)"]:::client
            Register["Register Component\n(Register.js)"]:::client
        end

        Home["Home Screen\n(Home.js)"]:::client
        Chat["Chat Feature\n(Chat.js)"]:::client
        VideoCall["Video Call Feature\n(VideoCall.js)"]:::client

        report["Report Web Vitals\n(reportWebVitals.js)"]:::client
        setup["Test Setup\n(setupTests.js)"]:::client
        AppTest["App Tests\n(App.test.js)"]:::client
    end

    HostingCloud -->|Loads SPA| Index
    Index --> AppComp
    Index --> report
    Index --> setup
    AppComp --> ErrorBoundary
    ErrorBoundary --> Login
    ErrorBoundary --> Register
    ErrorBoundary --> Home
    ErrorBoundary --> Chat
    ErrorBoundary --> VideoCall

    %% Firebase Configuration & Services
    subgraph "Firebase Services" 
        AuthCloud["Firebase Auth"]:::baas
        Database["Firestore/Realtime DB"]:::baas
        Storage["Firebase Storage"]:::baas
        Functions["Cloud Functions"]:::baas
        HostingConfig["firebase.json"]:::baas
    end

    AppComp -->|uses firebase.js| firebaseModule["Firebase Module\n(firebase.js)"]:::client
    firebaseModule -->|"Auth.signIn() / signUp()"| AuthCloud
    firebaseModule -->|"DB API (onSnapshot, add)"| Database
    firebaseModule -->|"Storage API"| Storage
    AppComp -->|"invoke()"| Functions
    HostingCloud -.-> HostingConfig

    %% Peer-to-Peer Media
    subgraph "Peer Connection"
        STUN["STUN/TURN Servers"]:::external
    end
    VideoCall -->|"SDP via DB"| Database
    VideoCall -->|"Media Stream (WebRTC)"| STUN

    %% Project Metadata & Scripts
    subgraph "Project Files"
        Pkg["package.json"]:::client
        Lock["package-lock.json"]:::client
        Readme["README.md"]:::client
    end

    %% Click Events
    click AppComp "https://github.com/oaciz/videocall_demo/blob/main/src/App.js"
    click Index "https://github.com/oaciz/videocall_demo/blob/main/src/index.js"
    click report "https://github.com/oaciz/videocall_demo/blob/main/src/reportWebVitals.js"
    click setup "https://github.com/oaciz/videocall_demo/blob/main/src/setupTests.js"
    click Login "https://github.com/oaciz/videocall_demo/blob/main/src/Login.js"
    click Register "https://github.com/oaciz/videocall_demo/blob/main/src/Register.js"
    click Home "https://github.com/oaciz/videocall_demo/blob/main/src/Home.js"
    click Chat "https://github.com/oaciz/videocall_demo/blob/main/src/Chat.js"
    click VideoCall "https://github.com/oaciz/videocall_demo/blob/main/src/VideoCall.js"
    click ErrorBoundary "https://github.com/oaciz/videocall_demo/blob/main/src/ErrorBoundary.js"
    click firebaseModule "https://github.com/oaciz/videocall_demo/blob/main/src/firebase.js"
    click HostingConfig "https://github.com/oaciz/videocall_demo/blob/main/src/firebase.json"
    click HTML "https://github.com/oaciz/videocall_demo/blob/main/public/index.html"
    click Manifest "https://github.com/oaciz/videocall_demo/blob/main/public/manifest.json"
    click Robots "https://github.com/oaciz/videocall_demo/blob/main/public/robots.txt"
    click AppTest "https://github.com/oaciz/videocall_demo/blob/main/src/App.test.js"
    click Pkg "https://github.com/oaciz/videocall_demo/blob/main/package.json"
    click Lock "https://github.com/oaciz/videocall_demo/blob/main/package-lock.json"
    click Readme "https://github.com/oaciz/videocall_demo/blob/main/README.md"

    %% Styles
    classDef client fill:#D0E6FF,stroke:#0366d6,color:#0366d6,stroke-width:1px
    classDef baas fill:#FFE5B4,stroke:#D87C00,color:#D87C00,stroke-width:1px
    classDef external fill:#D4F7DC,stroke:#2E7D32,color:#2E7D32,stroke-width:1px
```
