Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Videotube Backend Engine API 🎥

A production-grade, highly optimized streaming and social aggregation media backend platform engineered from scratch using Node.js, Express, and MongoDB.


One-line description

An advanced media-streaming and community micro-blogging backend architecture utilizing secure dual-token authentication protocols, custom mongoose data aggregation pipelines, and high-performance media mutations.


Problem

Building structural enterprise backends requires solving complex data modeling, session safety constraints, and high-volume asset distribution vectors concurrently. Simple CRUD architectures lack the security patterns needed to protect route access points without constant database roundtrips, and they struggle with heavy multi-collection data operations like tracking video watches alongside comments, channel subscribers, and dynamic community tweets. This project delivers a production-grade alternative by designing an automated dual-token engine (Access & Refresh JWTs), writing granular Mongoose Aggregation Pipelines, configuring safe file upload buffers via Cloudinary, and abstracting data interactions across a modular MVC design pattern.


Features

  • Dual-Token Cryptographic Authentication: Advanced security layout utilizing short-lived Access Tokens for routine API access checking alongside long-lived Refresh Tokens stored in HTTP-Only cookies to handle session renewal safely without requiring credential re-entry.
  • Complex Data Aggregation Channels: Heavy multi-collection lookups and dynamic state calculation metrics (subscribers, views, watch histories, and likes counters) handled natively via MongoDB Aggregation Pipelines.
  • Granular Video & Asset Delivery Systems: Complete multipart media processing, validating resolutions and encoding durations with local storage disk buffering before offloading to Cloudinary CDNs.
  • Community Interactions Hub: Fully implemented structural endpoints for multi-threaded video comment trees, user tweeting models, custom playlist compositions, and real-time nested liking matrices.
  • Channel Subscription Matrices: Bi-directional relational lookup systems mapping individual sub-profiles directly against viewer entities to manage follower and content analytics in real-time.
  • Unified Request-Response Standardization: Centralized API normalization using custom global error catchers (ApiError) and standard response formatters (ApiResponse).

Tech Stack

  • Runtime Environment: Node.js (LTS v18/v20)
  • Application Web Framework: Express.js (v4.x)
  • Database & Modeling Engine: MongoDB Cloud Atlas, Mongoose ODM
  • Cryptographic Token & Password Protection: JSON Web Tokens (JWT), bcryptjs
  • Multipart Media Ingestion: Multer (Disk Storage Buffers), Cloudinary SDK
  • System Diagnostics & Operations: Standard CORS, Cookie-Parser, Dotenv

System Architecture

The application runs on a modular Model-View-Controller (MVC) structure, splitting request patterns down from routing boundaries through automated security authentication filters before modifying backend data structures.

+------------------------------------------------------------+
|                       1. Client Interface                  |
|                 (Postman Testing / Client App)             |
+------------------------------------------------------------+
                              |
                   [HTTP Requests + Cookies]
                              |
                              v
+------------------------------------------------------------+
|                   2. App Routing & Gateway Layer           |
|            (Express Router Matrix / Global Middleware)      |
+------------------------------------------------------------+
                              |
                     [AuthJwt Verification]
                              |
                              v
+------------------------------------------------------------+
|              3. Modular Controller Handling Nodes          |
|      (User / Video / Playlist / Subscription Handlers)     |
+------------------------------------------------------------+
                              |
               [Mongoose Pipeline Queries & Mutations]
                              |
                              v
+------------------------------------------------------------+
|                   4. Relational Storage Layer              |
|              (MongoDB Server Cluster / Storage CDN)        |
+------------------------------------------------------------+

Installation

npm install

Development server running via nodemon

npm run dev

Production environment launch

npm start

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages