Files
easystream-main/deploy/DATABASE_SETUP_README.md
SamiAhmed7777 0b7e2d0a5b feat: Add comprehensive documentation suite and reorganize project structure
- Created complete documentation in docs/ directory
- Added PROJECT_OVERVIEW.md with feature highlights and getting started guide
- Added ARCHITECTURE.md with system design and technical details
- Added SECURITY.md with comprehensive security implementation guide
- Added DEVELOPMENT.md with development workflows and best practices
- Added DEPLOYMENT.md with production deployment instructions
- Added API.md with complete REST API documentation
- Added CONTRIBUTING.md with contribution guidelines
- Added CHANGELOG.md with version history and migration notes
- Reorganized all documentation files into docs/ directory for better organization
- Updated README.md with proper documentation links and quick navigation
- Enhanced project structure with professional documentation standards
2025-10-21 00:39:45 -07:00

138 lines
4.3 KiB
Markdown

# EasyStream Complete Database Setup
This directory contains the complete database schema for the EasyStream video streaming platform.
## 🗄️ Complete Database Schema
The `__install/easystream.sql` file contains **ALL** tables needed for a production-ready EasyStream installation:
### Core Tables
- **db_accountuser** - User accounts with token balances and streaming settings
- **db_videofiles** - Video files with processing status and analytics
- **db_settings** - Platform configuration settings
- **db_sessions** - User session management
### RBAC (Role-Based Access Control)
- **db_roles** - System roles (guest, member, verified, creator, moderator, admin, super_admin)
- **db_user_roles** - User role assignments with expiration
- **db_role_permissions** - Permission mappings for each role
### Live Streaming
- **db_live_streams** - Live stream sessions with SRS integration
- **db_stream_viewers** - Real-time viewer tracking
- Stream analytics and recording management
### API & Analytics
- **db_api_keys** - API key management with rate limiting
- **db_api_logs** - Complete API request logging
- **db_video_analytics** - Detailed video viewing analytics
- **db_platform_metrics** - Aggregated platform statistics
### Token Monetization System
- **token_transactions** - All token-based transactions
- **token_purchases** - USD to token conversions
- **token_donations** - User-to-user token transfers
### Branding & Customization
- **db_branding_settings** - Complete theme customization
- **db_branding_images** - Logo and image management
- Color schemes, typography, and layout settings
### Additional Features
- IP tracking and fingerprinting
- Email logging and notifications
- Password reset management
- Enhanced security features
## 🚀 Quick Setup
### For Docker Users (Recommended)
1. **Start your Docker containers:**
```bash
docker-compose up -d
```
2. **Load the schema:**
```bash
docker exec -i easystream-db mysql -u easystream -peasystream easystream < __install/easystream.sql
```
### Manual Setup
If you prefer to run the SQL manually:
```bash
# Copy SQL to container
docker cp __install/easystream.sql vs-db:/tmp/schema.sql
# Execute the schema
docker exec vs-db mysql -u root -proot easystream -e "source /tmp/schema.sql"
# Clean up
docker exec vs-db rm /tmp/schema.sql
```
## ✅ What Gets Created
After running the setup, your EasyStream platform will have:
- **Complete user management** with role-based permissions
- **Video processing pipeline** with HLS streaming support
- **Live streaming capabilities** integrated with SRS
- **Comprehensive analytics** for videos, streams, and platform metrics
- **Token-based monetization** system ready for payments
- **Full branding customization** with theme management
- **Production-ready API** with logging and rate limiting
- **Advanced security features** including IP tracking and fingerprinting
## 🔧 Default Configuration
The schema includes sensible defaults:
- **7 user roles** from guest to super_admin with appropriate permissions
- **Token system** configured with "EasyCoins" as the default currency
- **Branding settings** with a clean blue theme
- **Platform metrics** initialized and ready for data collection
- **API rate limits** set to 100/hour for public, 1000/hour for members
## 📊 Database Statistics
The complete schema creates approximately:
- **25+ core tables** for full functionality
- **50+ indexes** for optimal performance
- **100+ default settings** for immediate use
- **Foreign key constraints** for data integrity
- **Triggers** for automatic balance updates
## 🛠️ Maintenance
The database is designed for production use with:
- Proper indexing for performance
- Foreign key constraints for data integrity
- Timestamp tracking for audit trails
- JSON columns for flexible metadata storage
- Partitioning-ready for high-volume analytics
## 🔍 Verification
After setup, verify your installation by checking that key tables exist:
```sql
SHOW TABLES LIKE 'db_%';
SHOW TABLES LIKE 'token_%';
```
You should see all the tables listed above.
## 📝 Notes
- This schema is compatible with MariaDB 10.6+ and MySQL 8.0+
- All tables use UTF8MB4 charset for full Unicode support
- JSON columns are used for flexible metadata storage
- The schema is designed to handle high-volume production workloads
Your EasyStream platform is now ready for production use! 🎉