# streamethorg/streameth-platform architecture

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

- Interactive diagram: https://gitdiagram.com/streamethorg/streameth-platform
- Repository: https://github.com/streamethorg/streameth-platform

## Overview

- Frontend Application (Client/UI):
– Located in the “packages/app” directory (a Next.js project with pages for legal, event sessions, livestream, studio, etc.).
– This module serves both the public-facing website (streameth.org) and the interactive studio/web app (streameth.org/studio).
- Backend Server/API:
– Found in “packages/server”, this is where the bulk of the REST/GraphQL API logic lives, with controllers (auth, chat, event, speaker, schedule, etc.), services, middleware, and database integrations.
– It orchestrates authentication, event management, payment processing, websocket/real-time chat and other API endpoints.
- Blockchain/Smart Contracts:
– Present in “packages/contracts”, including Hardhat configuration and Solidity contracts.
– This module handles on-chain interactions (likely for NFT functionalities and possibly for micromanaging event assets).
- Content & Video Processing Services:
– “packages/video-uploader” – This package handles video processing and uploading, with dedicated scripts and Docker configurations.
– Worker services under “packages/server/workers” (like session-transcriptions, stage-transcriptions, video-importer, and clips) handle background tasks (transcribing video/audio, processing clips, etc.).
- Reel Creator Module:
– Provided in “packages/reel-creator”, built with Remotion and other UI components for content creation/editing.
– This distinctive functionality supports a creative pipeline for generating marketing or event recap videos.
- Supporting Assets & Configurations:
– Various Docker Compose files for different deployment environments.
– GitHub workflows, linting, testing scripts, and CI/CD configurations assist in deployment and quality assurance.

##### Data Flow & Interactions
- Client Interaction:
– The frontend (Next.js “app”) interacts with users for event booking, live streaming sessions, chat, and video viewing.
– API calls from the frontend will hit the “server” API endpoints over HTTP/HTTPS.
- Backend Processing:
– The server handles business logic (authentication, event management, payment processing via Stripe, user management, etc.) and then communicates with worker modules.
– Data passes between controllers and services that may in turn trigger background processes/workers (often via messaging, possibly Redis-based communication, which you may want to note even if not explicitly configured).
- Worker Services:
– Dedicated worker processes (in “packages/server/workers” and “packages/video-uploader”) perform time-consuming tasks like video upload, transcoding, transcription, and clip processing.
- Blockchain Integration:
– The “contracts” module interacts with the blockchain to deploy and interact with on-chain NFT collections or other smart contract-based features integrated into event functionalities.
- Reel Creation:
– The reel creator module works independently as a media editing tool that can interact with the rest of the platform (for instance, by pulling event videos from storage and pushing finished reels back).

##### Architectural Patterns & Design Principles
- Modular Monorepo Structure:
– Each package is developed as its own module (frontend, backend, blockchain, content creation, etc.)—this encourages separation of concerns.
- Microservices / Worker Architecture:
– The backend server and worker processes (video uploader, transcription, clip processing) follow a microservice / task-based model.
- API-Centric Communication:
– Use clear RESTful endpoints (or similar) with well-defined DTOs and service layers as seen in the “server” package.
- Containerized Deployments:
– The various Docker and docker-compose files indicate containerization for development and production, influencing how deployment architecture is diagrammed.
- Integration with External Services:
– Note integrations with third party APIs (Google for drive and auth, Twitter, Stripe for payments, and potentially Livepeer for streaming).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Nodes
    FE["Frontend (Next.js App)"]:::frontend
    BE["Backend API Server"]:::backend
    BC["Blockchain/Smart Contracts"]:::blockchain
    VU["Video Uploader"]:::workers
    WS["Worker Services"]:::workers
    RC["Reel Creator Service"]:::reel
    DB["Database"]:::storage
    FS["File Storage"]:::storage
    ST["Stripe"]:::external
    GG["Google"]:::external
    TW["Twitter"]:::external
    LP["Livepeer"]:::external

    %% Connections
    FE -->|"API_Request"| BE
    BE -->|"Response"| FE

    BE -->|"async"| WS
    BE -->|"trigger_video"| VU

    BE -->|"contract_call"| BC

    BE -->|"payment_auth"| ST
    BE -->|"drive_auth"| GG
    BE -->|"social"| TW
    BE -->|"stream_req"| LP

    BE -->|"store_data"| DB

    WS -->|"save_media"| FS
    RC -->|"media_sync"| FS

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#0066cc,stroke-width:2px;
    classDef backend fill:#d4edda,stroke:#28a745,stroke-width:2px;
    classDef blockchain fill:#fff3cd,stroke:#ffc107,stroke-width:2px;
    classDef workers fill:#f8d7da,stroke:#dc3545,stroke-width:2px;
    classDef reel fill:#e2e3f3,stroke:#6f42c1,stroke-width:2px;
    classDef external fill:#f1f1f1,stroke:#333333,stroke-width:2px;
    classDef storage fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;

    %% Click Events
    click FE "https://github.com/streamethorg/streameth-platform/tree/develop/packages/app"
    click BE "https://github.com/streamethorg/streameth-platform/tree/develop/packages/server"
    click BC "https://github.com/streamethorg/streameth-platform/tree/develop/packages/contracts"
    click VU "https://github.com/streamethorg/streameth-platform/tree/develop/packages/video-uploader"
    click WS "https://github.com/streamethorg/streameth-platform/tree/develop/packages/server/workers"
    click RC "https://github.com/streamethorg/streameth-platform/tree/develop/packages/reel-creator"
```
