This project is a complex backend project that is built with nodejs, expressjs, mongodb, mongoose, jwt, bcrypt, and many more. This project is a complete backend project that has all the features that a backend project should have. I tried to build a complete video hosting website with combination of tweets similar to youtube and twitter with all the features like login, signup, upload video, like, unlike, comment, subscribe, unsubscribe, tweets and many more.
Project uses all standard practices like JWT, bcrypt, access tokens, refresh Tokens and many more.
Services used for storing the data- mongoDB and cloudinary
-
/api/v1/users
-
/register
- POST - Registers an user-
/login
- POST - Logs in an user-
/logout
- POST - Logs out an user-
/change-password
- POST - Changes the password for the user-
/refresh-token
- POST - Generates new refresh token for the user-
/current-user
- GET - Gets the current user-
/watch-history
- GET - Gets the watch history of current user-
/channel/:username
- GET - Returns user channel profile-
/avatar
- PATCH - Updates the avatar of the user-
/cover-image
- PATCH - Updates the cover image of the user-
/update-account-details
- PATCH - Updates the account details of the user
-
/api/v1/videos
-
/publish-video
- POST - To upload the video-
/update-video/:videoId
- POST - Update video details(title, description and thumbnail)-
/toggle-publish-status/:videoId
- POST - Toggle the publish status of a video-
/get-all-videos
- GET - To fetch all videos of the user-
/:videoId
- GET - To fetch the video by video ID-
/delete-video/:videoId
- DELETE - To delete the video
-
/api/v1/tweets
-
/
- POST - To create a tweet-
/user/:userId
- GET - To get user tweets-
/:tweetId
- GET - To update the tweet-
/:tweetId
- DELETE - To delete the tweet
-
/api/v1/playlist
-
/:playlistId
- GET - To fetch the playlist -PATCH - To update the playlist -DELETE - To delete the playlist-
/add/:videoId/:playlistId
- PATCH - To add video to the playlist-
/remove/:videoId/:playlistId
- PATCH - To remove video from the playlist-
/user/:userId
- GET - To get user playlists
-
/api/v1/comments
-
/:videoId
- GET - To get video comments -POST - To comment onto a video-
/c/:commentId
- PATCH - To update the comment - DELETE- To delete the comment
-
/api/v1/likes
-
/toggle/v/:videoId
- POST - To toggle video like-
/toggle/c/:commentId
- POST - To toggle comment like-
/toggle/t/:tweetId
- POST - To toggle tweet like-
/videos
- GET - To get the liked videos of the logged in user
-
/api/v1/subscriptions
-
/c/:channelId
- GET - To get Channel Subscribers -POST - To toggle subscription on the channel-
/u/:subscriberId
- GET - To get Subscribed channels
-
/api/v1/dashboard
-
/stats
- GET - To get channel stats(logged in)-
/videos
- GET - TTo get channel videos(logged in)
Clone the project
git clone https://github.com/Vedant-20/youtube-backend.git
Go to the project directory
cd my-project
Install dependencies
npm install
Start the server
npm run dev