Skip to content

Hasher423/YT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

193 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎬 YouTube Clone - Full-Stack Video Platform

A modern MERN stack video platform featuring real-time video uploads, streaming, user interactions, and scalable state management with Redux. Built to showcase full-stack skills and best practices.


✨ Features

πŸ” Authentication & User Management

  • πŸ“ User Registration with channel creation (username, email, password, channel name, logo, banner)
  • πŸ”’ Secure Login/Logout using JWT tokens
  • πŸ–ΌοΈ Profile Management with custom logos & banners
  • 🎨 Channel Customization with unique branding

πŸ“Ή Video Management

  • πŸ“€ Video Upload with live progress tracking via Socket.io
  • ☁️ Cloud Storage via Cloudinary CDN
  • πŸ–±οΈ Drag & Drop Upload Interface

πŸ‘ Engagement Features

  • ❀️ Like/Dislike system with user tracking
  • πŸ’¬ Comments with real-time updates
  • πŸ§‘β€πŸ€β€πŸ§‘ Subscribe/Unsubscribe with live subscriber counts
  • πŸ‘€ View Counting (30-second rule for authentic views)

πŸ” Advanced Search

  • πŸ”Ž Full-text Search on video titles and descriptions
  • πŸ’‘ Search Suggestions on enter
  • ⚑ Instant Results with relevance scoring

πŸ“Š Analytics & Insights

  • πŸ“ˆ View Analytics with unique viewer tracking
  • πŸ‘ Engagement Metrics: likes, dislikes, comments count
  • πŸ§‘β€πŸ’Ό Subscriber Analytics with real-time updates
  • πŸ“Š Channel Performance Tracking

πŸ”” Real-time Features

  • ⏱️ Live Upload Progress via Socket.io events
  • πŸ’¬ Instant Comment Updates
  • πŸ§‘β€πŸ€β€πŸ§‘ Live Subscriber Counts

πŸ“± Responsive Design

  • πŸ“± Mobile-First Approach using Tailwind CSS
  • πŸ–οΈ Touch-Friendly Interface
  • πŸ–₯️ Optimized for All Screen Sizes

πŸ› οΈ Tech Stack

Frontend

  • React
  • Redux
  • TailwindCSS
  • Vite
  • Axios, React Router, Socket.io Client

Backend

  • Node.js
  • Express
  • MongoDB
  • Mongoose
  • Cloudinary
  • Socket.io, JWT, Bcrypt

πŸ“ Project Structure

β”œβ”€β”€ Frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ Components/
β”‚   β”‚   β”‚   β”œβ”€β”€ ChannelHome.jsx       # Channel homepage
β”‚   β”‚   β”‚   β”œβ”€β”€ ChannelInfo.jsx       # Channel information
β”‚   β”‚   β”‚   β”œβ”€β”€ ChannelVideos.jsx     # Channel videos list
β”‚   β”‚   β”‚   β”œβ”€β”€ Comments.jsx          # Video comments
β”‚   β”‚   β”‚   β”œβ”€β”€ CommentsSection.jsx   # Comments container
β”‚   β”‚   β”‚   β”œβ”€β”€ Controls.jsx          # Video controls
β”‚   β”‚   β”‚   β”œβ”€β”€ InteractionBar.jsx    # Like/dislike/subscribe
β”‚   β”‚   β”‚   β”œβ”€β”€ Loader.jsx            # Loading states
β”‚   β”‚   β”‚   β”œβ”€β”€ MainVideos.jsx        # Homepage videos
β”‚   β”‚   β”‚   β”œβ”€β”€ SearchBar.jsx         # Search functionality
β”‚   β”‚   β”‚   β”œβ”€β”€ SearchResults.jsx     # Search results display
β”‚   β”‚   β”‚   β”œβ”€β”€ SideBar.jsx           # Navigation sidebar
β”‚   β”‚   β”‚   β”œβ”€β”€ SideVideos.jsx        # Related videos
β”‚   β”‚   β”‚   β”œβ”€β”€ Socket.jsx            # Socket.io connection
β”‚   β”‚   β”‚   β”œβ”€β”€ VideoDescription.jsx  # Video details
β”‚   β”‚   β”‚   β”œβ”€β”€ VideoInfo.jsx         # Video metadata
β”‚   β”‚   β”‚   β”œβ”€β”€ Videoplay.jsx         # Video player
β”‚   β”‚   β”‚   β”œβ”€β”€ VideoPlayerElement.jsx # Enhanced player
β”‚   β”‚   β”‚   └── VideoWrapper.jsx      # Video container
β”‚   β”‚   β”œβ”€β”€ Pages/
β”‚   β”‚   β”‚   β”œβ”€β”€ ChannelProfile.jsx    # Channel page
β”‚   β”‚   β”‚   β”œβ”€β”€ Home.jsx              # Homepage
β”‚   β”‚   β”‚   β”œβ”€β”€ IsLoggedIn.jsx        # Auth wrapper
β”‚   β”‚   β”‚   β”œβ”€β”€ Login.jsx             # Login page
β”‚   β”‚   β”‚   β”œβ”€β”€ Signup.jsx            # Registration page
β”‚   β”‚   β”‚   β”œβ”€β”€ UploadVideo.jsx       # Video upload page
β”‚   β”‚   β”‚   └── VideoPlayer.jsx       # Video watch page
β”‚   β”‚   β”œβ”€β”€ Context/
β”‚   β”‚   β”‚   └── VideosContext.jsx     # Video state management
β”‚   β”‚   β”œβ”€β”€ Redux/
β”‚   β”‚   β”‚   β”œβ”€β”€ store.js              # Redux store
β”‚   β”‚   β”‚   └── features/
β”‚   β”‚   β”‚       β”œβ”€β”€ commentSlice.js   # Comments state
β”‚   β”‚   β”‚       └── videoSlice.js     # Videos state
β”‚   β”‚   └── utils/
β”‚   β”‚       └── Ago.js                # Time formatting
β”‚   └── public/
β”‚       └── assets/                   # Static assets
β”‚
β”œβ”€β”€ Backend/
β”‚   β”œβ”€β”€ Controllers/
β”‚   β”‚   β”œβ”€β”€ user.controller.js        # User management
β”‚   β”‚   β”œβ”€β”€ video.controller.js       # Video operations
β”‚   β”‚   β”œβ”€β”€ comment.controller.js     # Comments
β”‚   β”‚   β”œβ”€β”€ search.controller.js      # Search functionality
β”‚   β”‚   └── initSocket.controller.js  # Socket.io setup
β”‚   β”œβ”€β”€ Models/
β”‚   β”‚   β”œβ”€β”€ user.model.js             # User schema
β”‚   β”‚   β”œβ”€β”€ video.model.js            # Video schema
β”‚   β”‚   β”œβ”€β”€ comment.model.js          # Comment schema
β”‚   β”‚   └── videoView.js              # View tracking
β”‚   β”œβ”€β”€ Routes/
β”‚   β”‚   β”œβ”€β”€ user.routes.js            # User endpoints
β”‚   β”‚   β”œβ”€β”€ video.routes.js           # Video endpoints
β”‚   β”‚   β”œβ”€β”€ comment.routes.js         # Comment endpoints
β”‚   β”‚   └── search.routes.js          # Search endpoints
β”‚   β”œβ”€β”€ Services/
β”‚   β”‚   β”œβ”€β”€ user.service.js           # User business logic
β”‚   β”‚   β”œβ”€β”€ video.service.js          # Video operations
β”‚   β”‚   β”œβ”€β”€ comment.service.js        # Comment operations
β”‚   β”‚   β”œβ”€β”€ search.service.js         # Search algorithms
β”‚   β”‚   └── videoUpload.service.js    # Upload handling
β”‚   β”œβ”€β”€ Middlewares/
β”‚   β”‚   └── auth.middleware.js        # Authentication
β”‚   β”œβ”€β”€ Config/
β”‚   β”‚   β”œβ”€β”€ cloudinary.config.js      # Cloudinary setup
β”‚   β”‚   └── multer.config.js          # File upload config

