Major: Add complete platform architecture with full data models
- Add Prisma schema with all database models - Creator channels, streams, VOD, clips, monetization - Real-time chat, polls, interactions - Subscriptions, donations, payouts - Social graph (followers), clips, leaderboards - Complete Platform Architecture documentation - API structure and routes documentation - Implementation roadmap (8 phases) - Updated README with platform vision - Install core dependencies: Prisma, Clerk, Stripe, Socket.io Ready for Phase 1 development with database setup.
This commit is contained in:
parent
27a173578a
commit
58d231e72f
8 changed files with 2879 additions and 25 deletions
75
README.md
75
README.md
|
|
@ -1,17 +1,78 @@
|
||||||
# AeThex Live
|
# AeThex Live
|
||||||
|
|
||||||
A modern live streaming platform built with Next.js, featuring HLS video playback, real-time chat, and a sleek sci-fi aesthetic.
|
**A complete creator streaming platform** - Multi-channel streaming, community features, creator monetization, gaming tournaments, music/DJ tools, and enterprise streaming all in one.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Features
|
## 🎯 Platform Vision
|
||||||
|
|
||||||
- 🎥 **HLS Video Player** - Looping video player with hls.js support
|
AeThex LIVE combines the best of Twitch, YouTube Live, Discord, and creator platforms:
|
||||||
|
|
||||||
|
- 🎬 **Multi-channel Streaming** - Creators manage multiple streaming channels
|
||||||
|
- 💬 **Real-time Community** - Live chat, reactions, gifting, polls, and moderation
|
||||||
|
- 💰 **Creator Monetization** - Subscriptions, donations, tips, and direct payouts
|
||||||
|
- 🎮 **Gaming/Esports** - Tournaments, leaderboards, competitive rankings
|
||||||
|
- 🎵 **Music/DJ Studio** - Special audio features and visualization
|
||||||
|
- 📚 **Education/Enterprise** - Webinars, conferences, courses
|
||||||
|
- 🎯 **Engagement Tools** - Clips, highlights, trending content, recommendations
|
||||||
|
- 📊 **Creator Dashboard** - Analytics, viewer insights, revenue tracking
|
||||||
|
|
||||||
|
## ✨ Features (Roadmap)
|
||||||
|
|
||||||
|
### Phase 1: Foundation ✅ (Current)
|
||||||
|
- ✅ HLS video player with auto-recovery
|
||||||
|
- ✅ Stream hosting infrastructure
|
||||||
|
- 🔄 User authentication (Clerk)
|
||||||
|
- 🔄 Basic creator profiles
|
||||||
|
- 🔄 Real-time chat with Socket.io
|
||||||
|
|
||||||
|
### Phase 2: Social & Discovery
|
||||||
|
- Multi-channel management
|
||||||
|
- Stream discovery & search
|
||||||
|
- Follow/subscribe system
|
||||||
|
- Creator recommendations
|
||||||
|
|
||||||
|
### Phase 3: Creator Tools & VOD
|
||||||
|
- VOD archives
|
||||||
|
- Clip creation & editing
|
||||||
|
- Advanced analytics
|
||||||
|
- Stream health monitoring
|
||||||
|
|
||||||
|
### Phase 4: Monetization
|
||||||
|
- Subscriptions (tiered)
|
||||||
|
- Donations/tips
|
||||||
|
- Gifting system
|
||||||
|
- Creator payouts
|
||||||
|
|
||||||
|
### Phase 5: Community & Engagement
|
||||||
|
- Live polls
|
||||||
|
- Reactions & emotes
|
||||||
|
- Channel points
|
||||||
|
- Moderation tools
|
||||||
|
|
||||||
|
### Phase 6: Gaming/Esports
|
||||||
|
- Tournaments
|
||||||
|
- Leaderboards
|
||||||
|
- Match tracking
|
||||||
|
- Competitive rankings
|
||||||
|
|
||||||
|
### Phase 7: Music/DJ Features
|
||||||
|
- DJ studio mode
|
||||||
|
- Audio visualization
|
||||||
|
- Music library
|
||||||
|
- Spotify integration
|
||||||
|
|
||||||
|
### Phase 8: Enterprise/Education
|
||||||
|
- Webinar features
|
||||||
|
- Screen sharing
|
||||||
|
- Course creation
|
||||||
|
- Certificate generation
|
||||||
|
|
||||||
|
- 🎥 **HLS Video Player** - High-quality streaming with hls.js support
|
||||||
- 🎨 **Sci-Fi Dark Theme** - Immersive dark theme with cyan/blue accents
|
- 🎨 **Sci-Fi Dark Theme** - Immersive dark theme with cyan/blue accents
|
||||||
- 👥 **Live Viewer Count** - Real-time viewer count with animated indicator
|
- 👥 **Live Viewer Count** - Real-time viewer tracking
|
||||||
- 💬 **Chat Sidebar** - Interactive chat interface for viewer engagement
|
- 💬 **Chat Sidebar** - Interactive community chat
|
||||||
- 🎵 **Now Playing** - Metadata display for current track/content
|
- 📱 **Responsive Design** - Desktop and mobile optimized
|
||||||
- 📱 **Responsive Design** - Works seamlessly on desktop and mobile
|
|
||||||
|
|
||||||
## Tech Stack
|
## Tech Stack
|
||||||
|
|
||||||
|
|
|
||||||
175
docs/API_STRUCTURE.md
Normal file
175
docs/API_STRUCTURE.md
Normal file
|
|
@ -0,0 +1,175 @@
|
||||||
|
# AeThex LIVE - API Structure
|
||||||
|
|
||||||
|
## API Routes
|
||||||
|
|
||||||
|
### Authentication
|
||||||
|
- `POST /api/auth/register` - Create account
|
||||||
|
- `POST /api/auth/login` - Login
|
||||||
|
- `POST /api/auth/logout` - Logout
|
||||||
|
- `GET /api/auth/me` - Get current user
|
||||||
|
- `POST /api/auth/refresh` - Refresh token
|
||||||
|
|
||||||
|
### Users
|
||||||
|
- `GET /api/users/:id` - Get user profile
|
||||||
|
- `PATCH /api/users/:id` - Update profile
|
||||||
|
- `GET /api/users/:id/followers` - Get user followers
|
||||||
|
- `POST /api/users/:username/follow` - Follow user
|
||||||
|
- `DELETE /api/users/:username/follow` - Unfollow user
|
||||||
|
- `GET /api/users/:id/stats` - User statistics
|
||||||
|
|
||||||
|
### Channels
|
||||||
|
- `POST /api/channels` - Create channel
|
||||||
|
- `GET /api/channels/:slug` - Get channel
|
||||||
|
- `PATCH /api/channels/:id` - Update channel
|
||||||
|
- `DELETE /api/channels/:id` - Delete channel
|
||||||
|
- `GET /api/channels/:id/streams` - Get channel streams
|
||||||
|
- `GET /api/channels/:id/followers` - Get followers
|
||||||
|
- `POST /api/channels/:id/follow` - Follow channel
|
||||||
|
- `DELETE /api/channels/:id/follow` - Unfollow channel
|
||||||
|
- `GET /api/channels/:id/analytics` - Channel analytics
|
||||||
|
- `GET /api/channels/:id/settings` - Channel settings
|
||||||
|
- `PATCH /api/channels/:id/settings` - Update settings
|
||||||
|
|
||||||
|
### Streams & Live
|
||||||
|
- `POST /api/streams` - Create/start stream
|
||||||
|
- `GET /api/streams/:id` - Get stream details
|
||||||
|
- `PATCH /api/streams/:id` - Update stream
|
||||||
|
- `DELETE /api/streams/:id` - End stream
|
||||||
|
- `GET /api/streams/:id/viewers` - Get viewer count
|
||||||
|
- `POST /api/streams/:id/webhooks` - Stream webhooks (from provider)
|
||||||
|
- `GET /api/browse` - Browse live streams
|
||||||
|
- `GET /api/search` - Search streams
|
||||||
|
- `GET /api/recommended` - Recommended streams
|
||||||
|
|
||||||
|
### Chat (Real-time via Socket.io)
|
||||||
|
- `socket.emit('join-stream', {streamId})` - Join chat
|
||||||
|
- `socket.emit('send-message', {message})` - Send message
|
||||||
|
- `socket.emit('delete-message', {messageId})` - Delete message
|
||||||
|
- `socket.on('new-message', handler)` - Receive messages
|
||||||
|
- `socket.on('user-joined', handler)` - User joined
|
||||||
|
- `socket.on('user-left', handler)` - User left
|
||||||
|
|
||||||
|
### VOD & Archives
|
||||||
|
- `GET /api/vods/:id` - Get VOD
|
||||||
|
- `GET /api/channels/:id/vods` - Get channel VODs
|
||||||
|
- `GET /api/vods/:id/progress` - Get watch progress
|
||||||
|
- `POST /api/vods/:id/progress` - Save watch progress
|
||||||
|
- `POST /api/vods/:id/report` - Report VOD
|
||||||
|
|
||||||
|
### Clips
|
||||||
|
- `POST /api/clips` - Create clip
|
||||||
|
- `GET /api/clips/:id` - Get clip
|
||||||
|
- `PATCH /api/clips/:id` - Update clip
|
||||||
|
- `DELETE /api/clips/:id` - Delete clip
|
||||||
|
- `GET /api/channels/:id/clips` - Get channel clips
|
||||||
|
- `POST /api/clips/:id/like` - Like clip
|
||||||
|
- `DELETE /api/clips/:id/like` - Unlike clip
|
||||||
|
- `GET /api/clips/trending` - Trending clips
|
||||||
|
|
||||||
|
### Monetization
|
||||||
|
- `POST /api/subscriptions` - Create subscription
|
||||||
|
- `GET /api/subscriptions/me` - Get my subscriptions
|
||||||
|
- `DELETE /api/subscriptions/:id` - Cancel subscription
|
||||||
|
- `POST /api/donations` - Create donation
|
||||||
|
- `GET /api/donations/me` - My donations
|
||||||
|
- `GET /api/channels/:id/revenue` - Channel revenue
|
||||||
|
- `GET /api/payouts` - Get payouts
|
||||||
|
- `POST /api/payouts/request` - Request payout
|
||||||
|
|
||||||
|
### Interactions
|
||||||
|
- `POST /api/polls` - Create poll
|
||||||
|
- `GET /api/polls/:id` - Get poll
|
||||||
|
- `POST /api/polls/:id/vote` - Vote on poll
|
||||||
|
- `POST /api/reactions` - Send reaction
|
||||||
|
- `POST /api/gifts` - Send gift
|
||||||
|
|
||||||
|
### Gaming/Tournaments
|
||||||
|
- `POST /api/tournaments` - Create tournament
|
||||||
|
- `GET /api/tournaments/:id` - Get tournament
|
||||||
|
- `POST /api/tournaments/:id/join` - Join tournament
|
||||||
|
- `GET /api/leaderboards/:name` - Get leaderboard
|
||||||
|
- `GET /api/leaderboards/:name/entries/:userId` - Get user rank
|
||||||
|
|
||||||
|
### Moderation
|
||||||
|
- `GET /api/moderation/queue` - Get mod queue
|
||||||
|
- `POST /api/moderation/queue/:id/approve` - Approve
|
||||||
|
- `POST /api/moderation/queue/:id/reject` - Reject
|
||||||
|
- `POST /api/channels/:id/bans` - Ban user
|
||||||
|
- `DELETE /api/channels/:id/bans/:userId` - Unban user
|
||||||
|
- `GET /api/channels/:id/bans` - Get bans
|
||||||
|
|
||||||
|
## Real-time Events (Socket.io)
|
||||||
|
|
||||||
|
### Stream Events
|
||||||
|
- `stream:started` - Stream went live
|
||||||
|
- `stream:ended` - Stream ended
|
||||||
|
- `stream:updated` - Stream metadata changed
|
||||||
|
- `viewers:updated` - Viewer count changed
|
||||||
|
- `viewers:joined` - User joined stream
|
||||||
|
- `viewers:left` - User left stream
|
||||||
|
|
||||||
|
### Chat Events
|
||||||
|
- `chat:message` - New chat message
|
||||||
|
- `chat:deleted` - Message deleted
|
||||||
|
- `chat:cleared` - Chat cleared
|
||||||
|
- `chat:emote` - Emote sent
|
||||||
|
- `chat:ban` - User banned
|
||||||
|
|
||||||
|
### Interaction Events
|
||||||
|
- `poll:created` - Poll started
|
||||||
|
- `poll:voted` - Someone voted
|
||||||
|
- `poll:ended` - Poll ended
|
||||||
|
- `reaction:sent` - Reaction/emote displayed
|
||||||
|
- `gift:sent` - Gift displayed to chat
|
||||||
|
|
||||||
|
### Monetization Events
|
||||||
|
- `subscription:new` - New subscriber
|
||||||
|
- `donation:received` - Donation received
|
||||||
|
- `milestone:reached` - Milestone (100 followers, etc.)
|
||||||
|
|
||||||
|
## WebSocket Message Format
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"type": "event_type",
|
||||||
|
"payload": {
|
||||||
|
// Event-specific data
|
||||||
|
},
|
||||||
|
"timestamp": "2026-02-07T12:00:00Z"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Error Responses
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": true,
|
||||||
|
"code": "ERROR_CODE",
|
||||||
|
"message": "Human readable message",
|
||||||
|
"status": 400
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Rate Limiting
|
||||||
|
|
||||||
|
- Public endpoints: 100 req/min per IP
|
||||||
|
- Authenticated endpoints: 300 req/min per user
|
||||||
|
- Streaming endpoints: 50 req/min
|
||||||
|
- Chat: 5 messages/10 seconds per user
|
||||||
|
|
||||||
|
## Pagination
|
||||||
|
|
||||||
|
```
|
||||||
|
GET /api/resource?page=1&limit=20
|
||||||
|
```
|
||||||
|
|
||||||
|
Response:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"data": [...],
|
||||||
|
"total": 100,
|
||||||
|
"page": 1,
|
||||||
|
"limit": 20,
|
||||||
|
"hasMore": true
|
||||||
|
}
|
||||||
|
```
|
||||||
382
docs/DATABASE_SCHEMA.md
Normal file
382
docs/DATABASE_SCHEMA.md
Normal file
|
|
@ -0,0 +1,382 @@
|
||||||
|
# Database Schema for AeThex LIVE
|
||||||
|
|
||||||
|
## Users & Authentication
|
||||||
|
|
||||||
|
```sql
|
||||||
|
-- Users table
|
||||||
|
CREATE TABLE users (
|
||||||
|
id UUID PRIMARY KEY,
|
||||||
|
username VARCHAR(255) UNIQUE NOT NULL,
|
||||||
|
email VARCHAR(255) UNIQUE NOT NULL,
|
||||||
|
display_name VARCHAR(255),
|
||||||
|
bio TEXT,
|
||||||
|
avatar_url VARCHAR(255),
|
||||||
|
banner_url VARCHAR(255),
|
||||||
|
is_creator BOOLEAN DEFAULT false,
|
||||||
|
verified BOOLEAN DEFAULT false,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
-- User settings
|
||||||
|
CREATE TABLE user_settings (
|
||||||
|
user_id UUID PRIMARY KEY REFERENCES users(id),
|
||||||
|
email_notifications BOOLEAN DEFAULT true,
|
||||||
|
two_factor_enabled BOOLEAN DEFAULT false,
|
||||||
|
privacy_level VARCHAR(50) DEFAULT 'public', -- public, private, friends
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Channels & Streaming
|
||||||
|
|
||||||
|
```sql
|
||||||
|
-- Channels table
|
||||||
|
CREATE TABLE channels (
|
||||||
|
id UUID PRIMARY KEY,
|
||||||
|
user_id UUID NOT NULL REFERENCES users(id),
|
||||||
|
name VARCHAR(255) NOT NULL,
|
||||||
|
slug VARCHAR(255) UNIQUE NOT NULL,
|
||||||
|
description TEXT,
|
||||||
|
category VARCHAR(100), -- gaming, music, education, etc.
|
||||||
|
language VARCHAR(50),
|
||||||
|
is_live BOOLEAN DEFAULT false,
|
||||||
|
total_views BIGINT DEFAULT 0,
|
||||||
|
follower_count INT DEFAULT 0,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Streams (live sessions)
|
||||||
|
CREATE TABLE streams (
|
||||||
|
id UUID PRIMARY KEY,
|
||||||
|
channel_id UUID NOT NULL REFERENCES channels(id),
|
||||||
|
title VARCHAR(255) NOT NULL,
|
||||||
|
description TEXT,
|
||||||
|
status VARCHAR(50), -- live, ended, scheduled
|
||||||
|
stream_key VARCHAR(255) UNIQUE NOT NULL,
|
||||||
|
hls_url VARCHAR(255),
|
||||||
|
thumbnail_url VARCHAR(255),
|
||||||
|
viewer_count INT DEFAULT 0,
|
||||||
|
started_at TIMESTAMP,
|
||||||
|
ended_at TIMESTAMP,
|
||||||
|
duration_seconds INT,
|
||||||
|
is_archived BOOLEAN DEFAULT true,
|
||||||
|
archive_url VARCHAR(255),
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Stream tags
|
||||||
|
CREATE TABLE stream_tags (
|
||||||
|
stream_id UUID REFERENCES streams(id),
|
||||||
|
tag VARCHAR(100),
|
||||||
|
PRIMARY KEY (stream_id, tag)
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Social Features
|
||||||
|
|
||||||
|
```sql
|
||||||
|
-- Followers/Subscriptions
|
||||||
|
CREATE TABLE followers (
|
||||||
|
follower_id UUID NOT NULL REFERENCES users(id),
|
||||||
|
channel_id UUID NOT NULL REFERENCES channels(id),
|
||||||
|
follow_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
notification_enabled BOOLEAN DEFAULT true,
|
||||||
|
PRIMARY KEY (follower_id, channel_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
-- User follows
|
||||||
|
CREATE TABLE user_follows_user (
|
||||||
|
follower_id UUID NOT NULL REFERENCES users(id),
|
||||||
|
following_id UUID NOT NULL REFERENCES users(id),
|
||||||
|
follow_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY (follower_id, following_id)
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Chat & Moderation
|
||||||
|
|
||||||
|
```sql
|
||||||
|
-- Chat messages
|
||||||
|
CREATE TABLE chat_messages (
|
||||||
|
id UUID PRIMARY KEY,
|
||||||
|
stream_id UUID NOT NULL REFERENCES streams(id),
|
||||||
|
user_id UUID NOT NULL REFERENCES users(id),
|
||||||
|
message TEXT NOT NULL,
|
||||||
|
is_deleted BOOLEAN DEFAULT false,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Chat bans/moderation
|
||||||
|
CREATE TABLE chat_bans (
|
||||||
|
id UUID PRIMARY KEY,
|
||||||
|
channel_id UUID NOT NULL REFERENCES channels(id),
|
||||||
|
banned_user_id UUID NOT NULL REFERENCES users(id),
|
||||||
|
reason TEXT,
|
||||||
|
banned_until TIMESTAMP,
|
||||||
|
is_permanent BOOLEAN DEFAULT false,
|
||||||
|
created_by UUID NOT NULL REFERENCES users(id),
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Moderation queue
|
||||||
|
CREATE TABLE moderation_queue (
|
||||||
|
id UUID PRIMARY KEY,
|
||||||
|
stream_id UUID REFERENCES streams(id),
|
||||||
|
message_id UUID REFERENCES chat_messages(id),
|
||||||
|
reported_by UUID NOT NULL REFERENCES users(id),
|
||||||
|
reason VARCHAR(255),
|
||||||
|
status VARCHAR(50) DEFAULT 'pending', -- pending, approved, rejected
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Monetization
|
||||||
|
|
||||||
|
```sql
|
||||||
|
-- Subscriptions
|
||||||
|
CREATE TABLE subscriptions (
|
||||||
|
id UUID PRIMARY KEY,
|
||||||
|
subscriber_id UUID NOT NULL REFERENCES users(id),
|
||||||
|
channel_id UUID NOT NULL REFERENCES channels(id),
|
||||||
|
tier VARCHAR(50), -- basic, premium, vip
|
||||||
|
price_cents INT NOT NULL,
|
||||||
|
stripe_subscription_id VARCHAR(255),
|
||||||
|
status VARCHAR(50), -- active, cancelled, expired
|
||||||
|
started_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
ended_at TIMESTAMP,
|
||||||
|
auto_renew BOOLEAN DEFAULT true,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Donations/Tips
|
||||||
|
CREATE TABLE donations (
|
||||||
|
id UUID PRIMARY KEY,
|
||||||
|
donor_id UUID NOT NULL REFERENCES users(id),
|
||||||
|
channel_id UUID NOT NULL REFERENCES channels(id),
|
||||||
|
stream_id UUID REFERENCES streams(id),
|
||||||
|
amount_cents INT NOT NULL,
|
||||||
|
currency VARCHAR(3) DEFAULT 'USD',
|
||||||
|
message TEXT,
|
||||||
|
stripe_charge_id VARCHAR(255),
|
||||||
|
status VARCHAR(50) DEFAULT 'completed', -- pending, completed, failed
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Creator payouts
|
||||||
|
CREATE TABLE payouts (
|
||||||
|
id UUID PRIMARY KEY,
|
||||||
|
user_id UUID NOT NULL REFERENCES users(id),
|
||||||
|
amount_cents INT NOT NULL,
|
||||||
|
currency VARCHAR(3) DEFAULT 'USD',
|
||||||
|
stripe_payout_id VARCHAR(255),
|
||||||
|
status VARCHAR(50) DEFAULT 'pending', -- pending, paid, failed
|
||||||
|
period_start DATE,
|
||||||
|
period_end DATE,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Content
|
||||||
|
|
||||||
|
```sql
|
||||||
|
-- VODs (Video on Demand)
|
||||||
|
CREATE TABLE vods (
|
||||||
|
id UUID PRIMARY KEY,
|
||||||
|
stream_id UUID UNIQUE NOT NULL REFERENCES streams(id),
|
||||||
|
title VARCHAR(255),
|
||||||
|
description TEXT,
|
||||||
|
thumbnail_url VARCHAR(255),
|
||||||
|
duration_seconds INT,
|
||||||
|
views INT DEFAULT 0,
|
||||||
|
is_public BOOLEAN DEFAULT true,
|
||||||
|
processing_status VARCHAR(50) DEFAULT 'processing', -- processing, ready, failed
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Clips
|
||||||
|
CREATE TABLE clips (
|
||||||
|
id UUID PRIMARY KEY,
|
||||||
|
vod_id UUID REFERENCES vods(id),
|
||||||
|
stream_id UUID REFERENCES streams(id),
|
||||||
|
creator_id UUID NOT NULL REFERENCES users(id),
|
||||||
|
channel_id UUID NOT NULL REFERENCES channels(id),
|
||||||
|
title VARCHAR(255) NOT NULL,
|
||||||
|
slug VARCHAR(255) UNIQUE NOT NULL,
|
||||||
|
description TEXT,
|
||||||
|
thumbnail_url VARCHAR(255),
|
||||||
|
video_url VARCHAR(255),
|
||||||
|
start_seconds INT,
|
||||||
|
duration_seconds INT,
|
||||||
|
views INT DEFAULT 0,
|
||||||
|
likes INT DEFAULT 0,
|
||||||
|
is_public BOOLEAN DEFAULT true,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Clip reactions
|
||||||
|
CREATE TABLE clip_likes (
|
||||||
|
user_id UUID NOT NULL REFERENCES users(id),
|
||||||
|
clip_id UUID NOT NULL REFERENCES clips(id),
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY (user_id, clip_id)
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Interactions & Engagement
|
||||||
|
|
||||||
|
```sql
|
||||||
|
-- Live polls
|
||||||
|
CREATE TABLE polls (
|
||||||
|
id UUID PRIMARY KEY,
|
||||||
|
stream_id UUID NOT NULL REFERENCES streams(id),
|
||||||
|
question VARCHAR(255) NOT NULL,
|
||||||
|
duration_seconds INT,
|
||||||
|
status VARCHAR(50) DEFAULT 'active', -- active, ended
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
ended_at TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Poll options
|
||||||
|
CREATE TABLE poll_options (
|
||||||
|
id UUID PRIMARY KEY,
|
||||||
|
poll_id UUID NOT NULL REFERENCES polls(id),
|
||||||
|
option VARCHAR(255) NOT NULL,
|
||||||
|
vote_count INT DEFAULT 0
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Poll votes
|
||||||
|
CREATE TABLE poll_votes (
|
||||||
|
user_id UUID NOT NULL REFERENCES users(id),
|
||||||
|
poll_option_id UUID NOT NULL REFERENCES poll_options(id),
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY (user_id, poll_option_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Reactions/Emotes
|
||||||
|
CREATE TABLE chat_reactions (
|
||||||
|
id UUID PRIMARY KEY,
|
||||||
|
stream_id UUID NOT NULL REFERENCES streams(id),
|
||||||
|
user_id UUID NOT NULL REFERENCES users(id),
|
||||||
|
emoji VARCHAR(50),
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Gifting
|
||||||
|
CREATE TABLE gifts (
|
||||||
|
id UUID PRIMARY KEY,
|
||||||
|
gifter_id UUID NOT NULL REFERENCES users(id),
|
||||||
|
recipient_id UUID NOT NULL REFERENCES users(id),
|
||||||
|
stream_id UUID REFERENCES streams(id),
|
||||||
|
gift_type VARCHAR(50), -- custom types
|
||||||
|
amount_cents INT NOT NULL,
|
||||||
|
message TEXT,
|
||||||
|
stripe_charge_id VARCHAR(255),
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Gaming/Competitions
|
||||||
|
|
||||||
|
```sql
|
||||||
|
-- Tournaments
|
||||||
|
CREATE TABLE tournaments (
|
||||||
|
id UUID PRIMARY KEY,
|
||||||
|
name VARCHAR(255) NOT NULL,
|
||||||
|
description TEXT,
|
||||||
|
owner_id UUID NOT NULL REFERENCES users(id),
|
||||||
|
game VARCHAR(255),
|
||||||
|
status VARCHAR(50) DEFAULT 'draft', -- draft, active, ended
|
||||||
|
max_participants INT,
|
||||||
|
prize_pool_cents INT,
|
||||||
|
started_at TIMESTAMP,
|
||||||
|
ended_at TIMESTAMP,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Tournament participants
|
||||||
|
CREATE TABLE tournament_participants (
|
||||||
|
id UUID PRIMARY KEY,
|
||||||
|
tournament_id UUID NOT NULL REFERENCES tournaments(id),
|
||||||
|
user_id UUID NOT NULL REFERENCES users(id),
|
||||||
|
channel_id UUID NOT NULL REFERENCES channels(id),
|
||||||
|
seed INT,
|
||||||
|
final_rank INT,
|
||||||
|
joined_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Leaderboards
|
||||||
|
CREATE TABLE leaderboards (
|
||||||
|
id UUID PRIMARY KEY,
|
||||||
|
name VARCHAR(255) NOT NULL,
|
||||||
|
game VARCHAR(255),
|
||||||
|
period VARCHAR(50), -- weekly, monthly, all-time
|
||||||
|
reset_date DATE
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Leaderboard entries
|
||||||
|
CREATE TABLE leaderboard_entries (
|
||||||
|
leaderboard_id UUID NOT NULL REFERENCES leaderboards(id),
|
||||||
|
user_id UUID NOT NULL REFERENCES users(id),
|
||||||
|
rank INT,
|
||||||
|
score BIGINT,
|
||||||
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY (leaderboard_id, user_id)
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Analytics
|
||||||
|
|
||||||
|
```sql
|
||||||
|
-- Stream analytics
|
||||||
|
CREATE TABLE stream_analytics (
|
||||||
|
id UUID PRIMARY KEY,
|
||||||
|
stream_id UUID NOT NULL REFERENCES streams(id),
|
||||||
|
hour_timestamp TIMESTAMP,
|
||||||
|
viewer_count INT,
|
||||||
|
peak_viewers INT,
|
||||||
|
avg_watch_time_seconds INT,
|
||||||
|
new_followers INT,
|
||||||
|
subscriptions INT,
|
||||||
|
donations_cents INT,
|
||||||
|
chat_messages INT,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Channel analytics (daily)
|
||||||
|
CREATE TABLE channel_analytics (
|
||||||
|
id UUID PRIMARY KEY,
|
||||||
|
channel_id UUID NOT NULL REFERENCES channels(id),
|
||||||
|
date DATE,
|
||||||
|
total_views INT,
|
||||||
|
new_followers INT,
|
||||||
|
subscriptions INT,
|
||||||
|
donations_cents INT,
|
||||||
|
revenue_cents INT,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Indexes
|
||||||
|
|
||||||
|
```sql
|
||||||
|
-- Performance indexes
|
||||||
|
CREATE INDEX idx_users_username ON users(username);
|
||||||
|
CREATE INDEX idx_users_email ON users(email);
|
||||||
|
CREATE INDEX idx_channels_user_id ON channels(user_id);
|
||||||
|
CREATE INDEX idx_channels_slug ON channels(slug);
|
||||||
|
CREATE INDEX idx_streams_channel_id ON streams(channel_id);
|
||||||
|
CREATE INDEX idx_streams_status ON streams(status);
|
||||||
|
CREATE INDEX idx_streams_is_live ON streams(is_live);
|
||||||
|
CREATE INDEX idx_chat_messages_stream_id ON chat_messages(stream_id, created_at DESC);
|
||||||
|
CREATE INDEX idx_followers_channel_id ON followers(channel_id);
|
||||||
|
CREATE INDEX idx_followers_follower_id ON followers(follower_id);
|
||||||
|
CREATE INDEX idx_subscriptions_channel_id ON subscriptions(channel_id);
|
||||||
|
CREATE INDEX idx_subscriptions_status ON subscriptions(status);
|
||||||
|
CREATE INDEX idx_donations_channel_id ON donations(channel_id);
|
||||||
|
CREATE INDEX idx_vods_stream_id ON vods(stream_id);
|
||||||
|
CREATE INDEX idx_clips_channel_id ON clips(channel_id);
|
||||||
|
```
|
||||||
329
docs/IMPLEMENTATION_ROADMAP.md
Normal file
329
docs/IMPLEMENTATION_ROADMAP.md
Normal file
|
|
@ -0,0 +1,329 @@
|
||||||
|
# AeThex LIVE - Implementation Roadmap
|
||||||
|
|
||||||
|
## Vision
|
||||||
|
A complete creator platform combining:
|
||||||
|
- 🎬 **Multi-channel Live Streaming** (Twitch-like)
|
||||||
|
- 💬 **Real-time Community** (Chat, reactions, gifting)
|
||||||
|
- 🎮 **Gaming/Esports** (Tournaments, leaderboards)
|
||||||
|
- 🎵 **Music/DJ Studio Mode** (Special audio features)
|
||||||
|
- 📚 **Education/Enterprise** (Webinars, conferences)
|
||||||
|
- 💰 **Creator Monetization** (Subs, donations, payouts)
|
||||||
|
- 🎯 **Engagement Tools** (Polls, clips, highlights)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 1: Foundation (NOW)
|
||||||
|
**Goal**: Basic streaming platform with authentication
|
||||||
|
|
||||||
|
### Sprint 1.1: Database & Authentication
|
||||||
|
- [ ] Set up PostgreSQL on Railway
|
||||||
|
- [ ] Run Prisma migrations
|
||||||
|
- [ ] Set up Clerk authentication
|
||||||
|
- [ ] Create user profiles
|
||||||
|
- [ ] User settings/preferences
|
||||||
|
|
||||||
|
### Sprint 1.2: Basic Streaming
|
||||||
|
- [ ] Creator channel creation
|
||||||
|
- [ ] Stream key management
|
||||||
|
- [ ] HLS ingestion & playback ✅ (already done)
|
||||||
|
- [ ] Stream metadata (title, description)
|
||||||
|
- [ ] Stream status management
|
||||||
|
|
||||||
|
### Sprint 1.3: Real-time Chat
|
||||||
|
- [ ] Socket.io server setup
|
||||||
|
- [ ] Chat message storage
|
||||||
|
- [ ] Real-time message delivery
|
||||||
|
- [ ] Chat UI component
|
||||||
|
- [ ] Message deletion/moderation
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 2: Social & Discovery (3-4 weeks)
|
||||||
|
**Goal**: Community features and stream discovery
|
||||||
|
|
||||||
|
### Sprint 2.1: Social Graph
|
||||||
|
- [ ] Follow/unfollow users
|
||||||
|
- [ ] Follow/unfollow channels
|
||||||
|
- [ ] Follower count display
|
||||||
|
- [ ] Following list
|
||||||
|
- [ ] Notifications on new streams
|
||||||
|
|
||||||
|
### Sprint 2.2: Discovery & Search
|
||||||
|
- [ ] Browse live streams
|
||||||
|
- [ ] Search by title/creator/category
|
||||||
|
- [ ] Category filtering
|
||||||
|
- [ ] Recommended streams
|
||||||
|
- [ ] Trending/trending dashboard
|
||||||
|
- [ ] Sort by viewers, new, featured
|
||||||
|
|
||||||
|
### Sprint 2.3: Creator Dashboard
|
||||||
|
- [ ] Stream management UI
|
||||||
|
- [ ] Go live/end stream UI
|
||||||
|
- [ ] Viewer count tracker
|
||||||
|
- [ ] Basic analytics (views, avg watch time)
|
||||||
|
- [ ] Stream health (bitrate, fps)
|
||||||
|
- [ ] Recent clips/clips dashboard
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 3: Creator Tools & VOD (4-5 weeks)
|
||||||
|
**Goal**: Content creation and archival
|
||||||
|
|
||||||
|
### Sprint 3.1: VOD Archives
|
||||||
|
- [ ] Automatic stream archival
|
||||||
|
- [ ] VOD library management
|
||||||
|
- [ ] VOD playback (same HLS player)
|
||||||
|
- [ ] Watch progress tracking
|
||||||
|
- [ ] Delete/manage VODs
|
||||||
|
|
||||||
|
### Sprint 3.2: Clip Creation
|
||||||
|
- [ ] Create clips from VODs
|
||||||
|
- [ ] In-stream clip button
|
||||||
|
- [ ] Clip editor (trim start/end)
|
||||||
|
- [ ] Clip management
|
||||||
|
- [ ] Clip sharing
|
||||||
|
- [ ] Like & trending clips
|
||||||
|
|
||||||
|
### Sprint 3.3: Advanced Analytics
|
||||||
|
- [ ] Hourly viewer graphs
|
||||||
|
- [ ] Peak viewer count
|
||||||
|
- [ ] Chat activity metrics
|
||||||
|
- [ ] Revenue dashboard
|
||||||
|
- [ ] Follower growth
|
||||||
|
- [ ] Traffic sources
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 4: Monetization (4-6 weeks)
|
||||||
|
**Goal**: Creator revenue streams
|
||||||
|
|
||||||
|
### Sprint 4.1: Subscriptions
|
||||||
|
- [ ] Tier management (basic/premium/vip)
|
||||||
|
- [ ] Stripe integration
|
||||||
|
- [ ] Subscription checkout
|
||||||
|
- [ ] Subscriber badge in chat
|
||||||
|
- [ ] Subscriber-only chat
|
||||||
|
- [ ] Revenue tracking
|
||||||
|
|
||||||
|
### Sprint 4.2: Donations & Gifting
|
||||||
|
- [ ] Donation button on stream
|
||||||
|
- [ ] Donation alerts (TTS, visual)
|
||||||
|
- [ ] Gifting system (send gifts to viewers)
|
||||||
|
- [ ] Gift animations in chat
|
||||||
|
- [ ] Fundraising campaigns
|
||||||
|
|
||||||
|
### Sprint 4.3: Payouts
|
||||||
|
- [ ] Stripe Connect setup
|
||||||
|
- [ ] Revenue calculation (minus platform cut)
|
||||||
|
- [ ] Payout requests
|
||||||
|
- [ ] Payout history
|
||||||
|
- [ ] Tax forms
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 5: Community & Engagement (3-4 weeks)
|
||||||
|
**Goal**: Deep community features
|
||||||
|
|
||||||
|
### Sprint 5.1: Live Interactions
|
||||||
|
- [ ] Polls during streams
|
||||||
|
- [ ] Reaction/emote system
|
||||||
|
- [ ] Hype train
|
||||||
|
- [ ] Chat rewards (points)
|
||||||
|
- [ ] Channel points/currency
|
||||||
|
|
||||||
|
### Sprint 5.2: Community Channels
|
||||||
|
- [ ] Moderator roles
|
||||||
|
- [ ] Chat moderation tools
|
||||||
|
- [ ] Ban/timeout system
|
||||||
|
- [ ] Auto-moderation (spam, profanity)
|
||||||
|
- [ ] Mod dashboard
|
||||||
|
|
||||||
|
### Sprint 5.3: Social Features
|
||||||
|
- [ ] Stream notifications
|
||||||
|
- [ ] Friend system
|
||||||
|
- [ ] Private messages
|
||||||
|
- [ ] Channel announcements
|
||||||
|
- [ ] Raid system (send viewers to another stream)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 6: Gaming/Esports (5-6 weeks)
|
||||||
|
**Goal**: Gaming-focused features
|
||||||
|
|
||||||
|
### Sprint 6.1: Tournaments
|
||||||
|
- [ ] Tournament creation
|
||||||
|
- [ ] Bracket system (single-elim, double-elim)
|
||||||
|
- [ ] Team management
|
||||||
|
- [ ] Tournament chat
|
||||||
|
- [ ] Prize pool management
|
||||||
|
|
||||||
|
### Sprint 6.2: Leaderboards
|
||||||
|
- [ ] Game-specific leaderboards
|
||||||
|
- [ ] Time-based leaderboards (weekly, monthly, all-time)
|
||||||
|
- [ ] Leaderboard positioning
|
||||||
|
- [ ] Achievement badges
|
||||||
|
|
||||||
|
### Sprint 6.3: Competitive Features
|
||||||
|
- [ ] Match scheduling
|
||||||
|
- [ ] VOD linking to matches
|
||||||
|
- [ ] Spectator mode
|
||||||
|
- [ ] Performance analytics
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 7: Music/DJ Features (3-4 weeks)
|
||||||
|
**Goal**: Music-specific tools
|
||||||
|
|
||||||
|
### Sprint 7.1: DJ Mode
|
||||||
|
- [ ] Special layout for music
|
||||||
|
- [ ] Song queue display
|
||||||
|
- [ ] Current track info
|
||||||
|
- [ ] Music visualization (animated, audio-reactive)
|
||||||
|
|
||||||
|
### Sprint 7.2: Music Library
|
||||||
|
- [ ] Upload/manage tracklist
|
||||||
|
- [ ] Spotify integration (if licensing allows)
|
||||||
|
- [ ] Now playing display
|
||||||
|
- [ ] Spotify widget
|
||||||
|
|
||||||
|
### Sprint 7.3: Audio Quality
|
||||||
|
- [ ] High bitrate streaming
|
||||||
|
- [ ] Lossless audio (FLAC) option
|
||||||
|
- [ ] Audio level metrics
|
||||||
|
- [ ] EQ visualization
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 8: Enterprise/Education (3-4 weeks)
|
||||||
|
**Goal**: Business use cases
|
||||||
|
|
||||||
|
### Sprint 8.1: Webinar Features
|
||||||
|
- [ ] Screen sharing
|
||||||
|
- [ ] Presentation mode
|
||||||
|
- [ ] Q&A system (moderated)
|
||||||
|
- [ ] Recording management
|
||||||
|
|
||||||
|
### Sprint 8.2: Education Features
|
||||||
|
- [ ] Course creation
|
||||||
|
- [ ] Session scheduling
|
||||||
|
- [ ] Attendance tracking
|
||||||
|
- [ ] Certificate generation
|
||||||
|
|
||||||
|
### Sprint 8.3: Organization Features
|
||||||
|
- [ ] Teams/organizations
|
||||||
|
- [ ] Org analytics
|
||||||
|
- [ ] Org branding
|
||||||
|
- [ ] Multi-streamer management
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 9: Polish & Scale (Ongoing)
|
||||||
|
**Goal**: Performance, reliability, expansion
|
||||||
|
|
||||||
|
### Sprint 9.1: Performance
|
||||||
|
- [ ] CDN optimization
|
||||||
|
- [ ] Database query optimization
|
||||||
|
- [ ] Caching strategy (Redis)
|
||||||
|
- [ ] Load testing
|
||||||
|
|
||||||
|
### Sprint 9.2: Mobile Apps
|
||||||
|
- [ ] Mobile web PWA
|
||||||
|
- [ ] iOS app (React Native)
|
||||||
|
- [ ] Android app (React Native)
|
||||||
|
|
||||||
|
### Sprint 9.3: Integrations
|
||||||
|
- [ ] OBS integration
|
||||||
|
- [ ] Chatbot support
|
||||||
|
- [ ] Webhook integrations
|
||||||
|
- [ ] API for third-parties
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Technology Stack
|
||||||
|
|
||||||
|
### Frontend
|
||||||
|
- Next.js 16
|
||||||
|
- React 19
|
||||||
|
- TypeScript
|
||||||
|
- Tailwind CSS
|
||||||
|
- Socket.io client
|
||||||
|
- Stripe React Elements
|
||||||
|
|
||||||
|
### Backend
|
||||||
|
- Next.js API Routes
|
||||||
|
- Node.js
|
||||||
|
- Prisma ORM
|
||||||
|
- Socket.io
|
||||||
|
- Stripe API
|
||||||
|
- Clerk
|
||||||
|
|
||||||
|
### Database
|
||||||
|
- PostgreSQL (Railway)
|
||||||
|
- Redis (Upstash on Railway)
|
||||||
|
|
||||||
|
### Services
|
||||||
|
- Clerk (Auth)
|
||||||
|
- Stripe (Payments)
|
||||||
|
- Cloudflare Stream or Mux (Video)
|
||||||
|
- Cloudflare R2 (Storage)
|
||||||
|
- SendGrid/Resend (Email)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Development Setup
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
```bash
|
||||||
|
# Install Node.js 20+
|
||||||
|
# Set up Railway project with PostgreSQL
|
||||||
|
# Get Clerk API keys
|
||||||
|
# Get Stripe API keys
|
||||||
|
```
|
||||||
|
|
||||||
|
### Initial Setup
|
||||||
|
```bash
|
||||||
|
# 1. Clone repository
|
||||||
|
git clone https://github.com/AeThex-LABS/aethex.live
|
||||||
|
cd aethex.live
|
||||||
|
|
||||||
|
# 2. Install dependencies
|
||||||
|
npm install
|
||||||
|
|
||||||
|
# 3. Set up environment variables
|
||||||
|
cp .env.example .env.local
|
||||||
|
|
||||||
|
# 4. Set up database
|
||||||
|
npx prisma migrate dev
|
||||||
|
|
||||||
|
# 5. Start development
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Success Metrics (MVP)
|
||||||
|
|
||||||
|
- [ ] 100+ creators
|
||||||
|
- [ ] 1000+ concurrent viewers
|
||||||
|
- [ ] 99.9% uptime
|
||||||
|
- [ ] <2s latency (stream)
|
||||||
|
- [ ] <100ms chat latency
|
||||||
|
- [ ] $10k+ monthly creator revenue
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Long-term Vision
|
||||||
|
|
||||||
|
AeThex LIVE becomes the go-to platform for:
|
||||||
|
- Independent creators
|
||||||
|
- Gaming communities
|
||||||
|
- Music/DJ culture
|
||||||
|
- Educational content
|
||||||
|
- Business streaming
|
||||||
|
|
||||||
|
With:
|
||||||
|
- Best-in-class streaming quality
|
||||||
|
- Creator-first monetization
|
||||||
|
- Community-driven features
|
||||||
|
- Open API for extensions
|
||||||
|
- Global CDN presence
|
||||||
159
docs/PLATFORM_ARCHITECTURE.md
Normal file
159
docs/PLATFORM_ARCHITECTURE.md
Normal file
|
|
@ -0,0 +1,159 @@
|
||||||
|
# AeThex LIVE - Complete Platform Architecture
|
||||||
|
|
||||||
|
## System Overview
|
||||||
|
|
||||||
|
```
|
||||||
|
┌─────────────────────────────────────────────────────┐
|
||||||
|
│ AeThex LIVE Creator Platform │
|
||||||
|
├─────────────────────────────────────────────────────┤
|
||||||
|
│ │
|
||||||
|
│ Frontend (Next.js) │
|
||||||
|
│ ├─ Creator Dashboard │
|
||||||
|
│ ├─ Watch Page (Single Stream) │
|
||||||
|
│ ├─ Discovery/Browse │
|
||||||
|
│ ├─ User Profiles │
|
||||||
|
│ ├─ Community Channels │
|
||||||
|
│ └─ Creator Monetization UI │
|
||||||
|
│ │
|
||||||
|
│ Backend (Node.js/Next.js API Routes) │
|
||||||
|
│ ├─ Authentication (Clerk) │
|
||||||
|
│ ├─ User Management │
|
||||||
|
│ ├─ Channel/Stream Management │
|
||||||
|
│ ├─ VOD Management │
|
||||||
|
│ ├─ Real-time Chat (Socket.io) │
|
||||||
|
│ ├─ Monetization/Payments (Stripe) │
|
||||||
|
│ ├─ Analytics & Reports │
|
||||||
|
│ └─ Content Moderation │
|
||||||
|
│ │
|
||||||
|
│ Database (PostgreSQL on Railway) │
|
||||||
|
│ ├─ Users & Profiles │
|
||||||
|
│ ├─ Channels & Streams │
|
||||||
|
│ ├─ VOD/Clips │
|
||||||
|
│ ├─ Chat/Messages │
|
||||||
|
│ ├─ Social Graph (Followers) │
|
||||||
|
│ ├─ Monetization (Subscriptions, Donations) │
|
||||||
|
│ ├─ Polls & Interactions │
|
||||||
|
│ └─ Analytics │
|
||||||
|
│ │
|
||||||
|
│ Services │
|
||||||
|
│ ├─ Streaming (Cloudflare/Mux) │
|
||||||
|
│ ├─ Storage (Cloudflare R2/S3) │
|
||||||
|
│ ├─ Video Processing (FFmpeg) │
|
||||||
|
│ ├─ Cache (Redis on Railway) │
|
||||||
|
│ └─ Email (Resend/SendGrid) │
|
||||||
|
│ │
|
||||||
|
└─────────────────────────────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
## Data Models
|
||||||
|
|
||||||
|
### Core Entities
|
||||||
|
- **User** - Creator/Viewer accounts
|
||||||
|
- **Channel** - Creator's channel (can have multiple)
|
||||||
|
- **Stream** - Live streaming session
|
||||||
|
- **VOD** - Video on demand (archived stream)
|
||||||
|
- **Clip** - User-created highlight clip
|
||||||
|
- **ChatMessage** - Stream chat
|
||||||
|
- **Follower** - Social graph
|
||||||
|
- **Subscription** - Paid membership
|
||||||
|
- **Donation/Tip** - One-time payment
|
||||||
|
- **Poll** - Live poll/interaction
|
||||||
|
- **Leaderboard** - Gaming/competition rankings
|
||||||
|
|
||||||
|
### Features by Priority
|
||||||
|
|
||||||
|
#### Phase 1: Foundation (Current)
|
||||||
|
- [x] HLS streaming player
|
||||||
|
- [ ] User authentication
|
||||||
|
- [ ] Basic profiles
|
||||||
|
- [ ] Real-time chat
|
||||||
|
|
||||||
|
#### Phase 2: Multi-Channel & Discovery
|
||||||
|
- [ ] Multi-channel support
|
||||||
|
- [ ] Stream discovery/browse
|
||||||
|
- [ ] Search & recommendations
|
||||||
|
- [ ] Follow system
|
||||||
|
|
||||||
|
#### Phase 3: Creator Tools
|
||||||
|
- [ ] Creator dashboard
|
||||||
|
- [ ] Stream analytics
|
||||||
|
- [ ] VOD archives
|
||||||
|
- [ ] Basic clip creation
|
||||||
|
|
||||||
|
#### Phase 4: Monetization
|
||||||
|
- [ ] Subscriptions
|
||||||
|
- [ ] Donations/tips
|
||||||
|
- [ ] Payout system
|
||||||
|
- [ ] Revenue analytics
|
||||||
|
|
||||||
|
#### Phase 5: Community & Engagement
|
||||||
|
- [ ] Community channels
|
||||||
|
- [ ] Polls & reactions
|
||||||
|
- [ ] Gifting
|
||||||
|
- [ ] User badges/roles
|
||||||
|
|
||||||
|
#### Phase 6: Advanced Features
|
||||||
|
- [ ] Gaming tournaments
|
||||||
|
- [ ] Leaderboards
|
||||||
|
- [ ] Music/DJ mode
|
||||||
|
- [ ] Clips & highlights
|
||||||
|
- [ ] Auto-moderation
|
||||||
|
- [ ] Notifications
|
||||||
|
|
||||||
|
## Tech Stack
|
||||||
|
|
||||||
|
**Frontend**
|
||||||
|
- Next.js 16 (React 19)
|
||||||
|
- TypeScript
|
||||||
|
- Tailwind CSS
|
||||||
|
- Socket.io client
|
||||||
|
- Stripe React
|
||||||
|
|
||||||
|
**Backend**
|
||||||
|
- Next.js API Routes
|
||||||
|
- Node.js
|
||||||
|
- Socket.io server
|
||||||
|
- Prisma ORM
|
||||||
|
|
||||||
|
**Database**
|
||||||
|
- PostgreSQL (Railway)
|
||||||
|
- Redis (Upstash/Railway)
|
||||||
|
|
||||||
|
**Authentication**
|
||||||
|
- Clerk (or NextAuth.js)
|
||||||
|
|
||||||
|
**Payments**
|
||||||
|
- Stripe
|
||||||
|
|
||||||
|
**Streaming**
|
||||||
|
- Cloudflare Stream or Mux
|
||||||
|
|
||||||
|
**Storage**
|
||||||
|
- Cloudflare R2 or AWS S3
|
||||||
|
|
||||||
|
**Real-time**
|
||||||
|
- Socket.io
|
||||||
|
|
||||||
|
## Database Schema
|
||||||
|
|
||||||
|
See `docs/DATABASE_SCHEMA.md`
|
||||||
|
|
||||||
|
## API Structure
|
||||||
|
|
||||||
|
See `docs/API_STRUCTURE.md`
|
||||||
|
|
||||||
|
## Implementation Order
|
||||||
|
|
||||||
|
1. Set up Prisma & PostgreSQL
|
||||||
|
2. User authentication (Clerk)
|
||||||
|
3. Channel & stream creation
|
||||||
|
4. Real-time chat
|
||||||
|
5. VOD storage
|
||||||
|
6. Follow system
|
||||||
|
7. Basic dashboard
|
||||||
|
8. Stripe integration
|
||||||
|
9. Advanced features
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Ready to build the complete platform!**
|
||||||
1452
package-lock.json
generated
1452
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -12,10 +12,17 @@
|
||||||
"lint": "eslint"
|
"lint": "eslint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@clerk/nextjs": "^6.37.3",
|
||||||
|
"@prisma/client": "^7.3.0",
|
||||||
"hls.js": "^1.6.15",
|
"hls.js": "^1.6.15",
|
||||||
"next": "16.1.6",
|
"next": "16.1.6",
|
||||||
|
"next-auth": "^4.24.13",
|
||||||
|
"prisma": "^7.3.0",
|
||||||
"react": "19.2.3",
|
"react": "19.2.3",
|
||||||
"react-dom": "19.2.3"
|
"react-dom": "19.2.3",
|
||||||
|
"socket.io": "^4.8.3",
|
||||||
|
"socket.io-client": "^4.8.3",
|
||||||
|
"stripe": "^20.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tailwindcss/postcss": "^4",
|
"@tailwindcss/postcss": "^4",
|
||||||
|
|
|
||||||
323
prisma/schema.prisma
Normal file
323
prisma/schema.prisma
Normal file
|
|
@ -0,0 +1,323 @@
|
||||||
|
// This is your Prisma schema file,
|
||||||
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||||
|
|
||||||
|
generator client {
|
||||||
|
provider = "prisma-client-js"
|
||||||
|
}
|
||||||
|
|
||||||
|
datasource db {
|
||||||
|
provider = "postgresql"
|
||||||
|
url = env("DATABASE_URL")
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== USERS & AUTHENTICATION =====
|
||||||
|
|
||||||
|
model User {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
clerkId String @unique // Clerk user ID
|
||||||
|
username String @unique
|
||||||
|
email String @unique
|
||||||
|
displayName String?
|
||||||
|
bio String?
|
||||||
|
avatarUrl String?
|
||||||
|
bannerUrl String?
|
||||||
|
isCreator Boolean @default(false)
|
||||||
|
verified Boolean @default(false)
|
||||||
|
|
||||||
|
// Relations
|
||||||
|
channels Channel[]
|
||||||
|
followedUsers UserFollow[] @relation("following")
|
||||||
|
followers UserFollow[] @relation("follower")
|
||||||
|
chatMessages ChatMessage[]
|
||||||
|
subscriptions Subscription[]
|
||||||
|
donations Donation[]
|
||||||
|
followers Follower[]
|
||||||
|
clips Clip[]
|
||||||
|
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
|
@@index([username])
|
||||||
|
@@index([email])
|
||||||
|
@@index([clerkId])
|
||||||
|
}
|
||||||
|
|
||||||
|
model UserFollowUser {
|
||||||
|
followerId String
|
||||||
|
followingId String
|
||||||
|
follower User @relation("follower", fields: [followerId], references: [id], onDelete: Cascade)
|
||||||
|
following User @relation("following", fields: [followingId], references: [id], onDelete: Cascade)
|
||||||
|
followDate DateTime @default(now())
|
||||||
|
|
||||||
|
@@id([followerId, followingId])
|
||||||
|
@@index([followerId])
|
||||||
|
@@index([followingId])
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== CHANNELS & STREAMING =====
|
||||||
|
|
||||||
|
model Channel {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
userId String
|
||||||
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
name String @unique
|
||||||
|
slug String @unique
|
||||||
|
description String?
|
||||||
|
category String? // gaming, music, education, etc.
|
||||||
|
language String?
|
||||||
|
language String?
|
||||||
|
|
||||||
|
isLive Boolean @default(false)
|
||||||
|
totalViews BigInt @default(0)
|
||||||
|
|
||||||
|
streams Stream[]
|
||||||
|
followers Follower[]
|
||||||
|
subscriptions Subscription[]
|
||||||
|
donations Donation[]
|
||||||
|
clips Clip[]
|
||||||
|
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
|
@@index([userId])
|
||||||
|
@@index([slug])
|
||||||
|
}
|
||||||
|
|
||||||
|
model Stream {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
channelId String
|
||||||
|
channel Channel @relation(fields: [channelId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
title String
|
||||||
|
description String?
|
||||||
|
status String @default("scheduled") // live, ended, scheduled
|
||||||
|
|
||||||
|
streamKey String @unique
|
||||||
|
hlsUrl String?
|
||||||
|
thumbnailUrl String?
|
||||||
|
|
||||||
|
viewerCount Int @default(0)
|
||||||
|
|
||||||
|
startedAt DateTime?
|
||||||
|
endedAt DateTime?
|
||||||
|
durationSeconds Int?
|
||||||
|
|
||||||
|
isArchived Boolean @default(true)
|
||||||
|
archiveUrl String?
|
||||||
|
|
||||||
|
chatMessages ChatMessage[]
|
||||||
|
vod VOD?
|
||||||
|
polls Poll[]
|
||||||
|
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
|
@@index([channelId])
|
||||||
|
@@index([status])
|
||||||
|
@@index([isLive])
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== SOCIAL FEATURES =====
|
||||||
|
|
||||||
|
model Follower {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
userId String
|
||||||
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
channelId String
|
||||||
|
channel Channel @relation(fields: [channelId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
notificationEnabled Boolean @default(true)
|
||||||
|
|
||||||
|
followDate DateTime @default(now())
|
||||||
|
|
||||||
|
@@unique([userId, channelId])
|
||||||
|
@@index([channelId])
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== CHAT & MODERATION =====
|
||||||
|
|
||||||
|
model ChatMessage {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
streamId String
|
||||||
|
stream Stream @relation(fields: [streamId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
userId String
|
||||||
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
message String
|
||||||
|
isDeleted Boolean @default(false)
|
||||||
|
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
|
||||||
|
@@index([streamId])
|
||||||
|
@@index([createdAt])
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== MONETIZATION =====
|
||||||
|
|
||||||
|
model Subscription {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
subscriberId String
|
||||||
|
subscriber User @relation(fields: [subscriberId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
channelId String
|
||||||
|
channel Channel @relation(fields: [channelId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
tier String // basic, premium, vip
|
||||||
|
priceCents Int
|
||||||
|
stripeSubscriptionId String?
|
||||||
|
|
||||||
|
status String @default("active") // active, cancelled, expired
|
||||||
|
|
||||||
|
autoRenew Boolean @default(true)
|
||||||
|
|
||||||
|
startedAt DateTime @default(now())
|
||||||
|
endedAt DateTime?
|
||||||
|
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
|
@@unique([subscriberId, channelId])
|
||||||
|
@@index([channelId])
|
||||||
|
@@index([status])
|
||||||
|
}
|
||||||
|
|
||||||
|
model Donation {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
donorId String
|
||||||
|
donor User @relation(fields: [donorId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
channelId String
|
||||||
|
channel Channel @relation(fields: [channelId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
streamId String? // Optional: specific stream
|
||||||
|
|
||||||
|
amountCents Int
|
||||||
|
currency String @default("USD")
|
||||||
|
message String?
|
||||||
|
|
||||||
|
stripeChargeId String?
|
||||||
|
status String @default("completed") // pending, completed, failed
|
||||||
|
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
|
||||||
|
@@index([channelId])
|
||||||
|
@@index([status])
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== CONTENT =====
|
||||||
|
|
||||||
|
model VOD {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
streamId String @unique
|
||||||
|
stream Stream @relation(fields: [streamId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
title String?
|
||||||
|
description String?
|
||||||
|
thumbnailUrl String?
|
||||||
|
|
||||||
|
durationSeconds Int?
|
||||||
|
views Int @default(0)
|
||||||
|
|
||||||
|
isPublic Boolean @default(true)
|
||||||
|
processingStatus String @default("processing") // processing, ready, failed
|
||||||
|
|
||||||
|
clips Clip[]
|
||||||
|
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
|
@@index([streamId])
|
||||||
|
}
|
||||||
|
|
||||||
|
model Clip {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
vodId String?
|
||||||
|
vod VOD? @relation(fields: [vodId], references: [id], onDelete: SetNull)
|
||||||
|
|
||||||
|
channelId String
|
||||||
|
channel Channel @relation(fields: [channelId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
creatorId String
|
||||||
|
creator User @relation(fields: [creatorId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
title String
|
||||||
|
slug String @unique
|
||||||
|
description String?
|
||||||
|
thumbnailUrl String?
|
||||||
|
videoUrl String?
|
||||||
|
|
||||||
|
startSeconds Int?
|
||||||
|
durationSeconds Int?
|
||||||
|
|
||||||
|
views Int @default(0)
|
||||||
|
likes Int @default(0)
|
||||||
|
|
||||||
|
isPublic Boolean @default(true)
|
||||||
|
|
||||||
|
clipLikes ClipLike[]
|
||||||
|
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
|
@@index([channelId])
|
||||||
|
@@index([creatorId])
|
||||||
|
}
|
||||||
|
|
||||||
|
model ClipLike {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
userId String
|
||||||
|
clipId String
|
||||||
|
clip Clip @relation(fields: [clipId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
|
||||||
|
@@unique([userId, clipId])
|
||||||
|
@@index([clipId])
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== INTERACTIONS =====
|
||||||
|
|
||||||
|
model Poll {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
streamId String
|
||||||
|
stream Stream @relation(fields: [streamId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
question String
|
||||||
|
durationSeconds Int?
|
||||||
|
|
||||||
|
status String @default("active") // active, ended
|
||||||
|
|
||||||
|
options PollOption[]
|
||||||
|
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
endedAt DateTime?
|
||||||
|
|
||||||
|
@@index([streamId])
|
||||||
|
}
|
||||||
|
|
||||||
|
model PollOption {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
pollId String
|
||||||
|
poll Poll @relation(fields: [pollId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
option String
|
||||||
|
voteCount Int @default(0)
|
||||||
|
|
||||||
|
votes PollVote[]
|
||||||
|
|
||||||
|
@@index([pollId])
|
||||||
|
}
|
||||||
|
|
||||||
|
model PollVote {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
optionId String
|
||||||
|
option PollOption @relation(fields: [optionId], references: [id], onDelete: Cascade)
|
||||||
|
userId String
|
||||||
|
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
|
||||||
|
@@unique([userId, optionId])
|
||||||
|
@@index([optionId])
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue