Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VIDVAULT — Video Platform MVP

A microservices-based video upload and streaming platform built with Python Flask.

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                         Browser / Client                        │
└───────────────────────────┬─────────────────────────────────────┘
                            │ :5000
┌───────────────────────────▼─────────────────────────────────────┐
│                     Web App (Flask)                             │
│              Upload  ·  Stream  ·  Dashboard                    │
└──────────┬──────────────────┬──────────────────┬───────────────┘
           │ :5001            │ :5002            │ :5003
┌──────────▼──────┐  ┌────────▼────────┐  ┌─────▼──────────────┐
│  Auth Service   │  │  File Service   │  │  MySQL API Service  │
│  register/login │  │  upload/stream  │  │  video metadata     │
│  JWT validate   │  │  delete/list    │  │  CRUD               │
└─────────────────┘  └─────────────────┘  └────────────┬────────┘
                              │                         │
                     ┌────────▼──────┐        ┌────────▼────────┐
                     │  Volume:      │        │  MySQL 8.0      │
                     │  video_storage│        │  (videos table) │
                     └───────────────┘        └─────────────────┘

Services

Service Port Purpose
Web App 5000 Main UI, upload & streaming
Auth Service 5001 Registration, login, JWT validation
File Service 5002 Store & stream video files
MySQL API 5003 REST API over MySQL for metadata
MySQL 3306 Database (internal)

Quick Start

Prerequisites

  • Docker & Docker Compose installed

Run

git clone <this-repo>
cd video-platform
docker-compose up --build

Open http://localhost:5000

Stop

docker-compose down           # keep volumes
docker-compose down -v        # also delete all data

Environment Variables

All configurable via docker-compose.yml:

Variable Default Used in
MYSQL_ROOT_PASSWORD rootpassword MySQL
MYSQL_PASSWORD videopassword All services
SECRET_KEY (set per service) Auth, Web App
AUTH_SERVICE_URL http://auth_service:5001 Web App
FILE_SERVICE_URL http://file_service:5002 Web App
MYSQL_SERVICE_URL http://mysql_api_service:5003 Web App

API Reference

Auth Service (:5001)

Method Endpoint Body Description
POST /register {username, email, password} Create account → returns JWT
POST /login {username, password} Login → returns JWT
POST /validate {token} Validate JWT → returns user info
GET /health Service health check

File Service (:5002)

Method Endpoint Body Description
POST /upload multipart file Upload video file
GET /stream/<filename> Stream video (range-requests supported)
DELETE /delete/<filename> Delete file
GET /list List all stored files
GET /health Service health check

MySQL API Service (:5003)

Method Endpoint Body Description
GET /videos List all videos
GET /videos?user_id=N List videos by user
GET /videos/<id> Get single video
POST /videos {title, filename, file_path, file_size, content_type, uploaded_by} Save metadata
DELETE /videos/<id> Delete metadata
GET /health Service health check

Upload Flow

User selects file → POST /upload (web app)
  → 1. POST /upload       (file_service) → saves to /app/storage/<uuid>.ext
  → 2. POST /videos       (mysql_service) → saves {title, filename, path, size, user_id}
  → redirect to /dashboard

Stream Flow

User clicks Watch → GET /watch/<id> (web app)
  → GET /videos/<id>        (mysql_service) → get filename
  → <video src="/stream/<filename>">
      → GET /stream/<filename> (web app proxy)
          → GET /stream/<filename> (file_service) → reads file, streams bytes

Extending to AWS S3

To replace local disk storage with S3, modify file_service/app.py:

import boto3
s3 = boto3.client('s3')

# In upload():
s3.upload_fileobj(file, BUCKET_NAME, unique_filename)
# return the S3 URL as file_path

# In stream():
obj = s3.get_object(Bucket=BUCKET_NAME, Key=filename)
return Response(obj['Body'].read(), content_type='video/mp4')

Security Notes

  • Change SECRET_KEY in docker-compose.yml before any production use
  • Change MYSQL_ROOT_PASSWORD and MYSQL_PASSWORD
  • Add HTTPS termination (nginx with certbot) in front of the web app
  • Consider rate-limiting the auth endpoints
  • The /delete endpoint currently requires ownership check in web_app only

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages