Skip to content

VideoTube is the platform where multiple people can create their own account and share the videos with world. Also user can create playlist of their video or other's video for future reference/ watch later. User can anytime make their video private/public or delete their content. The audience can like, save, share video or follow any user.

Notifications You must be signed in to change notification settings

Pranav8206/VideoTube

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

102 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎬 VideoTube - YouTube Clone

VideoTube is a full-stack web application inspired by YouTube, built with the MERN stack (MongoDB, Express.js, React, Node.js). It allows users to upload, watch, like, comment on videos, and subscribe to channels.


πŸ“‹ Table of Contents


πŸš€ Features

  • πŸ” JWT Authentication - Secure user registration and login
  • πŸ“€ Video Upload - Upload videos with thumbnails
  • ▢️ Video Streaming - Watch videos with responsive player
  • πŸ‘ Like System - Like videos, comments, and tweets
  • πŸ’¬ Comments - Add, edit, and delete comments
  • πŸ“Š Channel Analytics - View channel statistics and metrics
  • πŸ“œ Subscriptions - Subscribe/unsubscribe to channels
  • πŸ“ Tweet System - Create and interact with tweet-like posts
  • ❀️ Playlists - Create and manage video playlists
  • πŸ“± Responsive Design - Works on desktop and mobile devices
  • ⚑ Performance Optimized - Fast loading with pagination

πŸ› οΈ Tech Stack

Frontend

  • React - UI framework
  • Tailwind CSS - Styling
  • Axios - HTTP client
  • React Router - Navigation
  • Context API - State management

Backend

  • Node.js - Runtime environment
  • Express.js - Web framework
  • MongoDB - Database
  • Mongoose - ODM
  • JWT - Authentication
  • Bcrypt - Password hashing
  • Multer - File uploads
  • Cloudinary - Media storage (optional)

Development Tools

  • Nodemon - Development server
  • Postman - API testing

πŸ“– API Documentation

Base URL

http://localhost:5000/api/v1

All endpoints (except auth endpoints) require JWT authentication via Bearer token.

Authentication Endpoints

Method Endpoint Description Auth Required
POST /users/register Register new user No
POST /users/login Login user No
POST /users/logout Logout user Yes
POST /users/refresh-token Refresh access token No
GET /users/current-user Get current user Yes
POST /users/change-password Change password Yes
PATCH /users/update-account Update account Yes
PATCH /users/avatar Update avatar Yes
PATCH /users/cover-image Update cover image Yes
GET /users/c/:username Get channel profile No
GET /users/history Get watch history Yes
DELETE /users Delete account & videos Yes

Video Endpoints

Method Endpoint Description Auth Required
GET /videos Get all videos No
POST /videos/publish Upload video Yes
GET /videos/:videoId Get video details No
PATCH /videos/:videoId/edit Update video Yes
DELETE /videos/:videoId Delete video Yes
PATCH /videos/:videoId Toggle publish status Yes

Subscription Endpoints

Method Endpoint Description Auth Required
POST /subscriptions/:channelId Toggle subscription Yes
GET /subscriptions/:channelId Get subscribers Yes
GET /subscriptions Get subscribed channels Yes

Playlist Endpoints

Method Endpoint Description Auth Required
GET /playlists Get user playlists Yes
POST /playlists Create playlist Yes
GET /playlists/:playlistId Get playlist Yes
PATCH /playlists/:playlistId Update playlist Yes
DELETE /playlists/:playlistId Delete playlist Yes
PATCH /playlists/add/:playlistId/:videoId Add video to playlist Yes
PATCH /playlists/remove/:playlistId/:videoId Remove video from playlist Yes

Like Endpoints

Method Endpoint Description Auth Required
POST /likes/video/:videoId Toggle video like Yes
GET /likes/video/:videoId Get video likes count Yes
POST /likes/comment/:commentId Toggle comment like Yes
GET /likes/comment/:commentId Get comment likes count Yes
POST /likes/tweet/:tweetId Toggle tweet like Yes
GET /likes/tweet/:tweetId Get tweet likes count Yes
GET /likes Get user's liked videos Yes

Comment Endpoints

Method Endpoint Description Auth Required
GET /comments/:videoId Get video comments Yes
POST /comments/:videoId Add comment Yes
PATCH /comments/c/:commentId Update comment Yes
DELETE /comments/c/:commentId Delete comment Yes

Tweet Endpoints

Method Endpoint Description Auth Required
POST /tweets Create tweet Yes
GET /tweets/user/:username Get user tweets Yes
PATCH /tweets/:tweetId Update tweet Yes
DELETE /tweets/:tweetId Delete tweet Yes

Dashboard Endpoints

Method Endpoint Description Auth Required
GET /dashboard/stats/:userId Get channel stats Yes
GET /dashboard/videos/:userId Get channel videos Yes

Health Check

Method Endpoint Description Auth Required
GET /healthcheck Health check No

βš™οΈ Installation

Prerequisites

  • Node.js (v14 or higher)
  • MongoDB (local or Atlas)
  • npm or yarn

1. Clone the Repository

git clone https://github.com/Pranav8206/VideoTube.git
cd videotube

2. Backend Setup

cd backend
npm install

3. Frontend Setup

cd ../frontend
npm install

4. Environment Variables

Create a .env file in the backend directory:

PORT=5000
MONGODB_URI=mongodb://localhost:27017/videotube
JWT_SECRET=your_super_secret_jwt_key_here
JWT_REFRESH_SECRET=your_super_secret_refresh_key_here
CLOUDINARY_CLOUD_NAME=your_cloudinary_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret
CORS_ORIGIN=http://localhost:5173

5. Start the Application

# Start backend (from backend directory)
npm run dev

# Start frontend (from frontend directory, in a new terminal)
npm start

The application will be available at:


πŸ”§ Environment Variables

Variable Description Example
PORT Backend server port 5000
MONGODB_URI MongoDB connection string mongodb://localhost:27017/videotube
JWT_SECRET Secret key for JWT tokens your_jwt_secret
JWT_REFRESH_SECRET Secret key for refresh tokens your_refresh_secret
CLOUDINARY_* Cloudinary credentials for media storage (Optional)
CORS_ORIGIN Allowed origin for CORS http://localhost:5000

πŸ“ Project Structure

videotube/
|
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ controllers/     # Route controllers
β”‚   β”œβ”€β”€ db/              # Database configuration
β”‚   β”œβ”€β”€ middlewares/     # Custom middleware
β”‚   β”œβ”€β”€ models/          # MongoDB models
β”‚   β”œβ”€β”€ routes/          # API routes
β”‚   β”œβ”€β”€ utils/           # Utility functions
β”‚   └── app.js           # Express app setup
|
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ public/          # Static files
β”‚   └── src/
β”‚       β”œβ”€β”€ components/  # React components
β”‚       β”œβ”€β”€ pages/       # Page components
β”‚       β”œβ”€β”€ context/     # React context API
β”‚       └── utils/       # Utility functions
β”‚
└── README.md

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the project
  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

Please ensure your code follows the project's style guidelines and includes appropriate tests.


πŸ™ Acknowledgments

  • Inspired by YouTube
  • Built with the MERN stack
  • Icons from Lucide icons
  • UI components with Tailwind CSS

Note: This is a only portfolio project.

About

VideoTube is the platform where multiple people can create their own account and share the videos with world. Also user can create playlist of their video or other's video for future reference/ watch later. User can anytime make their video private/public or delete their content. The audience can like, save, share video or follow any user.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages