Skip to content

High-performance video hosting architecture. Built with advanced MongoDB Aggregation pipelines, JWT (Access/Refresh) security, and cloud-native media management.

Notifications You must be signed in to change notification settings

ImAryanPandey/VideoSharingPlatform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

30 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⚑ VIDEO SHARING PLATFORM (VSP)

A high-performance, scalable backend architecture for video sharing, built with Node.js, Express, and MongoDB Aggregation Pipelines.

System Status Backend Database


πŸ— System Architecture

This project implements a production-grade backend with a focus on scalability and data consistency.

Key Engineering Features

  • Complex Aggregations: Uses MongoDB Aggregation Pipelines ($lookup, $unwind, $addFields) for high-performance data joining (e.g., fetching videos with owner details and subscription status in a single query).
  • JWT Security: Implements a dual-token architecture (Access Token + Refresh Token) for secure, stateless authentication.
  • Cloud-Native Storage: Integrates Cloudinary for scalable video/image storage and optimization.
  • Optimized Queries: Uses mongoose-aggregate-paginate-v2 for efficient pagination on heavy datasets.

πŸ›  Tech Stack

  • Runtime: Node.js (v20+)
  • Framework: Express.js
  • Database: MongoDB (Mongoose ODM)
  • Storage: Cloudinary API
  • Auth: JSON Web Tokens (JWT), Bcrypt
  • Validation: Mongoose Schema Validation

πŸ”Œ API Endpoints (Snapshot)

Method Endpoint Description Access
POST /api/v1/users/register Register a new user with avatar Public
POST /api/v1/users/login Login and receive Access/Refresh tokens Public
POST /api/v1/videos/publish Upload video & thumbnail (Multipart) Auth
GET /api/v1/videos Get all videos with pagination & filters Public
GET /api/v1/users/c/:username Get channel profile & stats Auth

πŸ’» Local Setup

  1. Clone the repository
git clone [https://github.com/ImAryanPandey/video-sharing-platform.git](https://github.com/ImAryanPandey/video-sharing-platform.git)
cd video-sharing-platform/backend
  1. Install Dependencies
npm install
  1. Environment Variables Create a .env file in the root:
PORT=8000
MONGODB_URI=mongodb+srv://<your-mongo-url>
CORS_ORIGIN=*
ACCESS_TOKEN_SECRET=your-secret
ACCESS_TOKEN_EXPIRY=1d
REFRESH_TOKEN_SECRET=your-secret
REFRESH_TOKEN_EXPIRY=10d
CLOUDINARY_CLOUD_NAME=...
CLOUDINARY_API_KEY=...
CLOUDINARY_API_SECRET=...
  1. Run the Server
npm run dev

πŸš€ Future Roadmap

  • Video Transcoding (HLS/DASH)
  • Real-time Comments (Socket.io)
  • Redis Caching for Trending Videos

Built by Aryan Pandey

About

High-performance video hosting architecture. Built with advanced MongoDB Aggregation pipelines, JWT (Access/Refresh) security, and cloud-native media management.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages