{"id":20026276,"url":"https://github.com/krishnendu-1/nexusmedia_backend","last_synced_at":"2026-04-03T23:35:16.558Z","repository":{"id":262132553,"uuid":"886226966","full_name":"Krishnendu-1/NexusMedia_Backend","owner":"Krishnendu-1","description":"NexusMedia Backend is a Node.js, Express, and MongoDB-powered backend for media applications. It supports user management, content uploads, and subscriptions with features like JWT-based authentication, Cloudinary storage, and MongoDB aggregations for efficient data retrieval. Ideal for developers needing secure, scalable backend infrastructure.","archived":false,"fork":false,"pushed_at":"2024-11-17T14:22:22.000Z","size":60,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-02T04:34:57.488Z","etag":null,"topics":["aggregation-pipleline","expressjs","jwt-authentication","mongodb","mongoose","nodejs","postman"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Krishnendu-1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-11-10T14:32:09.000Z","updated_at":"2024-11-17T14:22:26.000Z","dependencies_parsed_at":"2024-11-10T18:39:54.196Z","dependency_job_id":"3ff7aa45-3728-48e3-894c-485ca6a13f17","html_url":"https://github.com/Krishnendu-1/NexusMedia_Backend","commit_stats":null,"previous_names":["krishnendu-1/nexusmedia_backend"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Krishnendu-1%2FNexusMedia_Backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Krishnendu-1%2FNexusMedia_Backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Krishnendu-1%2FNexusMedia_Backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Krishnendu-1%2FNexusMedia_Backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Krishnendu-1","download_url":"https://codeload.github.com/Krishnendu-1/NexusMedia_Backend/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241460090,"owners_count":19966511,"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":["aggregation-pipleline","expressjs","jwt-authentication","mongodb","mongoose","nodejs","postman"],"created_at":"2024-11-13T09:06:04.559Z","updated_at":"2025-12-30T19:10:09.978Z","avatar_url":"https://github.com/Krishnendu-1.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 🚀 NexusMedia - Scalable Multimedia Content Hosting Platform\r\n\r\n![image](https://github.com/user-attachments/assets/03cbd841-1bdc-44c2-81fa-794551c1b8ad)\r\n\r\n## Overview\r\n\r\nNexusMedia is a robust cutting-edge **Backend** project designed with Node.js, Express, and MongoDB to provide developers and content platforms with a powerful, flexible, and secure infrastructure for building sophisticated digital experiences. It provides a RESTful API for user management, including registration, login, and profile management, along with features such as JWT-based authentication, video and image uploads to Cloudinary, and user subscriptions, likes, playlist and many more similar to **Youtube**.\r\n\r\nTagline: *Bridging Digital Experiences*\r\n\r\n## Table of Contents\r\n\r\n- [Features](#features)\r\n- [Technologies Used](#technologies-used)\r\n- [Installation](#installation)\r\n- [Usage](#usage)\r\n- [Detailed Code Architecture and Advanced Implementations](#detailed-code-architecture-and-advanced-implementations)\r\n- [Key Advanced Architectural Patterns](#key-advanced-architectural-patterns)\r\n- [API Endpoints](#api-endpoints)\r\n- [Contributing](#contributing)\r\n- [License](#license)\r\n\r\n## Features\r\n\r\n- User registration and login\r\n- JWT authentication for secure access\r\n- Profile management including avatar and cover photo updates\r\n- Subscription management between users\r\n- Watch history tracking\r\n- Image uploads to Cloudinary\r\n- Error handling with custom error responses\r\n\r\n## Technologies Used\r\n\r\n- Node.js\r\n- Express.js\r\n- MongoDB (with Mongoose)\r\n- cloudinary (for image,video storage)\r\n- bcrypt\r\n- cookie-parser\r\n- cors\r\n- jsonwebtoken (for authentication)\r\n- multer (for file uploads)\r\n- mongoose (Object Data Model)\r\n- mongoose-aggregate-paginate-v2 (to implement mongodb aggregation, sub-aggregation pipelines)\r\n- dotenv (for environment variable management)\r\n- Postman (for testing all the API endpoints without frontend)\\\r\n- nodemon \r\n- prettier\r\n\r\n## Installation\r\n\r\n1. Clone the repository:\r\n   ```bash\r\n   git clone https://github.com/Krishnendu-1/NexusMedia_Backend.git\r\n   cd NexusMedia_Backend\r\n2. Install the dependencies:\r\n   ```bash\r\n   npm install\r\n3. Create a .env file in the root directory and configure the following environment variables:\r\n   ```bash\r\n   MONGODB_URL=your_mongodb_connection_string\r\n   CLOUDNARY_NAME=your_cloudinary_name\r\n   CLOUDNARY_API_KEY=your_cloudinary_api_key\r\n   CLOUDNARY_API_SECRET=your_cloudinary_api_secret\r\n   SECRET_REFRESH_TOKEN=your_secret_key\r\n   PORT=3000\r\n\r\n## Usage\r\n\r\n  1. To start the server, run:\r\n     ```bash\r\n     npm run dev\r\nThe server will be running on http://localhost:3000 (or the port specified in your .env file).\r\n\r\n## Detailed Code Architecture and Advanced Implementations\r\n\r\n1. User Model (`user.model.js`):\r\n\r\n **Advanced Concepts:**\r\n- Mongoose pre-save middleware for automatic password hashing\r\n- Custom method generation for token creation\r\n- Secure password handling\r\n- Dynamic token generation with environment variable\r\n\r\n2. Authentication Middleware (`auth.middleware.js`):\r\n\r\n**Advanced Concepts:** \r\n- Multiple token extraction methods\r\n- Secure token verification\r\n- Middleware-based authentication\r\n- Selective data retrieval\r\n\r\n3. Cloudinary Upload Utility (`Cloudnary.js`):\r\n\r\n**Advanced Concepts:** \r\n- Automatic resource type detection\r\n- Fail-safe error handling\r\n- Automatic file system cleanup\r\n\r\n4. Subscription Details Aggregation (`Register.controller.js`):\r\n\r\n**Advanced Concepts:** \r\n- Complex MongoDB Aggregation Pipeline\r\n- Dynamic field generation\r\n- Conditional logic in aggregation\r\n- Selective data projection\r\n\r\n5. Async Handler Utility (`asyncHandler.js`):\r\n\r\n**Advanced Concepts:** \r\n- Higher-order function\r\n- Promise resolution\r\n- Centralized error handling\r\n\r\n6. Multer Middleware (`multer.middleware.js`):\r\n\r\n**Advanced Concepts:** \r\n- Dynamic file storage configuration\r\n- Flexible file naming strategy\r\n\r\n## Key Advanced Architectural Patterns:\r\n\r\n**Middleware-Driven Architecture**\r\n- Authentication middleware\r\n- Error handling middleware\r\n- File upload middleware\r\n\r\n**Aggregation-Based Data Retrieval**\r\n- Complex MongoDB aggregation pipelines\r\n- Dynamic data transformation\r\n- Efficient querying strategies\r\n\r\n**Secure Token Management**\r\n- JWT-based authentication\r\n- Refresh token mechanism\r\n- Secure token generation and verification\r\n\r\n**Modular Design**\r\n- Separation of concerns\r\n- Utility-based approach\r\n- Reusable components\r\n\r\n**Performance Optimization Techniques**\r\n- Mongoose Indexing\r\n- Selective Data Projection\r\n- Efficient Aggregation Pipelines\r\n- Caching Strategies\r\n- Minimal Data Transfer\r\n\r\n**Security Implementations**\r\n- Password Hashing\r\n- JWT Token Verification\r\n- Environment-Based Configuration\r\n- Secure Cookie Management\r\n- Input Validation\r\n\r\n## API Endpoints\r\n\r\n**The following are the main API endpoints available:**\r\n\r\n**User Registration**\r\n- POST `/api/users/register`\r\n  - Registers a new user with avatar and cover photo uploads.\r\n  \r\n**User Login**\r\n- POST `/api/users/login`\r\n  - Authenticates a user and returns access and refresh tokens.\r\n    \r\n**User Logout**\r\n- POST `/api/users/logout`\r\n  - Logs out the user and invalidates the refresh token.\r\n    \r\n**Refresh Access Token**\r\n- POST `/api/users/refreshAccessToken`\r\n  - Refreshes the access token using the refresh token.\r\n**Video Upload**\r\n- POST `/api/users/videoUpload`\r\n  - Video uploading feature to cloudinary if logged in.\r\n**Get all videos**\r\n- GET `/api/users/getVideos`\r\n  - Get all videos uploaded by a particular user.\r\n    \r\n**Update Password**\r\n- POST `/api/users/passwordUpdate`\r\n  - Updates the user's password (authenticated users only).\r\n    \r\n**Get Current User**\r\n- GET `/api/users/cuurentUser`\r\n  - Retrieves the current user's profile (authenticated users only).\r\n    \r\n**Update User Details**\r\n- PATCH `/api/users/detailsUpdate`\r\n  - Updates user details like fullname and email (authenticated users only).\r\n    \r\n**Update Avatar**\r\n- PATCH `/api/users/avatarUpdate`\r\n  - Updates the user's avatar (authenticated users only).\r\n    \r\n**Update Cover Photo**\r\n- PATCH `/api/users/coverphotoUpdate`\r\n  - Updates the user's cover photo (authenticated users only).\r\n    \r\n**Get User Subscription Details**\r\n- GET `/api/users/c/:username`\r\n  - Retrieves subscription details for a given user.\r\n    \r\n**Get User Watch History**\r\n- GET `/api/users/history`\r\n  - Retrieves the watch history for the authenticated user.\r\n    \r\n## Contributing\r\n\r\nContributions are welcome! Please feel free to submit a pull request or open an issue to discuss changes.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the LICENSE file for details.\r\n   \r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrishnendu-1%2Fnexusmedia_backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrishnendu-1%2Fnexusmedia_backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrishnendu-1%2Fnexusmedia_backend/lists"}