Skip to content

UserD40/NewTube

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VideoTube - YouTube Clone

A full-stack video sharing platform built with Next.js 15, featuring video transcoding, real-time features, content moderation, and YouTube-style UI.

License Next.js TypeScript

✨ Features

Core Video Platform

  • 🎥 Video Upload & Processing

    • Multi-quality transcoding (360p, 480p, 720p, 1080p)
    • Automatic thumbnail generation
    • FFmpeg-based processing pipeline
    • Queue-based background processing with BullMQ
  • 👤 User Authentication

    • Email/password registration
    • Secure session management
    • Profile customization
    • Avatar uploads
  • 🎨 Modern UI

    • Dark mode YouTube-style interface
    • Responsive design (mobile & desktop)
    • Custom gradient logo
    • Horizontal scrolling content rows (Trending, New, Recommended, Subscriptions)

Social Features

  • 💬 Comments System

    • Nested comments with replies
    • Real-time updates
    • Like/dislike comments
  • 👍 Reactions

    • Like/dislike videos
    • View counts
    • Engagement tracking
  • 🔔 Subscriptions

    • Follow channels
    • Subscription feed
    • Subscriber counts
  • 🔍 Search & Discovery

    • Full-text video search
    • Trending videos
    • Personalized recommendations
    • New videos feed

Content Moderation & Legal

  • 🛡️ Hash-based Content Safety

    • SHA256/MD5 hashing of all uploads
    • Blocked content database (CSAM, terrorism detection)
    • Automatic rejection of flagged content
  • 📋 Reporting System

    • Public content reporting form
    • Anonymous reporting support
    • Priority flagging for critical violations
    • Rate limiting to prevent abuse
  • ⚖️ DMCA Compliance

    • Copyright takedown notice submission
    • 24-hour response commitment
    • Full 17 USC 512(c) compliance
  • 👮 Admin Moderation Dashboard

    • Review pending reports
    • One-click video takedowns
    • Three-strike user system
    • Complete audit logging

Technical Features

  • Performance

    • Redis caching
    • Rate limiting on all APIs
    • Optimized database queries
    • CDN-ready architecture
  • 🔒 Security

    • JWT session tokens
    • XSS/CSRF protection
    • Input validation & sanitization
    • SQL injection prevention
    • Secure file uploads

🏗️ Tech Stack

Frontend

  • Next.js 15.5.4 - React framework with App Router
  • TypeScript - Type safety
  • Tailwind CSS - Utility-first styling
  • Lucide React - Icon library

Backend

  • Next.js API Routes - RESTful API
  • MySQL 8.0 - Primary database
  • Redis - Caching & sessions
  • BullMQ - Job queue for video processing

Video Processing

  • FFmpeg - Video transcoding
  • Fluent-FFmpeg - Node.js wrapper
  • Multiple quality outputs - 360p to 1080p

Infrastructure

  • PM2 - Process management
  • Nginx - Reverse proxy
  • Linode - Hosting platform

📁 Project Structure

video-platform/
├── src/
│   ├── app/                    # Next.js App Router pages
│   │   ├── api/               # API endpoints
│   │   ├── admin/             # Admin dashboard
│   │   ├── upload/            # Upload page
│   │   ├── watch/             # Video player
│   │   ├── channel/           # Channel pages
│   │   ├── search/            # Search page
│   │   ├── dmca/              # DMCA form
│   │   ├── report/            # Report form
│   │   └── terms/             # Legal pages
│   ├── components/            # React components
│   │   ├── layout/           # Header, Logo
│   │   ├── video/            # VideoCard, VideoPlayer
│   │   └── ui/               # Reusable UI components
│   ├── lib/                   # Utilities & services
│   │   ├── db/               # Database connections
│   │   ├── auth.ts           # Authentication
│   │   ├── storage.ts        # File storage
│   │   └── contentSafety.ts  # Content moderation
│   └── middleware/            # Request middleware
├── workers/                   # Background job workers
│   └── video-processor.ts    # Video transcoding worker
├── scripts/                   # Utility scripts
│   ├── setup-database.sql    # Database schema
│   └── grant-moderator.sh    # Admin access script
└── public/                    # Static assets

🚀 Getting Started

Prerequisites

  • Node.js 18+
  • MySQL 8.0
  • Redis
  • FFmpeg

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/videotube.git
    cd videotube
  2. Install dependencies

    npm install
  3. Setup environment variables

    cp .env.example .env.local

    Edit .env.local with your configuration

  4. Setup database

    mysql -u root -p < scripts/setup-database.sql
    mysql -u root -p < scripts/add-moderation-tables.sql
  5. Run development server

    npm run dev
  6. Start video processing worker

    npm run worker

Visit http://localhost:3000

📊 What I Learned Building This

This project taught me about:

  • Video processing pipelines - FFmpeg transcoding, queue management
  • Real-time features - Live updates, subscriptions
  • Content moderation - Hash-based detection, legal compliance
  • Scalability challenges - Database optimization, caching strategies
  • Infrastructure costs - Why YouTube loses money!

⚠️ Production Considerations

Running a production video platform requires:

  • Significant infrastructure costs ($1000s/month for storage)
  • Legal compliance (DMCA agent registration)
  • Content moderation team
  • CDN for global delivery
  • Scalable storage solution

This is a learning/portfolio project, not production-ready without major investment.

📄 License

MIT License - See LICENSE file for details

🙏 Acknowledgments

Built as a learning project to understand full-stack development and video platform architecture.


Note: YouTube loses money for a reason! This project helped me understand why. 😅

About

censorship free video hosting platform

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages