YouTube Clone - Backend A full-featured backend for a video-sharing platform built with Node.js, Express.js, and MongoDB, featuring secure JWT authentication, video processing, and advanced data aggregation.
After importing the collection, you will need to set up an environment variable to run the requests.
- Create a new environment in Postman.
- Add a variable named
server. - Set the value of the
servervariable to your local server address (e.g.,http://localhost:8000). - Make sure to select this environment in Postman before sending any requests.
About The Project This project is the complete backend infrastructure for a video-sharing platform modeled after YouTube. It provides a robust, scalable, and secure RESTful API to handle all server-side operations, from user authentication and video processing to complex data relationships like subscriptions, likes, comments, and playlists. The architecture is designed to efficiently support a dynamic, interactive front-end application. Tech Stack Backend Framework: Node.js, Express.js Database: MongoDB (with Mongoose as the ODM) Authentication: JWT (JSON Web Tokens), bcrypt File & Media Management: Cloudinary (for cloud storage), Multer (for file uploads) API Development: RESTful API Principles, Postman Environment Management: dotenv Key Features User Authentication: Secure user registration and login system with JWT access and refresh tokens. Video Management: Complete CRUD operations for videos, including uploads, updates, and deletion. Cloudinary Integration: Seamless video and image (thumbnails, avatars) uploads and management. Subscription System: Full functionality for users to subscribe and unsubscribe to channels. Like/Unlike System: Polymorphic "like" feature for videos, comments, and tweets. Commenting: Full CRUD functionality for comments on videos. Playlists: User-curated video playlists with complete management capabilities. Advanced Data Aggregation: Complex database queries using MongoDB's Aggregation Pipeline to generate: User Channel Profiles (subscriber counts, etc.) Creator Dashboards (total views, likes, subscribers, and videos) Tweet Functionality: A simple Twitter-like feature for users to post short text updates. Getting Started To get a local copy up and running, follow these simple steps. Prerequisites Node.js and npm installed MongoDB instance (local or cloud) A Cloudinary account Installation Clone the repository: git clone https://github.com/Noah-04/youtube-clone-backend.git
Navigate to the project directory: cd your-repo-name
Install NPM packages: npm install
Set up environment variables: Create a .env file in the root of the project and add the following variables: PORT=8000 MONGODB_URI=your_mongodb_connection_string CORS_ORIGIN=*
ACCESS_TOKEN_SECRET=your_access_token_secret ACCESS_TOKEN_EXPIRY=1d REFRESH_TOKEN_SECRET=your_refresh_token_secret REFRESH_TOKEN_EXPIRY=10d
CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name CLOUDINARY_API_KEY=your_cloudinary_api_key CLOUDINARY_API_SECRET=your_cloudinary_api_secret
Start the server: npm run dev