Skip to content

cool9850311/StreamPlatformLite

Repository files navigation

StreamPlatformLite

Stream Platform Lite is a platform that allows any streamer to easily create their own live streaming platform, making their content and revenue not entirely dependent on major streaming platforms.

Features

Homepage & Navigation

Homepage
Clean and intuitive homepage with multi-language support

  • Simple Navigation - Easy access to live streams and authentication options
  • Discord OAuth Integration - Quick login with Discord account
  • Language Selection - Switch between English, Japanese, and Traditional Chinese

Live Streaming & Broadcasting

Live Streaming Interface
Real-time live streaming with chat and viewer count

  • RTMP Push Streaming - Stream directly from OBS or any RTMP-compatible software
  • Live Recording - Optional recording functionality to save streams as MP4 files
  • Visibility Control - Set streams as Public or Member Only
  • Real-time Viewer Count - Accurate viewer statistics with anonymous user tracking

Real-time Chat System

Chat System
Interactive chat with role-based permissions and moderation tools

  • Live Chat - WebSocket-powered real-time messaging
  • Message Filtering - Toggle between viewing all messages or admin-only
  • User Avatars - Display user identities with Discord avatars
  • Moderation Tools - Delete messages and mute users based on role permissions
  • Chat History - Redis-cached message history with pagination
  • Anonymous Chat Viewing - Allow guests to view chat without logging in

User Management & Authentication

User Management
Comprehensive user management with role-based access control

Authentication Methods:

  • Discord OAuth 2.0 - Seamless login with Discord account
  • Native Accounts - Username/password authentication for system administrators

Discord Guild Role → Platform Role Mapping

Platform roles are assigned automatically at login based on the user's roles in your Discord server. No manual role assignment needed.

Discord Side Platform Role How It's Configured
Specific Discord User ID Admin DISCORD_ADMIN_ID env var
Discord Role ID Editor System Settings → Editor Role
Discord Role ID(s) User System Settings → Stream Access Roles (multiple allowed)
In guild but no matching role Guest — (fallback)
Not in guild Login denied Discord API returns non-200; login fails

The OAuth flow requests guilds.members.read scope to read the user's server roles on every login, so role changes in Discord take effect on next login automatically.

Multi-platform membership sync via Discord Discord supports native integrations with Twitch, YouTube, and other streaming platforms that automatically grant server roles to subscribers/members. By mapping those roles to platform roles here, StreamPlatformLite indirectly inherits membership state from multiple platforms — e.g. Twitch subscribers or YouTube channel members automatically gain User access without any additional integration work.

Role-Based Access Control:

Feature Admin Editor User Guest Anonymous
Manage users and accounts
Manage livestreams
Delete chat messages ✓* ✓**
Mute users ✓*
Watch member-only streams
Send chat messages
Watch public streams
View chat messages

*Editor can only moderate User/Guest messages, not Admin/Editor messages

**Users can delete their own messages only

Admin Dashboard

Admin Dashboard
Powerful admin interface for platform management

Livestream Management:

  • Create new livestreams with unique RTMP endpoints
  • Edit stream titles, descriptions, and visibility settings
  • Manage ban/mute lists for chat moderation
  • Delete or archive past streams

Account Management:

  • Create and delete native user accounts
  • Assign user roles and permissions
  • View all registered users and their details

System Settings:

  • Map Discord Role IDs to platform roles (Editor, User/Stream Access)
  • Admin is designated by Discord User ID via environment variable
  • Changes apply on the user's next Discord login — no manual sync needed

Internationalization & Responsive Design

Responsive Design
Fully responsive design with multi-language support

  • Multi-language Support - English, Japanese, Traditional Chinese with easy language switching
  • Mobile-Optimized - Complete mobile experience with touch-friendly controls
  • Adaptive Layouts - Optimized viewing on desktop and mobile devices

Security & Performance

Security Features:

  • Double-submit CSRF protection (HMAC token via X-XSRF-TOKEN header)
  • HttpOnly cookies for JWT and anonymous viewer tokens
  • Bcrypt password encryption (10 rounds)
  • JWT-based authentication with role verification
  • CORS configuration for secure cross-origin requests
  • Security headers on all responses: CSP, X-Frame-Options, X-Content-Type-Options, HSTS, Referrer-Policy, Permissions-Policy
  • Redis-based rate limiting on all sensitive endpoints (IP and user-based)
  • Path traversal prevention on HLS file access
  • Non-root containers with minimal Linux capabilities (cap_drop: ALL)

Performance Optimizations:

  • Redis caching for chat messages and viewer counts
  • File caching for accelerated HLS playback
  • Concurrent lock mechanisms for video transcoding
  • Automatic cleanup of expired cache entries

Technical Highlights

Frontend Stack:

  • Nuxt 4 + Vue 3 (Composition API)
  • TypeScript for type safety
  • Plyr + HLS.js for professional video playback
  • SweetAlert2 for beautiful notifications

Backend Stack:

  • Go 1.26+ with Gin framework
  • PostgreSQL (split per service: go_service for streams, auth_db for accounts/auth)
  • Redis for high-speed caching and rate limiting
  • FFmpeg for video transcoding
  • JWT for secure authentication

Services:

  • go-service — livestream management, chat, HLS delivery
  • core-service — authentication, account management, Discord OAuth

