4.7 KiB
4.7 KiB
Multi-Platform Chat Overlay Development Plan (v3)
This document outlines the development plan for a multi-user, web-based chat overlay service.
1. Project Overview
The goal is to create a service where streamers can log in using their platform accounts (Twitch, YouTube), configure a personalized chat overlay, and use it in their streaming software (e.g., OBS). The service will aggregate chat from their connected accounts and provide moderation tools.
2. Architecture
The system will be a web application with a Python backend and a web-based frontend.
-
Python Backend (FastAPI):
- Manages user authentication (OAuth2 for Twitch and YouTube).
- Stores user data, configuration, and encrypted access tokens in a database (SQLite initially).
- Provides a REST API for the frontend to manage user settings.
- Dynamically starts, stops, and manages chat listener processes for active users.
- Runs a WebSocket server to broadcast chat messages to the correct user's overlay.
-
Frontend (HTML/CSS/JavaScript):
- Login Page: Allows users to sign in with their Twitch or YouTube accounts.
- Dashboard: A secure area for users to manage their connected accounts, configure their overlay, and get their unique overlay URL.
- Web Overlay: The customizable chat display, loaded as a Browser Source in OBS.
3. Technology Stack
-
Backend:
- Language: Python 3.9+
- Web Framework: FastAPI
- Database: SQLite with SQLAlchemy
- Authentication: OAuth2 (via
httpxor a similar library) - Chat Listeners:
pytchat(YouTube),TwitchIO(Twitch)
-
Frontend:
- Markup/Styling: HTML5, CSS3
- JavaScript: Vanilla JavaScript
- Communication: Fetch API, WebSockets
4. Implementation Roadmap
Phase 1: User Authentication & Database
- Database Setup:
- Initialize a SQLite database.
- Define the database schema using SQLAlchemy for a
userstable (storing profile info, channel IDs, and encrypted OAuth tokens).
- Install Dependencies: Add
SQLAlchemyand an OAuth library to the project. - OAuth2 for Twitch:
- Implement the FastAPI backend routes for Twitch login (
/login/twitch) and the callback (/auth/twitch/callback). - Securely store user profile information and tokens in the database.
- Implement the FastAPI backend routes for Twitch login (
- Login Frontend: Create a
login.htmlpage with a "Login with Twitch" button. - Session Management: Implement basic session management to keep users logged in.
Phase 2: User Dashboard & Configuration
- Dashboard UI: Create a
dashboard.htmlpage that is only accessible to logged-in users. - Display User Data: Show the user's connected Twitch account information.
- Configuration API: Create backend API endpoints for users to submit and update their settings (e.g., which chat platforms to connect, overlay appearance settings).
- Configuration Form: Add a form to the dashboard for users to manage these settings.
- Overlay URL: Generate and display a unique, persistent overlay URL for the user (e.g.,
/overlay/{user_id}).
Phase 3: Dynamic Chat Listeners & Basic Overlay
- Listener Management:
- Design a system to start and stop chat listener processes based on user activity (e.g., when a user is "live" or has the dashboard open). This may involve a background task manager.
- Refactor the existing
chat_listeners.pyto be controlled by this manager.
- User-Specific Broadcasting:
- Update the WebSocket system to route messages from a specific listener to that user's overlay instance.
- Basic User Overlay:
- When a user accesses their unique overlay URL, the backend serves the
index.htmloverlay. - The overlay connects to the WebSocket and receives only that user's chat messages.
- When a user accesses their unique overlay URL, the backend serves the
Phase 4: YouTube Integration & Advanced Features
- OAuth2 for YouTube:
- Implement the backend routes for YouTube login and callback.
- Update the database and dashboard to handle a second connected account.
- Moderator & Host Panels: Re-introduce the concepts of the Host and Moderator panels from v2, but adapted for the multi-user model. This will involve secure access and user-specific controls.
- Advanced Overlay Customization: Add more options for users to customize the look and feel of their overlay via the dashboard.
5. Requirements for Completion (Initial Version)
The project will be considered complete for its initial version when Phases 1, 2, and 3 are functional:
- Users can log in with their Twitch account.
- Users can see their unique overlay URL on a dashboard.
- The overlay successfully connects to their Twitch chat and displays messages when opened in a browser source.