πŸš€ Getting Started

Prerequisites

  • Node.js v16+
  • MongoDB Atlas account
  • Cloudinary account
  • Git

Installation

  1. Clone Repo
git clone https://github.com/HASHERprogrammer/yt.git
cd yt

2. **Backend Setup**
cd Backend
npm install
cp .env.example .env


3. **Environment Variables**
Create a `.env` file in the Backend directory:
```env
PORT=5000
MONGODB_URI=your_mongodb_atlas_connection_string
JWT_SECRET=your_jwt_secret_key
CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret
FRONTEND_URL=http://localhost:5173
  1. Start Backend Server
npm start
# or for development
npm run dev
  1. Frontend Setup
cd ../Frontend
npm install
  1. Frontend Environment Variables Create a .env file in the Frontend directory:
VITE_BACKEND_URI=http://localhost:3000
  1. Start Frontend Development Server
npm run dev
  1. Access the Application

πŸ“– API Documentation

Authentication Endpoints

  • POST /user/signup - User registration
  • POST /user/login - User login
  • POST /user/logout - User logout
  • GET /user/getuser - Get current user
  • GET /user/validate-token - Validate JWT token

Video Endpoints

  • POST /video/upload - Upload new video
  • GET /video/getvideos - Get all videos (pagination)
  • GET /video/getvideo?v=videoId - Get specific video
  • POST /video/increase-view/:videoId - Increment view count
  • POST /video/like/:videoId - Like/unlike video
  • POST /video/dislike/:videoId - Dislike/undislike video

Comment Endpoints

  • POST /comment/:videoId - Add comment
  • GET /comment/getcomments - Get all comments

Search Endpoints

  • GET /search?q=query - Search videos
  • GET /search/suggestions?q=query - Get search suggestions

User Endpoints

  • GET /user/getUserVideos/:userId - Get user's videos
  • POST /user/subscription/:channelId - Subscribe/unsubscribe
  • GET /user/isSubscribed/:channel - Check subscription status

Environment Variables for Production

  • Update all URLs to production domains
  • Set secure cookie flags
  • Configure CORS for production frontend
  • Set up SSL certificates

🀝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

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

πŸ‘₯ Contributors

πŸ™ Acknowledgments

  • βš›οΈ React community
  • πŸƒ MongoDB team
  • ☁️ Cloudinary
  • πŸ”Œ Socket.io team

πŸ“ž Support

For support, email hasher423@gmail.com


Built with ❀️ by HASHERprogrammer