A Node.js-powered backend for a video streaming platform, providing essential features like user authentication, video uploads, playlists, comments, likes, and subscriptions. The project follows a structured approach with controllers handling logic, models managing data, middlewares ensuring smooth processing, and routes defining API endpoints.
The backend is deployed and available at: wavytv-backend.vercel.app
This project is built using the following technologies:
- Node.js - JavaScript runtime for backend development
- Express.js - Web framework for handling routes and middleware
- MongoDB - NoSQL database for storing user and video data
- Cloudinary - Media storage and management for video uploads
- JWT (JSON Web Tokens) - Authentication and authorization mechanism
- src/controllers: Functions handling incoming requests and preparing responses.
- src/models: Database schemas and methods for different entities.
- src/routes: Express route definitions.
- src/middlewares: Reusable functions that run before controllers (e.g., error handling, logging).
- src/utils: Utilities for handling API response and error, and Cloudinary integration.
- src/db/db.js: Database connection logic.
- app.js: Initializes the Express app, routes and middleware.
- index.js: Main application entry point.
POST /api/auth/signup
- Create a new userPOST /api/auth/login
- Login a userPOST /api/auth/logout
- Logout userPOST /api/auth/token
- Generate new access token
-
GET /api/user
- Get current user details -
PATCH /api/user
- Update current user details (i.e fullName, username, password) -
GET /api/user/channel/:username
- Get user channel details -
PATCH /api/user/channel/:username
- Update user channel details (i.e avatar, coverImage) -
PATCH /api/user/security
- Change password -
GET /api/user/history
- Get user watch history
-
GET /api/video
- Get all videos -
POST /api/video
- Upload a video -
GET /api/video/:videoId
- Get a video by id -
POST /api/video/:videoId
- Update video details (i.e title, description, thumbnail) -
DELETE /api/video/:videoId
- Delete video and its related data -
PATCH /api/video/:videoId
- Toggle video publish status (i.e public or private)
-
POST /api/tweet
- Create a new tweet -
GET /api/tweet/:tweetId
- Get a tweet by id -
PATCH /api/tweet/:tweetId
- Update a tweet -
DELETE /api/tweet/:tweetId
- Delete a tweet -
GET /api/tweet/user/:username
- Get all tweets by a user
-
GET /api/playlist
- Get all playlists created by a user -
POST /api/playlist
- Create playlist -
PATCH /api/playlist/:playlistId
- Update playlist details (i.e title, description) -
DELETE /api/playlist/:playlistId
- Delete a playlist -
POST /api/playlist/video
- Add a video to playlist -
GET /api/playlist/video
- Remove a video from playlist
GET /api/subscription
- Get channels which are subscribed by userGET /api/subscription/subscribers
- Get details of all subscribers of channelPOST /api/subscription/:channelId
- Toggle channel subscription (i.e subscribe and unsubscribe)
-
GET /api/comment/video/:videoId
- Get a video's comments -
POST /api/comment/video/:videoId
- Add comment on video -
GET /api/comment/tweet/:tweetId
- Get a tweet's comments -
POST /api/comment/tweet/:tweetId
- Add comment on tweet -
PATCH /api/comment/:commendId
- Update a comment -
DELETE /api/comment/:commendId
- Delete a comment
GET /api/like/video
- Get videos which are liked by userPOST /api/like/video/:videoId
- Toggle video likePOST /api/like/tweet/:tweetId
- Toggle tweet likePOST /api/like/comment/:commentId
- Toggle comment like
For any feedback or suggestions, feel free to reach out to me on X/Twitter
Also checkout this amazing Backend Playlist by @hiteshchoudhary. I’ve learned a lot about backend development from this playlist.