Infrastructure:

  • Docker + Docker Compose for easy deployment
  • Caddy for automatic HTTPS (Let's Encrypt)
  • RTMP server for stream ingestion
  • HLS for adaptive streaming delivery

Deployment Options

StreamPlatformLite supports two deployment methods. Caddy is recommended for its simplicity and automatic HTTPS.

Option 1: Caddy (Recommended - Automatic HTTPS)

Advantages:

  • Automatic SSL certificate from Let's Encrypt
  • Auto-renewal (no manual maintenance)
  • Simpler configuration
  • Better security (backend not directly exposed)
  • HTTP/2 and HTTP/3 support out of the box

Prerequisites:

  • Docker & Docker Compose
  • Domain name with DNS A record pointing to your server
  • Ports 80, 443, and 1935 open in firewall

Setup:

  1. Clone the repositories (all four must be siblings in the same parent directory):

    git clone https://github.com/cool9850311/StreamPlatformLite.git
    git clone https://github.com/cool9850311/StreamPlatformLite-Frontend.git
    git clone https://github.com/cool9850311/StreamPlatformLite-Backend.git
    git clone https://github.com/cool9850311/StreamPlatformLite-Core.git
  2. Navigate to the project directory:

    cd StreamPlatformLite
  3. Copy the Caddy configuration files:

    cp docker-compose-caddy.yml docker-compose.yml
    cp Caddyfile.example Caddyfile
  4. Edit Caddyfile and replace example.com with your actual domain name.

  5. Update the environment variables in docker-compose.yml:

    • Replace example.com/api (go-service DOMAIN) and example.com (other fields) with your domain
    • Replace example.com/auth (core-service DOMAIN) with yourdomain.com/auth
    • Fill in Discord credentials (DISCORD_CLIENT_ID, DISCORD_CLIENT_SECRET, DISCORD_ADMIN_ID, DISCORD_GUILD_ID)
    • (See Configuration - docker-compose)
  6. Start the services:

    docker-compose up -d --build
  7. Wait 1-2 minutes for Caddy to obtain SSL certificates automatically.

Notes:

  • Certificates are stored in Docker volumes and renewed automatically
  • No manual certificate management needed
  • Access your site at https://yourdomain.com

Option 2: Nginx (Traditional Method)

Use this if:

  • You prefer manual certificate management
  • You already have SSL certificates
  • You need specific Nginx features

Setup:

  1. Clone the repositories (all four must be siblings in the same parent directory):

    git clone https://github.com/cool9850311/StreamPlatformLite.git
    git clone https://github.com/cool9850311/StreamPlatformLite-Frontend.git
    git clone https://github.com/cool9850311/StreamPlatformLite-Backend.git
    git clone https://github.com/cool9850311/StreamPlatformLite-Core.git
  2. Navigate to the project directory:

    cd StreamPlatformLite
  3. Copy the example configuration files:

    cp docker-compose-example.yml docker-compose.yml
    cp nginx.conf.example nginx.conf
  4. Update the environment variables in docker-compose.yml and nginx.conf as needed. (See Configuration - docker-compose)

  5. Replace cert & key files in certs folder with your own SSL certificates.

  6. Start the services using Docker Compose:

    docker-compose up -d --build

Local HTTPS Testing

Test the full production stack (with HTTPS, strict CSP, security headers) on your local machine using mkcert and the localtest.me domain (automatically resolves to 127.0.0.1 via public DNS — no /etc/hosts needed).

Prerequisites:

  • Docker & Docker Compose
  • mkcert: brew install mkcert

Setup:

  1. Generate a locally-trusted certificate:

    mkdir -p local/certs
    mkcert -cert-file local/certs/cert.pem -key-file local/certs/key.pem localtest.me localhost 127.0.0.1
  2. Copy the example config files:

    # Choose Caddy (recommended) or Nginx
    cp local/docker-compose.caddy.example.yml local/docker-compose.caddy.yml
    cp local/Caddyfile.example local/Caddyfile
    
    # Or for Nginx:
    cp local/docker-compose.nginx.example.yml local/docker-compose.nginx.yml
    cp local/nginx.example.conf local/nginx.conf
  3. Fill in your credentials in local/docker-compose.caddy.yml (or local/docker-compose.nginx.yml):

    • APP_SECRET_KEY
    • DISCORD_CLIENT_ID / DISCORD_CLIENT_SECRET / DISCORD_ADMIN_ID / DISCORD_GUILD_ID
  4. In the Discord Developer Portal, add https://localtest.me/auth/oauth/discord as a redirect URL.

  5. Start the stack:

    # Caddy
    docker compose -f local/docker-compose.caddy.yml up --build -d
    
    # Or Nginx
    docker compose -f local/docker-compose.nginx.yml up --build -d
  6. Access at https://localtest.me

Notes:

  • RTMP push URL is shown in the admin dashboard after creating a stream
  • Files inside local/ that contain credentials (docker-compose.caddy.yml, docker-compose.nginx.yml, Caddyfile, nginx.conf) are gitignored

Stopping the Application

To stop the services (works for both Caddy and Nginx):

docker-compose down

For more detailed information, refer to the individual repository links provided below.

Frontend

link

Backend

link

Core (Auth Service)

link

About

Stream Platform Lite is a platform that allows any streamer to easily create their own live streaming platform, making their content and revenue not entirely dependent on major streaming platforms.

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors