This repository contains the backend code for a YouTube clone created using Node.js, Express, and MongoDB. This backend server provides the necessary APIs to handle user authentication, video uploading, comments, likes, and more, mimicking the basic functionalities of YouTube.
- User authentication (sign up, login, logout)
- Video uploading and management
- Commenting on videos
- Like/Dislike videos
- Subscription functionality
- User profile management
- Search functionality
- ...and more!
Before you begin, ensure you have met the following requirements:
- Node.js installed
- MongoDB installed and running
- npm or yarn package manager installed
-
Clone the repository:
git clone https://github.com/Anubhavbaranwal/PlayTime.git
-
Navigate to the project directory:
cd PlayTime
-
Install dependencies:
npm install # or yarn install
-
Create a
.env
file in the root directory and set the following environment variables:PORT= MONGODB_URI= CORS_ORIGIN= ACCESS_TOKEN_SECRET= ACCESS_TOKEN_EXPIRY= REFRESH_TOKEN_SECRET= REFRESH_TOKEN_EXPIRY= CLOUDINARY_CLOUD_NAME= CLOUDINARY_CLOUD_APIKEY= CLOUDINARY_CLOUD_APISECRET=
Adjust the values according to your preferences and setup.
-
Start the server:
npm start # or yarn start
-
The server will be running at
http://localhost:8000
by default.
- POST /api/v1/user/register: Register a new user.
- POST /api/v1/user/login: Login and receive an access token.
- POST /api/v1/user/logout: Logout and invalidate the access token.
- GET /api/v1/video: Get a list of all videos.
- GET /api/v1/videos/:id: Get details of a specific video.
- POST /api/v1/video: Upload a new video.
- POST /api/v1/comments/:videoId: Add a comment to a video.
- POST /api/v1/likes/toggle/v/:videoId: Like a video.
- ...and more!
For detailed information about each endpoint and their usage, refer to the API documentation.
Feel free to contribute by opening issues, providing feedback, or submitting pull requests.
This project is licensed under the MIT License.