Major additions: - Web-based setup wizard (setup.php, setup_wizard.php, setup-wizard.js) - Production Docker configuration (docker-compose.prod.yml, .env.production) - Database initialization SQL files (deploy/init_settings.sql) - Template builder system with drag-and-drop UI - Advanced features (OAuth, CDN, enhanced analytics, monetization) - Comprehensive documentation (deployment guides, quick start, feature docs) - Design system with accessibility and responsive layout - Deployment automation scripts (deploy.ps1, generate-secrets.ps1) Setup wizard allows customization of: - Platform name and branding - Domain configuration - Membership tiers and pricing - Admin credentials - Feature toggles Database includes 270+ tables for complete video streaming platform with advanced features for analytics, moderation, template building, and monetization. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
EasyStream
High‑end YouTube‑style media platform supporting Videos, Shorts, Live Streams, Images, Audio, Documents, and Blogs. It ships with an admin backend, strong security primitives, detailed logging, containerized deployment, and RTMP/HLS live streaming via SRS.
This document helps you understand the codebase, run it locally, and work productively within the project.
Quick Start (Docker)
Get started in under 5 minutes! See DOCKER_QUICK_START.md for the complete guide.
Requirements: Docker and Docker Compose.
- Copy the repo locally and start the stack:
docker-compose up -d --build
- Initialize the database schema (single SQL file):
docker exec -i easystream-db mysql -u easystream -peasystream easystream < __install/easystream.sql
- Access your platform:
- Main Site: http://localhost:8083
- Admin Panel: http://localhost:8083/admin_login.php (admin/admin123)
- Settings: http://localhost:8083/admin_settings.php
- Configure everything via the admin panel - no code changes required!
For detailed installation instructions, see DOCKER_QUICK_START.md. For settings configuration, see SETTINGS_GUIDE.md.
What’s Inside
Core entry points
index.php: main frontend controller (routing, notifications, actions) (index.php:1)f_core/config.core.php: bootstraps config, autoload, DB, session, security, logging (f_core/config.core.php:1)f_core/config.database.php: DB connector via env vars (f_core/config.database.php:1)f_core/config.logging.php: logging and alert configuration (f_core/config.logging.php:1)api/: lightweight API utilities (Telegram, auto‑posting) (api/config.php:1)
Key subsystems
- Security:
VSecurityhelpers and safe wrappers inf_core/f_functions/functions.security.php(f_core/f_classes/class.security.php:1, f_core/f_functions/functions.security.php:1) - Database:
VDatabaseon top of ADOdb; prepared queries/validation (f_core/f_classes/class.database.php:1) - Logging:
VLoggerandVErrorHandler, file rotation, alerting, admin log viewer (f_core/f_classes/class.logger.php:1, f_core/f_classes/class.errorhandler.php:1, f_modules/m_backend/log_viewer.php:1) - IP + Fingerprint: tracking and ban management (f_core/f_classes/class.iptracker.php:1, f_core/f_classes/class.fingerprint.php:1, f_modules/m_backend/ip_management.php:1, f_modules/m_backend/fingerprint_management.php:1)
- Templates: Smarty configuration (f_core/config.smarty.php:1)
- Live Streaming: SRS RTMP/HLS (
deploy/srs.conf), HLS published to shared volumes
Third‑party vendor libs
- ADOdb, Smarty, AWS SDK (S3 et al.), Google client, Zend Uri/Validate (see
f_core/f_classesand vendor‑like trees in repo)
Directory Structure
__install/– SQL schema, upgrade scripts, install docsapi/– integration endpoints (Telegram bot and autopost)deploy/– infra configs (SRS, cron scripts, SQL seeders)f_core/– framework core: configs, autoload, classes, functionsf_modules/– feature modules; includes backend admin utilitiesf_scripts/– auxiliary scripts and assetsf_data/– runtime data (logs, cache, sitemaps, user files, sessions)- Public root – entrypoints, PWA assets (
index.js,sw.js, favicons)
Configuration
Application
- Main URL: set
MAIN_URLor editf_core/config.set.php(f_core/config.set.php:1) - Theme/Smarty: configured in
f_core/config.smarty.php(f_core/config.smarty.php:1)
Database
- Configure via env:
DB_HOST,DB_NAME,DB_USER,DB_PASS(f_core/config.database.php:1) - ADOdb cache dir is set from configs (f_core/config.core.php:29)
Logging
- Toggle file/database logging, levels, rotation, alerts (f_core/config.logging.php:1)
- Files stored under
f_data/logs/ - Admin UI for viewing/clearing logs:
f_modules/m_backend/log_viewer.php(requires backend access)
Security
- Central API:
VSecurityfor input validation, escaping, CSRF, rate limiting (f_core/f_classes/class.security.php:1) - Convenience wrappers:
functions.security.php(get_param, post_param, csrf_field, validate_csrf, etc.) (f_core/f_functions/functions.security.php:1) - Strict autoload maps key classes by name to file (f_core/config.autoload.php:1)
Live Streaming
- SRS config at
deploy/srs.conf(HLS fragments to/srs/hls; DVR to/srs/rec) (deploy/srs.conf:1) - Docker volumes expose HLS as read‑only to web tier (docker-compose.yml:1)
API Integrations
api/telegram.php– Telegram Bot webhook handler (api/telegram.php:1)api/auto_post.php– cron‑driven autopost of new videos/streams to Telegram channels (api/auto_post.php:1)api/config.php– tokens/channels and rate limits (api/config.php:1)
PWA/Frontend Enhancements
index.js– service worker registration, Android/iOS install prompts (index.js:1)sw.js– simple cache forindex.js, skip caching uploads/HLS requests (sw.js:1)
Security Model
- Input validation: Use
VSecurity::getParam/postParam/validateInputto sanitize all request data. Types supported includeint,email,url,alpha,alphanum,slug,filename,boolean. - CSRF protection: Embed
csrf_field('action')in forms and validate withvalidate_csrf('action'). - Output escaping: Use
secure_outputfor HTML andsecure_jsfor JavaScript contexts. - File upload validation:
validate_file_upload($file, $allowedTypes, $maxSize)inspects MIME and size. - Rate limiting:
check_rate_limit($key, $maxAttempts, $windowSeconds)stores attempt windows in session. - IP tracking/bans:
VIPTracker::logActivity,VIPTracker::banIP/unbanIP/isBannedwith geo hints and stats. - Browser fingerprinting:
VFingerprint::generateFingerprint/trackFingerprint/ban/unban/isBannedfor evasive users.
See examples:
example_secure_form.php– CSRF, rate limit, validated inputs, and safe uploadexample_enhanced_logging.php– application/security/performance logging
Logging & Observability
- Central logger:
VLoggerwith levels EMERGENCY→DEBUG + global request context and backtraces; file rotation and optional DB sinks (f_core/f_classes/class.logger.php:1) - Global error handler:
VErrorHandlercaptures PHP errors/exceptions/shutdown fatals and renders user‑friendly responses depending ondebug_mode(f_core/f_classes/class.errorhandler.php:1) - Configurable alerting (email) and retention (f_core/config.logging.php:1)
- Admin Log Viewer (
f_modules/m_backend/log_viewer.php) with level/limit filters and clear‑all action
Admin Utilities
- Fingerprint Management: lookup stats, detect threats, ban/unban (
f_modules/m_backend/fingerprint_management.php) - IP Management: banlist maintenance, activity review (
f_modules/m_backend/ip_management.php) - Log Viewer: browse/clear logs (
f_modules/m_backend/log_viewer.php)
Backend access control is enforced; ensure you are logged in as an admin before invoking these scripts directly.
Development Notes
- Autoloading:
spl_autoload_registerresolves class names likeVSecurity,VLogger,VErrorHandlerto files underf_core/f_classes/(f_core/config.autoload.php:1). Avoid namespace collisions with bundled vendor libs (Google, Zend, AWS, etc.). - Database: Prefer
VDatabasemethods which validate table/field names and bind parameters. Do not construct ad‑hoc SQL strings without validation. - Templates: Smarty is configured with template/cache directories from
cfgand exposes common URLs to templates (f_core/config.smarty.php:1). - Configuration: Read via
$class_database->getConfigurations(...)andcfgarray; environment variables override DB where applicable.
Manual Installation (Non‑Docker)
Summary (see __install/INSTALL.txt for full details):
- Upload files to your web root.
- Create a MariaDB/MySQL database; import
__install/easystream.sql.gzand theupdatedb_*.sql/deploy/init_settings.sqlscripts. - Edit
f_core/config.database.phpandf_core/config.set.php. - Set writable permissions on
f_data/subfolders as noted inINSTALL.txt. - Configure your web server (Apache/Nginx/Caddy) to serve the repository root; PHP‑FPM 8.2+ recommended.
- Configure cron jobs for conversions, expirations, dashboards, and housekeeping as listed in
INSTALL.txt.
Live Streaming
- Push RTMP to
rtmp://<host>:1935/live/<stream_key>(SRS). HLS is written to thertmp_hlsvolume and served by Caddy as static content; DVR records tortmp_rec. - SRS parameters (HLS fragment/window, DVR layout) in
deploy/srs.conf. - For ABR (multi‑rendition) examples, see
deploy/abr.shand theabrservice.
HLS Permissions & Health
- Ensure the SRS container can write to the mounted HLS and recordings volumes and Caddy/PHP can read them:
rtmp_hls→ writable by SRS, readable by Caddy (served at/hls/*).rtmp_rec→ writable by SRS, readable by PHP/cron for VOD processing.
- If you bind host directories, align ownership/permissions (commonly UID/GID 0 in SRS image; Caddy runs as
caddyuser). Usechown/chmodon host paths accordingly. - Quick HLS check: once streaming, an HLS playlist should appear at
/hls/<app>/<stream_key>/index.m3u8.
API: Telegram
- Configure
api/config.phpwith your Telegrambot_tokenandchannel_id. - Webhook handler:
api/telegram.phpsupports commands like/start,/videos,/search. - Autopost script:
api/auto_post.phpqueries recent videos/streams and posts to the configured channel; run via cron or thecronservice.
PWA Hints
index.jsregisterssw.jsand provides install prompts on mobile;sw.jsimplements minimal caching and avoids caching uploads/HLS.
Development Notes
- Run full test suite:
composer test - Lint PHP syntax locally (fast):
composer lint - CI runs syntax/style checks and publishes coverage artifacts.
Documentation
Essential Guides (Start Here!)
- DOCKER_QUICK_START.md - Get started in 5 minutes with Docker
- SETTINGS_GUIDE.md - Configure your platform without code changes
- EASYSTREAM_API_DOCUMENTATION.md - Complete API reference
- CLEANUP_GUIDE.md - Clean up workspace for production
- COMPLIANCE.md - Legal and compliance information
Installation & Setup
- __install/INSTALL.txt - Manual installation instructions
- __install/TECHNOTES.txt - Technical implementation details
- __install/install_settings_system.sql - Settings system installation
Advanced Documentation (If Available)
- docs/PROJECT_OVERVIEW.md - Complete project overview (if exists)
- docs/ARCHITECTURE.md - System architecture (if exists)
- docs/SECURITY.md - Security implementation (if exists)
- docs/DEVELOPMENT.md - Development workflows (if exists)
Troubleshooting
- White screen or 500s: check
f_data/logs/*and the admin log viewer. - DB connection errors: validate env vars and connectivity (f_core/f_classes/class.database.php).
- Permissions: ensure
f_data/directories are writable per__install/INSTALL.txt. - Live not working: verify SRS is running and HLS path mounted to Caddy; inspect
deploy/srs.confand container logs. - Telegram autopost: ensure valid token/channel and outbound network access from the PHP/cron containers.
For detailed troubleshooting, see the Deployment Guide.
Quick Links
- 🚀 Get Started in 5 Minutes - Docker quick start guide
- ⚙️ Configure Your Platform - Settings system guide (no code required!)
- 📡 API Reference - Complete API documentation
- 🧹 Clean Up Workspace - Production-ready workspace cleanup
- 📖 Advanced Docs - Complete documentation suite (if available)
License
This project is distributed under the EasyStream Proprietary License. See LICENSE.txt.