A backend for a YouTube-like website. This project is built using Node.js, Express, MongoDB, and Mongoose, featuring user authentication, video uploads, playlist management, and more.
- User authentication (sign up, login, token-based authentication)
- Video upload and storage (using Cloudinary)
- Playlist management
- Commenting system
- Secure password handling (using bcrypt)
- Token-based authentication (JWT)
- Cross-origin resource sharing (CORS)
- Environment variable configuration (dotenv)
- Node.js: JavaScript runtime
- Express.js: Web framework
- MongoDB & Mongoose: NoSQL database and ODM for database modeling
- JWT: Secure user authentication
- Cloudinary: Cloud storage for video uploads
- Multer: Middleware for handling file uploads
- bcrypt: Password hashing
- dotenv: Environment variable management
To run this project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/ateendra24/Youtube-Backend/.git
-
Navigate to the project directory:
cd Youtube-Backend -
Install dependencies:
npm install
-
Set up your environment variables. Create a
.envfile in the root directory and add the following:PORT=8000 MONGODB_URL= CORS_ORIGIN=* ACCESS_TOKEN_SECRET= ACCESS_TOKEN_EXPIRY=1d REFRESH_TOKEN_SECRET= REFRESH_TOKEN_EXPIRY=10d CLOUDINARY_CLOUD_NAME= CLOUDINARY_API_KEY= CLOUDINARY_API_SECRET= -
Start the development server:
npm run dev
Here are some of the key endpoints provided by this backend:
-
User Authentication
- POST
/users/register– User registration - POST
/users/login– User login
- POST
-
Videos
- POST
/videos/– Upload a video - GET
/videos/:id– Get video details - DELETE
/videos/:id– Delete a video
- POST
-
Playlists
- POST
/playlist/– Create a new playlist - GET
/playlists/:id– Get playlist details
- POST
-
Comments
- POST
/comments/:videoId/– Add a comment to a video - GET
/comments/:videoId/– Get comments for a video
- POST
This project is licensed under the ISC License.
Created by Ateendra Pratap Solanki