Skip to content

Latest commit

Β 

History

1,611 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎬 AleX Cinema

The Next-Generation Social Streaming Platform & Synchronized Watch Party Ecosystem

High-performance cinema streaming, real-time social watching, and native Telegram Mini App integration

Next.js 16 React 19 TypeScript Socket.io TailwindCSS PostgreSQL Docker Telegram Mini App

Official Website (Live) β€’ Documentation (Docs) β€’ Disaster Recovery Plan β€’ Design System


πŸ“– Overview

AleX Cinema is an enterprise-grade, theater-quality entertainment platform engineered for lightning-fast, high-definition streaming of films and series. It provides first-class support for real-time synchronized watch parties and deep native integration as a Telegram Mini App.

Featuring a luxury dark cinematic design system (Obsidian Luxury Red), the platform leverages hybrid cloud reverse tunnels, edge caching proxies, and multi-CDN failover networks to deliver ultra-stable, zero-buffering media streams across distributed networks.


✨ Key Features

πŸ‘₯ 1. Synchronized Watch Parties

  • Zero-Lag Real-Time Sync: Frame-accurate synchronization for playback, pausing, seeking, and episode transitions across all room participants via WebSockets and Socket.io.
  • Integrated Interactive Chat: Live room chat featuring floating animated emoji reactions, replies, and distinctive roles for hosts, moderators, and viewers.
  • Granular Room Administration: Create public lobbies or passcode-protected private screening rooms with dynamic host-to-moderator permission delegation.

πŸ“± 2. Native Telegram Mini App Ecosystem

  • Instant, seamless launch directly as a Telegram WebApp inside chat threads without external browser redirects.
  • Unified zero-click authentication utilizing cryptographic Telegram WebApp InitData session verification.
  • Intelligent companion Telegram bot for instant media search, room invitation sharing, and content broadcasting.

πŸŽ₯ 3. Advanced AlexPlayer Engine

  • Custom-built HLS video player supporting adaptive multi-bitrate streaming, auto skip-intro, and variable playback speeds.
  • Multi-track audio and subtitle support wrapped in a distraction-free dark theater frame.
  • Intelligent automatic failover switching across redundant upstream streaming endpoints.

🌐 4. Hybrid Reverse Tunnel Architecture

  • Nginx edge reverse proxy handling dynamic stream routing, URL rewriting, and caching across multiple CDN nodes.
  • Dedicated daemon watchdog ensuring 24/7 tunnel health, connection monitoring, and automatic failover.

πŸ—οΈ Architecture & Tech Stack

graph TD
    Client["Client (Browser / Telegram Mini App)"]
    EdgeProxy["Edge Reverse Proxy (Nginx / Caddy)"]
    NextApp["Next.js 16 Web & API Routes (:3000)"]
    SocketServer["Socket.io Rooms Server (:4000)"]
    Postgres[("PostgreSQL Database")]
    TgBot["Telegram Bot (:Python)"]
    Tunnel["Reverse Media Tunnel & CDN Failover"]

    Client -->|HTTPS / WSS| EdgeProxy
    EdgeProxy -->|/socket.io| SocketServer
    EdgeProxy -->|Web & API| NextApp
    EdgeProxy -->|/tunnel & /api/img| Tunnel
    NextApp --> Postgres
    SocketServer --> Postgres
    TgBot --> NextApp
Loading
Component Technology Role & Function
Frontend & API Next.js 16 (React 19, TypeScript) Cinematic user interface, catalog browsing, and backend API routes.
Styling TailwindCSS + Obsidian Design System Luxury dark theme with high-contrast obsidian depth and crimson neon glows.
Realtime Sync Node.js + Socket.io Ultra-low latency rooms server for synchronous playback and live chat.
Database & ORM PostgreSQL + Prisma ORM Persistent storage for accounts, watch party rooms, messages, and bookmarks.
Authentication Clerk Auth + Telegram WebApp Auth Secure dual authentication supporting modern web browsers and Telegram sessions.
Bots & Automation Python 3 (Telebot / Pyrogram) Official Telegram companion bot and automated media ingestion tooling.
Containerization Docker & Docker Compose Containerized service isolation, environment consistency, and one-command deployment.

πŸ“ Project Structure

