How pradhyuman-yadav/video-steaming works
Project Type and Purpose
• This is a monolithic, full-stack web application built on Laravel (PHP) that powers an online learning/video-streaming platform. It provides:
• Admin dashboard (course/blog/user management)
• Public frontend (course catalog, blogs, forums, live classes)
• RESTful API endpoints (for mobile/SPA)
• CLI tooling (scheduled tasks, data migrations)
• Integrations with payment gateways and real-time services
Architectural Overview from File Structure
• Top-level “app” directory contains MVC backend:
• app/Http/Controllers → HTTP entry points
• app/Models → Eloquent ORM
• app/Services → external-integration (payments, Agora, Zoom)
• app/Console → scheduled/queue workers
• “public” hosts two frontends:
• public/admin → admin panel static assets & Blade views
• public/frontend → student/instructor/organization UI assets & views
• “routes” splits HTTP into domains: admin.php, api.php, frontend.php, instructor.php, organization.php, student.php
• “config” holds external-service credentials (DB, cache, mail, Zoom, BigBlueButton, payment gateways).
• Docker config under “docker/” and docker-compose.yml orchestrates containers: web (Nginx + PHP-FPM), DB, cache, queue workers.
Key Components
a. Clients
• Web browsers (Admin UI / Public UI)
• Mobile apps or SPAs consuming API endpoints
b. Edge/Load Balancer
• (Optional) AWS ELB or CDN → Routes traffic to Nginx
c. Web Server Layer
• Nginx container → forwards to PHP-FPM
d. Application Layer
• Laravel monolith (MVC + Service layer + Events)
• Queue Workers (php artisan queue:work)
• Scheduled Jobs (php artisan schedule:run)
e. Data Stores
• MySQL (or MariaDB) relational database
• Redis for cache, session store, queue backend
• File storage (local disk or AWS S3)
f. External Services
• Payment Gateways (Stripe, PayPal, etc.)
• Real-time/Video services: Agora RTC/RTM, Jitsi, Zoom, BigBlueButton
• Email SMTP or 3rd-party (Mailgun/SES)
• Optional: Google Calendar, Pusher for websockets
Relationships and Data Flows
• Client → Nginx → Laravel (Controllers)
• Controllers call Services & Models → read/write MySQL or Redis
• Controllers return rendered Blade views or JSON (API)
• Async tasks (email notifications, video processing) dispatched to queue → queue workers process and may talk back to Laravel, DB, Redis
• Events published (ChatEvent) → broadcasting via Pusher or websockets → clients receive updates
• Payment flows: Laravel PaymentService → external gateway API → webhook callback → Laravel updates order status
• Real-time class flows: Instructor/Student → Agora/Jitsi/Zoom SDK → backend generates tokens via app/Services/Agora or related classes
Architectural Patterns & Principles
• MVC: Separation of concerns between Models, Views (Blade), Controllers
• Service Layer: encapsulates third-party integrations (app/Services)
• Event-Driven: Laravel Events & Broadcasting for chat/live classes
• Queuing: decouple long-running tasks (emails, exports) via Redis queue
• Modular Routing: domain-specific route files
• Configuration-driven: all credentials and feature flags in config/*.php
Detail Recommendations
• Middleware for auth (Sanctum), rate limiting, localization.
• Event flow for chat/live classes: Controller dispatches ChatEvent → Broadcasting → subscribed clients.
• Queue flow: Controller dispatches Job → Redis Queues → Worker → triggers EmailSendService or PDF generation.
• Keep it high-level but ensure all major modules (admin, API, frontend) and integrations are visible.