Skip to content

Video Tube, a YouTube backend clone, boasts robust features including user authentication with JWT tokens, advanced data manipulation with MongoDB aggregation pipelines, and optimized performance with pagination. Leveraging Redis for caching and Docker for containerization, it ensures seamless data interaction, prioritizing efficiency and security

Notifications You must be signed in to change notification settings

Harshit-3905/VideoTube-Backend

Repository files navigation

VideoTube-Backend

Complete Documentation

Backend Project Description

This project serves as the backend for a YouTube-like platform. It handles user authentication, video uploads, comments, likes, playlists, subscriptions, health checks, dashboard data, and now, tweets.

Technologies Used

  • Node.js: The runtime environment for executing JavaScript code on the server-side.
  • Express.js: A web application framework for Node.js used to build APIs and handle HTTP requests.
  • MongoDB: A NoSQL database used to store user data, videos, comments, and other related information.
  • Mongoose: An Object Data Modeling (ODM) library for MongoDB and Node.js, providing a straightforward schema-based solution to model application data.
  • Cloudinary: A cloud-based image and video management service used for uploading and managing media files.
  • Multer: A middleware for handling multipart/form-data, primarily used for uploading files.
  • JWT (JSON Web Token): A standard for securely transmitting information between parties as a JSON object. JWTs are used for user authentication and authorization.
  • Prettier: An opinionated code formatter used to maintain consistent coding styles across the project.
  • Cookie-parser: A middleware for parsing cookies attached to the client request object.
  • Cors: Middleware for enabling Cross-Origin Resource Sharing (CORS) in the Express.js framework.
  • Dotenv: A zero-dependency module that loads environment variables from a .env file into process.env.
  • Bcrypt: A library for hashing passwords, adding an extra layer of security to user authentication.

Controllers Used

  • User Controller: Manages user registration, login, logout, password change, and profile updates.
  • Video Controller: Handles video uploads and related operations.
  • Comment Controller: Manages comments on videos.
  • Tweet Controller: Deals with tweets, a new feature added to the platform.
  • Like Controller: Handles likes on videos or tweets.
  • Playlist Controller: Manages user playlists.
  • Subscription Controller: Handles user subscriptions.
  • Healthcheck Controller: Provides a health check endpoint for monitoring the server's status.
  • Dashboard Controller: Manages data for the dashboard section of the platform.

Middleware

Middleware functions are functions that have access to the request object (req), the response object (res), and the next middleware function in the application's request-response cycle. They are used to perform tasks such as parsing request bodies, authentication, logging, error handling, etc.

Cloudinary

Cloudinary is a cloud-based image and video management service that provides APIs for uploading, storing, managing, and delivering images and videos for web and mobile applications. In this project, Cloudinary is used for uploading user avatars, cover images, and video thumbnails.

Multer

Multer is a middleware for handling multipart/form-data, which is primarily used for uploading files. It allows you to handle file uploads in forms easily. In this project, Multer is used to upload media files such as avatars, cover images, and videos.

JWT (JSON Web Token)

JSON Web Tokens (JWTs) are a standard for securely transmitting information between parties as a JSON object. They can be used for user authentication and authorization. In this project, JWTs are used to generate access tokens and refresh tokens for user authentication.

Prettier

Prettier is an opinionated code formatter that ensures consistent coding styles across the project, making the codebase more readable and maintainable.

Cookie-parser

Cookie-parser is a middleware used for parsing cookies attached to the client request object. It simplifies the process of handling cookies in Express.js applications.

Cors

Cors is a middleware for enabling Cross-Origin Resource Sharing (CORS) in the Express.js framework. It allows the backend server to accept requests from client applications running on different origins or domains.

Dotenv

Dotenv is a zero-dependency module that loads environment variables from a .env file into process.env. It helps keep sensitive information like API keys, database credentials, etc., out of version control and makes it easy to manage different environments (development, production, testing).

Bcrypt

Bcrypt is a library used for hashing passwords, adding an extra layer of security to user authentication. It hashes passwords before storing them in the database, making it difficult for attackers to reverse-engineer the original passwords.

Setup Instructions

  1. Clone the repository
  2. Install dependencies: npm install
  3. Create a .env file and add environment variables such as PORT, MONGODB_URI, JWT_SECRET, etc.
  4. Start the server: npm start

About

Video Tube, a YouTube backend clone, boasts robust features including user authentication with JWT tokens, advanced data manipulation with MongoDB aggregation pipelines, and optimized performance with pagination. Leveraging Redis for caching and Docker for containerization, it ensures seamless data interaction, prioritizing efficiency and security

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published