alex-cinema/
β”œβ”€β”€ docs/                       # Technical documentation, deployment, and recovery guides
β”‚   β”œβ”€β”€ DISASTER_RECOVERY.md    # Disaster recovery and server migration runbook
β”‚   └── DOCKER_DEPLOYMENT.md    # Production deployment guide via Docker Compose
β”œβ”€β”€ docker/                     # Container configuration and reverse proxy setups
β”‚   β”œβ”€β”€ caddy/                  # Caddy configuration for automatic TLS termination
β”‚   β”œβ”€β”€ nginx/                  # Media cache and reverse proxy rules
β”‚   β”œβ”€β”€ postgres/               # Database backup and restoration routines
β”‚   └── tunnel-sshd/            # Restricted reverse SSH tunnel daemon
β”œβ”€β”€ prisma/                     # Database schema definitions and migration history
β”‚   β”œβ”€β”€ schema.prisma           # Prisma schema with relational models
β”‚   └── migrations/             # Timestamped SQL migration files
β”œβ”€β”€ public/                     # Static assets, branding logos, and icons
β”œβ”€β”€ scripts/                    # Automation scripts for deployment and maintenance
β”‚   β”œβ”€β”€ backup-docker.sh        # Automated database backup and SHA-256 validation
β”‚   β”œβ”€β”€ deploy-docker.sh        # Safe zero-downtime containerized deployment script
β”‚   └── generate_bot_cover.js   # Dynamic Telegram bot branding generator
β”œβ”€β”€ src/                        # Main application source code
β”‚   β”œβ”€β”€ app/                    # Next.js App Router pages and API routes
β”‚   β”‚   β”œβ”€β”€ api/                # Backend endpoints (auth, rooms, img proxy, etc.)
β”‚   β”‚   β”œβ”€β”€ movies/             # Movie catalog and detail view routes
β”‚   β”‚   β”œβ”€β”€ series/             # TV series and season navigation routes
β”‚   β”‚   └── room/               # Real-time watch party room interface
β”‚   β”œβ”€β”€ components/             # Reusable UI component library
β”‚   β”‚   β”œβ”€β”€ player/             # Custom AlexPlayer video engine
β”‚   β”‚   β”œβ”€β”€ room/               # Watch party controls, participant lists, and chat
β”‚   β”‚   └── telegram/           # Native Telegram Mini App bridge components
β”‚   └── lib/                    # Shared utilities, crypto helpers, and auth clients
β”œβ”€β”€ socket-server.js            # Standalone Socket.io real-time synchronization server
β”œβ”€β”€ telegram_bot.py             # Official Telegram companion bot
β”œβ”€β”€ tunnel_watchdog_vps.js      # Media tunnel stability and watchdog monitor
β”œβ”€β”€ compose.yaml                # Multi-container production Docker Compose definition
β”œβ”€β”€ DESIGN.md                   # Strict visual guidelines and design tokens
β”œβ”€β”€ PRODUCT.md                  # Product specifications and feature requirements
└── PROJECT_MEMORY.md           # Core architectural memory and engineering reference

πŸš€ Getting Started

Prerequisites:

  • Node.js: v18.0 or newer (v20 / v22 recommended).
  • Python: v3.10 or newer (for companion bot).
  • PostgreSQL: v15 or newer.
  • Docker & Docker Compose: (for containerized setup).

πŸ’» Local Development Setup:

  1. Clone the repository:

    git clone https://github.com/Gaoc3/alex-cinema.git
    cd alex-cinema
  2. Install dependencies:

    npm install
  3. Configure environment variables:

    cp .env.example .env
    # Edit .env with your database URL, Clerk keys, and secret tokens
  4. Initialize database schema:

    npx prisma generate
    npx prisma migrate deploy
  5. Start development services:

    • Start web application:
      npm run dev
    • Start real-time socket server (in a separate terminal):
      node socket-server.js
    • Start Telegram companion bot (optional):
      pip install -r requirements-bot.txt
      python telegram_bot.py

🐳 Production Deployment

Option 1: Docker Compose (Recommended)

The platform includes an automated Compose stack isolating each service with health checks, automated backups, and SSL management:

# 1. Prepare host environment
sudo ./scripts/install-docker-debian.sh
./scripts/prepare-docker.sh

# 2. Configure environment variables
nano .env.docker

# 3. Launch full stack
./scripts/deploy-docker.sh

For advanced edge routing and router setup, consult the Docker Deployment Guide.

Option 2: Traditional Host Deployment (PM2)

npm run build
pm2 start socket-server.js --name alex-socket
pm2 start npm --name cinemana -- start
pm2 start python3 --name alex-telegram-bot -- telegram_bot.py
pm2 save

πŸ›‘οΈ Security & Privacy

  • Zero Secret Leakage: No private keys, credentials, or production tokens are committed to source control.
  • Ephemeral Tokens: Watch party sessions and socket connections are secured with time-limited JWTs (SOCKET_AUTH_SECRET).
  • Automated Backup & Verification: Automated database backups with cryptographic SHA-256 checksum verification.

πŸ‘¨β€πŸ’» Author & Lead Architect

  • Hussain Ibrahim Ahmed (Gaoc3)
    Systems & Backend Software Engineer | Distributed Infrastructure & DevOps
    LinkedIn β€’ GitHub β€’ Email

πŸ“„ License

All rights reserved to AleX Cinema Β© 2026.

About

Modern Real-Time Social Streaming Platform built with Next.js 16, TypeScript, Socket.io, PostgreSQL, Prisma ORM, Docker Compose & Nginx.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages