# dannybrian/eventpresent architecture

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

- Interactive diagram: https://gitdiagram.com/dannybrian/eventpresent
- Repository: https://github.com/dannybrian/eventpresent

## Overview

##### Client-Side Applications (Frontend Layer)
a. Audience App (web/)
b. Big Screen Presentation (web/big/)
c. Admin/Speaker App (web/admin/)
- That all use Paho MQTT client for WebSocket communication

##### Network Layer
- It handling:
a. Static asset serving
b. WebSocket/MQTT reverse proxy

##### Message Broker
- Mosquitto MQTT broker as a central component
- Authentication boundaries (adminapp, adminred, big users)
- Connection limits notation

##### Backend Processing
- Node-RED as the business logic layer
- Flows for message routing and processing
- It to Mosquitto broker

Connection Flow:
##### Message routing paths between components
- Admin → Mosquitto → Node-RED → Audience/Big Screen
- Audience → Mosquitto → Node-RED → Admin

Authentication Boundaries:
- An authentication zone around admin components
- Password-protected paths
- Anonymous audience access paths

Specific Implementation Details to Note:

##### Use clear spacing between components

Additional Considerations:
- Scaling notes (file limits for thousands of users)
- Session management (localStorage)
- Build/deployment paths
- SSL toggle points

- Blue: Client applications
- Green: Gateway/Nginx
- Red: Authentication boundaries
- Purple: Message broker
- Orange: Backend processing
- Gray: Infrastructure components

Remember to include a note about the intentionally permissive nature of the system regarding user sessions and anonymous access, as this is a key architectural decision that affects the overall design.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Layer
    subgraph Clients
        AA["Admin App"]
        BA["Big Screen App"]
        UA["Audience App"]
    end

    %% Gateway Layer
    NG["Nginx Gateway"]

    %% Message Broker Layer
    subgraph Messaging
        MB["Mosquitto MQTT Broker"]
        NR["Node-RED Processing"]
    end

    %% Connections
    AA --> NG
    BA --> NG
    UA --> NG
    NG --> MB
    MB <--> NR

    %% Authentication Zones
    subgraph AuthZone["Authentication Protected Zone"]
        MB
    end

    %% Message Flows
    AA -. "Admin Messages" .-> MB
    MB -. "State Updates" .-> BA
    UA -. "User Input" .-> MB
    MB -. "Processed Events" .-> UA

    %% Styling
    classDef client fill:#a8d1f0,stroke:#333,stroke-width:2px
    classDef gateway fill:#90EE90,stroke:#333,stroke-width:2px
    classDef broker fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef processing fill:#FFA500,stroke:#333,stroke-width:2px
    classDef authzone fill:none,stroke:#FF0000,stroke-width:2px,stroke-dasharray: 5 5

    class AA,BA,UA client
    class NG gateway
    class MB broker
    class NR processing
    class AuthZone authzone

    %% Click Events
    click AA "https://github.com/dannybrian/eventpresent/blob/main/web/admin/index.html"
    click BA "https://github.com/dannybrian/eventpresent/blob/main/web/big/index.html"
    click NG "https://github.com/dannybrian/eventpresent/blob/main/servers/nginx.conf"
    click MB "https://github.com/dannybrian/eventpresent/blob/main/servers/mosquitto.conf"
    click NR "https://github.com/dannybrian/eventpresent/blob/main/servers/flows.json"

    %% Legend
    subgraph Legend
        C1["Client Applications"]:::client
        G1["Gateway"]:::gateway
        B1["Message Broker"]:::broker
        P1["Processing"]:::processing
    end
```
