# bigbluebutton/greenlight architecture

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

- Interactive diagram: https://gitdiagram.com/bigbluebutton/greenlight
- Repository: https://github.com/bigbluebutton/greenlight

## Overview

##### Main System Components

a. Frontend Layer:
- React-based SPA (located in /app/javascript)
- Key modules:
- User Management
- Room Management
- Recording Management
- Admin Panel
- Authentication System

b. Backend Layer:
- Ruby on Rails API (located in /app/controllers/api/v1)
- Key services:
- BigBlueButton Integration Service
- User Management Service
- Recording Management Service
- Meeting Management Service

c. Data Layer:
- Database (PostgreSQL based on config/database.yml)
- Active Storage for file handling
- External Storage for recordings

d. External Services:
- BigBlueButton Server
- Email Service
- Storage Service

##### Component Relationships

**Client Layer → API Layer → Service Layer → Data Layer**
- ↓             ↓
- External Services  BigBlueButton Server

##### Detailed Component Breakdown

- Blue: Frontend components
- Green: Backend API endpoints
- Yellow: Services
- Red: External systems
- Purple: Data stores

##### Key Workflows to Highlight

Critical paths:
- User Authentication Flow
- Room Creation and Management
- Meeting Start/Join Flow
- Recording Management Flow
- Admin Management Flow

##### Specific Implementation Details

Technical elements:
- WebSocket connections (Action Cable)
- API Routes structure
- Service-based architecture
- Multi-tenant support
- Role-based access control

##### Architectural Patterns to Emphasize

Patterns:
- MVC Architecture (Backend)
- Component-based Architecture (Frontend)
- Service-oriented Architecture
- RESTful API design
- Event-driven architecture (WebSocket)

##### Security Layer

Security components:
- Authentication system
- Authorization (Role Permissions)
- API security
- Session management

##### Integration Points

Clearly mark:
- BigBlueButton API integration
- Storage service integration
- Email service integration
- External authentication providers

Key Considerations:
- Technical details but avoid overwhelming complexity
- Use clear labeling and consistent notation
- Both synchronous and asynchronous communication paths
- Scalability points and potential bottlenecks

This system design should reflect Greenlight's nature as a modern web application that serves as a management interface for BigBlueButton, emphasizing its role in handling user management, room coordination, and recording management while integrating with external services.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef api fill:#2ecc71,stroke:#27ae60,color:white
    classDef service fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#e74c3c,stroke:#c0392b,color:white
    classDef data fill:#9b59b6,stroke:#8e44ad,color:white
    classDef security fill:#34495e,stroke:#2c3e50,color:white

    %% Frontend Layer
    subgraph Frontend
        FE[React SPA]
        UserMgmt[User Management]
        RoomMgmt[Room Management]
        RecMgmt[Recording Management]
        AdminPanel[Admin Panel]
        AuthUI[Authentication UI]
        WSClient[WebSocket Client]
    end

    %% API Layer
    subgraph API
        UserAPI[User API]
        RoomAPI[Room API]
        RecAPI[Recording API]
        MeetingAPI[Meeting API]
        SessionAPI[Session API]
        WSServer[WebSocket Server]
    end

    %% Service Layer
    subgraph Services
        BBBService[BBB Integration]
        MeetingService[Meeting Service]
        RecordingService[Recording Service]
        UserService[User Service]
        AuthService[Auth Service]
        PermissionService[Permission Service]
    end

    %% Data Layer
    subgraph Data
        DB[(PostgreSQL)]
        Storage[(Active Storage)]
        RecStorage[(Recording Storage)]
    end

    %% External Services
    subgraph External
        BBBServer[BBB Server]
        EmailService[Email Service]
        StorageService[Storage Service]
    end

    %% Relationships
    FE --> UserMgmt & RoomMgmt & RecMgmt & AdminPanel & AuthUI
    WSClient --> WSServer
    
    UserMgmt --> UserAPI
    RoomMgmt --> RoomAPI
    RecMgmt --> RecAPI
    AdminPanel --> UserAPI & RoomAPI & RecAPI
    AuthUI --> SessionAPI

    UserAPI --> UserService
    RoomAPI --> MeetingService
    RecAPI --> RecordingService
    SessionAPI --> AuthService
    
    UserService --> DB
    MeetingService --> DB
    RecordingService --> RecStorage
    AuthService --> DB
    
    BBBService --> BBBServer
    UserService --> EmailService
    RecordingService --> StorageService

    %% Click Events
    click UserMgmt "https://github.com/bigbluebutton/greenlight/tree/master/app/javascript/components/users/"
    click RoomMgmt "https://github.com/bigbluebutton/greenlight/tree/master/app/javascript/components/rooms/"
    click RecMgmt "https://github.com/bigbluebutton/greenlight/tree/master/app/javascript/components/recordings/"
    click AdminPanel "https://github.com/bigbluebutton/greenlight/tree/master/app/javascript/components/admin/"
    click AuthUI "https://github.com/bigbluebutton/greenlight/tree/master/app/javascript/components/users/authentication/"
    click WSClient "https://github.com/bigbluebutton/greenlight/blob/master/app/javascript/channels/rooms_channel.jsx"
    
    click UserAPI "https://github.com/bigbluebutton/greenlight/blob/master/app/controllers/api/v1/users_controller.rb"
    click RoomAPI "https://github.com/bigbluebutton/greenlight/blob/master/app/controllers/api/v1/rooms_controller.rb"
    click RecAPI "https://github.com/bigbluebutton/greenlight/blob/master/app/controllers/api/v1/recordings_controller.rb"
    click MeetingAPI "https://github.com/bigbluebutton/greenlight/blob/master/app/controllers/api/v1/meetings_controller.rb"
    click SessionAPI "https://github.com/bigbluebutton/greenlight/blob/master/app/controllers/api/v1/sessions_controller.rb"
    click WSServer "https://github.com/bigbluebutton/greenlight/blob/master/app/channels/rooms_channel.rb"
    
    click BBBService "https://github.com/bigbluebutton/greenlight/blob/master/app/services/big_blue_button_api.rb"
    click MeetingService "https://github.com/bigbluebutton/greenlight/blob/master/app/services/meeting_starter.rb"
    click RecordingService "https://github.com/bigbluebutton/greenlight/blob/master/app/services/recording_creator.rb"
    click UserService "https://github.com/bigbluebutton/greenlight/blob/master/app/services/user_creator.rb"
    click PermissionService "https://github.com/bigbluebutton/greenlight/blob/master/app/services/permissions_checker.rb"
    
    click EmailService "https://github.com/bigbluebutton/greenlight/blob/master/app/mailers/user_mailer.rb"
    
    %% Styling
    class FE,UserMgmt,RoomMgmt,RecMgmt,AdminPanel,AuthUI,WSClient frontend
    class UserAPI,RoomAPI,RecAPI,MeetingAPI,SessionAPI,WSServer api
    class BBBService,MeetingService,RecordingService,UserService,AuthService,PermissionService service
    class BBBServer,EmailService,StorageService external
    class DB,Storage,RecStorage data
```
