# jahid404/laravel-live-streaming architecture

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

- Interactive diagram: https://gitdiagram.com/jahid404/laravel-live-streaming
- Repository: https://github.com/jahid404/laravel-live-streaming

## Overview

##### Main Components

a) Client-Side Components:
- Broadcaster Interface (Stream Creator)
- Viewer Interface
- WebRTC Client Implementation
- Screen Sharing Module

b) Server-Side Components:
- Laravel Backend Server (Port 8000)
- Socket.io Server (Port 6001)
- WebRTC Signaling Server
- Stream Recording Service

##### Client Layer
- WebRTC adapter components
- Screen sharing capability

##### Communication Layer
- Socket.io connections
- WebRTC peer connections
- Signaling pathways

##### Server Layer
- Laravel application server
- Node.js Socket.io server
- Stream recording service

##### Specific Implementation Details

**Broadcaster → Socket.io Server → Viewers (for signaling)**
**Broadcaster ←→ Viewers (direct WebRTC connections)**
**Clients → Laravel Server (for initial page loads and authentication)**

##### Important Elements to Highlight

a) Core Features:
- Live video broadcasting
- Screen sharing capability
- Stream recording
- Audio/Video toggle functionality

b) Technical Components:
- WebRTC adapter integration
- Socket.io event system
- Laravel service provider
- View templates (stream.blade.php, watch.blade.php)

##### Additional Notes

- Annotations for port numbers (8000 for Laravel, 6001 for Socket.io)
- Network boundary if LAN configuration is included

##### Technical Specifications

Labels for:
- Required npm packages (socket.io, webrtc-adapter, wrtc)
- Laravel routes and controllers
- View template files
- Service provider integration

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef client fill:#a8d1f0,stroke:#333
    classDef server fill:#90EE90,stroke:#333
    classDef socket fill:#FFB347,stroke:#333
    classDef webrtc stroke:#9370DB,stroke-width:3px
    classDef recording fill:#D3D3D3,stroke:#333
    
    subgraph "Client Layer"
        B["Broadcaster Interface"]:::client
        V["Viewer Interface"]:::client
        WC["WebRTC Client"]:::client
        SS["Screen Sharing Module"]:::client
    end
    
    subgraph "Communication Layer"
        SIO["Socket.io Server<br/>(Port 6001)"]:::socket
        SIG["WebRTC Signaling Server"]:::socket
    end
    
    subgraph "Server Layer"
        LS["Laravel Server<br/>(Port 8000)"]:::server
        SP["Service Provider"]:::server
        SC["Stream Controller"]:::server
        RS["Recording Service"]:::recording
    end
    
    %% Connections
    B --> SIO
    V --> SIO
    B <--> V
    B --> LS
    V --> LS
    SIO --> SIG
    LS --> SP
    LS --> SC
    B --> RS
    
    %% Click Events
    click B "https://github.com/jahid404/Laravel-Live-Streaming/blob/main/resources/views/stream.blade.php"
    click V "https://github.com/jahid404/Laravel-Live-Streaming/blob/main/resources/views/watch.blade.php"
    click SIO "https://github.com/jahid404/Laravel-Live-Streaming/blob/main/server.js"
    click SP "https://github.com/jahid404/Laravel-Live-Streaming/blob/main/src/LiveStreamServiceProvider.php"
    click SC "https://github.com/jahid404/Laravel-Live-Streaming/blob/main/src/StreamController.php"
    
    %% Legend
    subgraph Legend
        C1["Client Component"]:::client
        S1["Server Component"]:::server
        SO1["Socket.io Component"]:::socket
        R1["Recording Component"]:::recording
    end
```
