Skip to content

Latest commit

Β 

History

History
103 lines (79 loc) Β· 3.9 KB

File metadata and controls

103 lines (79 loc) Β· 3.9 KB

Ticket-Gated Video Streaming Platform

A ticket-gated HTML5 video streaming platform with two independently deployable services sharing JWT-based playback authentication.

πŸ“š Documentation

  • GETTING_STARTED.md β€” Start here! Complete step-by-step guide to set up and run the system locally
  • PDR.md β€” Full product specification, data model, API contracts, and deployment topologies
  • IMPLEMENTATION_PLAN.md β€” Development task breakdown and work streams
  • DEPLOYMENT.md β€” Production deployment guide (Docker, cloud platforms)

Architecture

Service Framework Directory Port
Platform App Next.js 14+ (TypeScript) platform/ 3000
HLS Media Server Express.js (TypeScript) hls-server/ 4000
Shared TypeScript types/constants shared/ β€”

Prerequisites

  • Node.js 20+ (see .nvmrc)
  • npm 10+

Quick Start

πŸ‘‰ For detailed setup instructions, see GETTING_STARTED.md

TL;DR

# 1. Install dependencies
npm install

# 2. Generate secrets and admin password
npm run hash-password
node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"

# 3. Configure environment
cp .env.example .env
# Edit .env with generated secrets

# 4. Initialize database
cd platform
set -a
source ../.env
set +a
npx prisma migrate dev --name init
npx prisma generate
npx prisma db seed        # Optional: sample data

# 5. Start services (in separate terminals)
cd platform && set -a && source ../.env && set +a && PORT=3000 npm run dev      # Terminal 1: Port 3000
cd hls-server && set -a && source ../.env && set +a && npm run dev    # Terminal 2: Port 4000

Access the application:

Project Structure

β”œβ”€β”€ shared/               # Shared types, constants, and utilities
β”‚   └── src/
β”‚       β”œβ”€β”€ types.ts      # Domain types (JWT claims, API responses)
β”‚       β”œβ”€β”€ constants.ts  # Shared constants (rate limits, timeouts)
β”‚       β”œβ”€β”€ jwt.ts        # JWT utility functions
β”‚       └── validation.ts # Input validation helpers
β”œβ”€β”€ platform/             # Next.js Platform App
β”‚   β”œβ”€β”€ prisma/           # Database schema and migrations
β”‚   └── src/
β”‚       β”œβ”€β”€ app/          # Next.js App Router (pages + API routes)
β”‚       β”œβ”€β”€ components/   # React components (UI, player, admin, viewer)
β”‚       β”œβ”€β”€ hooks/        # Custom React hooks
β”‚       └── lib/          # Server-side utilities (JWT, auth, DB)
β”œβ”€β”€ hls-server/           # Express.js HLS Media Server
β”‚   └── src/
β”‚       β”œβ”€β”€ middleware/    # JWT auth, CORS, logging
β”‚       β”œβ”€β”€ routes/       # Stream serving, health, admin cache
β”‚       β”œβ”€β”€ services/     # Revocation cache, upstream proxy, cache mgmt
β”‚       └── utils/        # Path safety, hashing

Environment Variables

See .env.example for a complete reference with documentation.

Development Workflow

  • Both services share the @streaming/shared workspace package
  • Changes to shared/ are immediately available in both services (no build step)
  • Use npx prisma studio to inspect the database visually
  • HLS test streams should be placed in ./streams/<eventId>/ hls-server/streams//`

Need Help?