{"id":22320674,"url":"https://github.com/itsminar/video-platform-backend","last_synced_at":"2026-03-16T12:36:05.372Z","repository":{"id":205545324,"uuid":"713019326","full_name":"itsMinar/video-platform-backend","owner":"itsMinar","description":"A REST API for Video Platform using ExpressJS and MongoDB, enabling smooth video upload, management and user management.","archived":false,"fork":false,"pushed_at":"2024-08-21T20:09:15.000Z","size":503,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-08-22T09:29:08.242Z","etag":null,"topics":["expressjs","javascript","mongodb","nodejs","rest-api"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/itsMinar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-01T17:12:21.000Z","updated_at":"2024-08-21T20:09:19.000Z","dependencies_parsed_at":"2024-01-15T10:11:10.205Z","dependency_job_id":"1cf9ea72-6f4f-437a-bc30-af8cf9b339fe","html_url":"https://github.com/itsMinar/video-platform-backend","commit_stats":null,"previous_names":["itsminar/video-platform-backend"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsMinar%2Fvideo-platform-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsMinar%2Fvideo-platform-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsMinar%2Fvideo-platform-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsMinar%2Fvideo-platform-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itsMinar","download_url":"https://codeload.github.com/itsMinar/video-platform-backend/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228017831,"owners_count":17856842,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["expressjs","javascript","mongodb","nodejs","rest-api"],"created_at":"2024-12-04T00:14:27.439Z","updated_at":"2026-03-16T12:36:05.291Z","avatar_url":"https://github.com/itsMinar.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VideoTube - Video Platform Backend API\n\n### This repository contains the backend service for VideoTube, a video platform. The service is built with Node.js, Express.js, MongoDB (Mongoose), and Cloudinary.\n\n## Postman Documentation\n\n#### You can find the complete API documentation at the following link:\n\n### 🔗[Postman API Documentation](https://documenter.getpostman.com/view/17734776/2sAXxS8X9i)\n\n## Table of Contents\n\n- [Features](#features)\n- [Installation and Running the Server](#installation-and-running-the-server)\n- [Usage](#usage)\n- [API Endpoints](#api-endpoints)\n  - [User](#user)\n  - [Video](#video)\n  - [Subscription](#subscription)\n  - [Playlist](#playlist)\n  - [Like](#like)\n  - [Comment](#comment)\n  - [Dashboard](#dashboard)\n  - [Tweet](#tweet)\n- [Environment Variables](#environment-variables)\n\n## Features\n\n### User Authentication and Management\n\n- **User Registration**: Allows new users to create an account by providing necessary details such as username, email, and password.\n- **User Login**: Users can log in to their accounts using their email and password.\n- **Token-based Authentication**: Implements JWT for secure user authentication and authorization.\n- **Refresh Tokens**: Supports token refresh to keep users logged in without requiring frequent logins.\n- **User Profile Management**: Users can view and update their profile details, including changing passwords and updating avatar and cover images.\n- **Account Security**: Provides endpoints for users to change their password to maintain account security.\n- **Logout**: Users can log out of their accounts, invalidating their current session.\n\n### Video Uploading and Management\n\n- **Video Upload**: Users can upload videos to the platform, with the videos being stored and managed using Cloudinary.\n- **Video Details Management**: Users can update video details such as title, description.\n- **Video Retrieval**: Allows retrieval of all videos or specific videos by ID.\n- **Video Deletion**: Users can delete their own videos from the platform.\n\n### Subscription Management\n\n- **Subscribe/Unsubscribe Channels**: Users can subscribe to or unsubscribe from other user channels.\n- **Subscription Status**: Check the subscription status of channels.\n- **Subscribers and Subscribed Channels**: Retrieve the list of subscribers to a user's channel and the list of channels a user is subscribed to.\n\n### Playlist Creation and Management\n\n- **Create Playlist**: Users can create new playlists to organize their favorite videos.\n- **Update Playlist**: Users can update playlist details such as title and description.\n- **Delete Playlist**: Users can delete their own playlists.\n- **Manage Playlist Videos**: Add or remove videos from playlists.\n- **Retrieve Playlists**: Get details of specific playlists and all playlists created by a user.\n\n### Video Liking and Commenting\n\n- **Like/Dislike Videos**: Users can like or dislike videos.\n- **Comment on Videos**: Users can add comments to videos to engage with other users.\n- **Manage Comments**: Users can update or delete their own comments on videos.\n- **Like/Dislike Comments**: Users can like or dislike comments on videos.\n\n### User Channel Statistics and Video Management\n\n- **Channel Statistics**: Provides various statistics about a user's channel, such as the number of subscribers, total views, etc.\n- **Channel Videos**: Retrieve all videos uploaded by a user to their channel.\n\n### Tweet Creation and Management\n\n- **Create Tweets**: Users can post tweets, which can be used for short updates or announcements.\n- **Manage Tweets**: Users can update or delete their own tweets.\n- **Retrieve User Tweets**: Get all tweets posted by a specific user.\n\n## Installation and Running the Server\n\n1. Clone the project repository:\n\n   ```bash\n   git clone https://github.com/itsMinar/video-platform-backend.git\n   ```\n\n2. Navigate to the project directory.\n\n   ```bash\n   cd video-platform-backend\n   ```\n\n3. Set up environment variables (see [Environment Variables](#environment-variables)).\n\n### Run Normally\n\n1. Ensure you have [NodeJs](https://www.nodejs.org/), [MongoDB](https://www.mongodb.com) and [MongoDB Compass (optional)](https://www.mongodb.com/products/compass) installed on your machine.\n\n2. Install dependencies:\n\n   ```bash\n   npm install\n   ```\n\n3. Start the server:\n\n   ```bash\n   npm start\n   ```\n\n### Run with Docker\n\n1. Ensure you have [Docker](https://www.docker.com) installed on your machine.\n\n2. Start the server:\n\n   ```bash\n   docker-compose up -d\n   ```\n\n## Usage\n\nOnce the server is running, you can interact with the API using an HTTP client like Postman or through your frontend application.\n\n## API Endpoints\n\n### Health Check\n\n- `GET /health`: Check the Application health that everything is ok or not\n\n### User\n\n- `POST /api/v1/users/register`: Register a new user\n- `POST /api/v1/users/login`: Log in a user\n- `POST /api/v1/users/logout`: Log out the current user\n- `POST /api/v1/users/refresh-token`: Refresh the access token\n- `GET /api/v1/users/current-user`: Get the current user's information\n- `POST /api/v1/users/change-password`: Change the current user's password\n- `PATCH /api/v1/users/update-account`: Update the current user's account details\n- `PATCH /api/v1/users/avatar`: Update the current user's avatar\n- `PATCH /api/v1/users/cover-image`: Update the current user's cover image\n- `GET /api/v1/users/c/:username`: Get a user's channel profile\n- `GET /api/v1/users/history`: Get the current user's watch history\n- `PATCH /api/v1/users/clear-history`: Clear the current user's watch history\n\n### Video\n\n- `GET /api/v1/videos`: Get all videos\n- `POST /api/v1/videos`: Upload a new video\n- `GET /api/v1/videos/:videoId`: Get a video by ID\n- `PATCH /api/v1/videos/:videoId`: Update a video\n- `DELETE /api/v1/videos/:videoId`: Delete a video\n\n### Subscription\n\n- `POST /api/v1/subscriptions/c/:channelId`: Toggle subscription\n- `GET /api/v1/subscriptions/c/:channelId`: Get a user's channel subscribers\n- `GET /api/v1/subscriptions/u/:subscriberId`: Get subscribed channels\n\n### Playlist\n\n- `POST /api/v1/playlists`: Create a new playlist\n- `GET /api/v1/playlists/:playlistId`: Get a playlist by ID\n- `PATCH /api/v1/playlists/:playlistId`: Update a playlist\n- `DELETE /api/v1/playlists/:playlistId`: Delete a playlist\n- `PATCH /api/v1/playlists/add/:videoId/:playlistId`: Add a video to a playlist\n- `PATCH /api/v1/playlists/remove/:videoId/:playlistId`: Remove a video from a playlist\n- `GET /api/v1/playlists/user/:userId`: Get the current user's playlists\n\n### Like\n\n- `GET /api/v1/likes/videos`: Get liked videos\n- `POST /api/v1/likes/toggle/v/:videoId`: Toggle like on a Video\n- `POST /api/v1/likes/toggle/c/:commentId`: Toggle like on a Comment\n- `POST /api/v1/likes/toggle/t/:tweetId`: Toggle like on a Tweet\n\n### Comment\n\n- `GET /api/v1/comments/:videoId`: Get comments for a video\n- `POST /api/v1/comments/:videoId`: Add a comment\n- `PATCH /api/v1/comments/c/:commentId`: Update a comment\n- `DELETE /api/v1/comments/c/:commentId`: Delete a comment\n\n### Dashboard\n\n- `GET /api/v1/dashboard/stats`: Get channel statistics\n- `GET /api/v1/dashboard/videos`: Get channel videos\n\n### Tweet\n\n- `POST /api/v1/tweets`: Create a new tweet\n- `GET /api/v1/tweets/user/:userId`: Get the current user's tweets\n- `PATCH /api/v1/tweets/:tweetId`: Update a tweet\n- `DELETE /api/v1/tweets/:tweetId`: Delete a tweet\n\n## Environment Variables\n\nCreate a `.env` file in the root directory and add the following variables:\n\n```plaintext\nPORT=8000\nCORS_ORIGIN=*\n\nMONGODB_URI=your-mongodb-url-connection-string\n\nACCESS_TOKEN_SECRET=your-jwt-secret\nACCESS_TOKEN_EXPIRY=1d\n\nREFRESH_TOKEN_SECRET=your-refresh-token-secret\nREFRESH_TOKEN_EXPIRY=10d\n\nCLOUDINARY_CLOUD_NAME=your-info\nCLOUDINARY_API_KEY=your-info\nCLOUDINARY_API_SECRET=your-info\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsminar%2Fvideo-platform-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitsminar%2Fvideo-platform-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsminar%2Fvideo-platform-backend/lists"}