Skip to content

Sonuolikkara/PeerFlix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PeerFlix 🎬

A peer-to-peer video streaming platform built with modern web technologies. Stream and share videos directly between peers using WebTorrent technology.

PeerFlix React TypeScript Node.js MongoDB

πŸŽ₯ Demo

Home Page

The main dashboard with a dark gaming-inspired UI featuring:

  • Featured Videos - Hero section showcasing top content
  • Trending Grid - Browse all available P2P videos
  • P2P Status Bar - Real-time network status and peer count
  • Category Filters - Filter videos by type

Video Player

Full-featured video player with:

  • Custom controls (play/pause, volume, fullscreen)
  • Progress bar with seek functionality
  • P2P network statistics (peers, download/upload speed)
  • Like, Share, Download buttons
  • Copy Magnet URI for P2P sharing

Upload System

Easy drag-and-drop video upload:

  • Supports all major video formats
  • Automatic P2P seeding after upload
  • Progress tracking
  • File size validation (max 500MB)

🎯 How to Use

1. Browse Videos

  • Open the homepage to see all available videos
  • Click on any video card to see details in the sidebar
  • Use category filters to narrow down content

2. Watch a Video

  • Click "Watch Now" on any video
  • The video streams via P2P if available
  • Monitor peer connections in the P2P stats panel

3. Upload a Video

  • Click the "Upload" button in the header
  • Drag & drop your video or click to browse
  • Wait for upload and P2P seeding to complete
  • Your video is now available to all peers!

4. Share via P2P

  • On the watch page, click "Copy Magnet"
  • Share the magnet URI with anyone
  • They can stream directly from peers without a central server

✨ Features

  • P2P Video Streaming - Stream videos directly between peers using WebTorrent
  • Video Upload - Upload videos that automatically get seeded to the P2P network
  • Real-time P2P Stats - Monitor active peers, download/upload speeds
  • Dark Gaming UI - Modern dark theme with glassmorphism effects
  • Responsive Design - Works on desktop and mobile devices
  • Magnet URI Support - Share videos via magnet links

πŸš€ Tech Stack

Frontend

  • React 18 + TypeScript
  • Vite (build tool)
  • TailwindCSS (styling)
  • TanStack Query (data fetching)
  • Wouter (routing)
  • Zustand (state management)

Backend

  • Node.js + Express
  • MongoDB (database)
  • WebTorrent (P2P streaming)
  • Multer (file uploads)

πŸ“¦ Installation

Prerequisites

  • Node.js 18+
  • MongoDB (running locally or connection string)
  • npm or yarn

Setup

  1. Clone the repository

    git clone https://github.com/Sonuolikkara/PeerFlix.git
    cd PeerFlix
  2. Install frontend dependencies

    npm install
  3. Install backend dependencies

    cd p2pStreaming-backend
    npm install
  4. Configure environment

    Create .env file in p2pStreaming-backend/:

    MONGO_URI=mongodb://localhost:27017/p2pStreaming
    PORT=3000
  5. Start MongoDB

    mongod
  6. Start the backend

    cd p2pStreaming-backend
    node index.js
  7. Start the frontend (in a new terminal)

    npm run dev
  8. Open in browser

🎯 API Endpoints

Method Endpoint Description
GET /api/videos Get all videos
GET /api/videos/:id Get video by ID
POST /api/videos/upload Upload a new video
GET /api/stats Get P2P network stats

πŸ”§ How P2P Streaming Works

  1. Upload - When you upload a video, WebTorrent creates a torrent and starts seeding
  2. Magnet URI - Each video gets a unique magnet URI for P2P sharing
  3. Peers - Other users can connect as peers to download/stream the video
  4. Trackers - Public WebTorrent trackers help peers discover each other

πŸ“ Project Structure

PeerFlix/
β”œβ”€β”€ client/                 # Frontend React app
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/     # UI components
β”‚   β”‚   β”œβ”€β”€ pages/          # Page components
β”‚   β”‚   β”œβ”€β”€ lib/            # Utilities & API
β”‚   β”‚   └── stores/         # Zustand stores
β”‚   └── public/             # Static assets
β”œβ”€β”€ p2pStreaming-backend/   # Backend Express server
β”‚   β”œβ”€β”€ config/             # DB & Multer config
β”‚   β”œβ”€β”€ controllers/        # Route controllers
β”‚   β”œβ”€β”€ models/             # MongoDB models
β”‚   β”œβ”€β”€ router/             # API routes
β”‚   └── utils/              # WebTorrent utilities
└── server/                 # Vite dev server

🀝 Contributing

Contributions are welcome! Feel free to:

  • Report bugs
  • Suggest features
  • Submit pull requests

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘€ Author

Sonu Olikkara Sabu


Made with ❀️ using React, Node.js & WebTorrent

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors