For YouTube-scale:
For Netflix-scale:
For Netflix:
Register User
POST /api/v1/users/register
Creates a new user account with email/password or social login.
Login
POST /api/v1/users/login
Authenticates user and returns access & refresh tokens.
Get User Profile
GET /api/v1/users/me
Returns the logged-in user's profile, settings, and preferences.
Update Profile
PUT /api/v1/users/me
Updates user details like name, language, playback preferences, etc.
Upload Video (YouTube-specific)
POST /api/v1/videos/upload
Allows a user to upload a new video file along with metadata (title, description, tags).
Get Video Metadata
GET /api/v1/videos/{videoId}
Fetches title, description, duration, view count, like count, etc.
List Videos
GET /api/v1/videos
Supports filters: category, trending, recent, subscriptions, etc.
Update Video Metadata
PUT /api/v1/videos/{videoId}
Updates the title, tags, description, or thumbnail.
Delete Video
DELETE /api/v1/videos/{videoId}
Removes a video from the platform (for uploader or admin).
Get Streaming URL
GET /api/v1/videos/{videoId}/play
Returns the HLS/MPEG-DASH streaming manifest URL.
Resume Playback
GET /api/v1/users/{userId}/history/{videoId}
Returns last watched timestamp for resume support.
Save Playback Position
POST /api/v1/users/{userId}/history/{videoId}
Saves current position in video for resume functionality.
Like Video
POST /api/v1/videos/{videoId}/like
Adds a like by the current user.
Dislike Video
POST /api/v1/videos/{videoId}/dislike
Adds a dislike.
Comment on Video
POST /api/v1/videos/{videoId}/comments
Adds a new comment to the video.
Get Comments
GET /api/v1/videos/{videoId}/comments
Returns a paginated list of comments.
Subscribe to Channel (YouTube-specific)
POST /api/v1/channels/{channelId}/subscribe
Subscribes the user to a channel.
Watch History
GET /api/v1/users/{userId}/history
Returns a list of recently watched videos.
Get Recommendations
GET /api/v1/videos/recommendations
Returns a list of recommended videos for the user.
Search Videos
GET /api/v1/search?q=keyword
Searches for videos by title, tags, or channel.
Subscribe to Plan
POST /api/v1/subscribe
User chooses a plan and triggers payment.
Get Current Subscription
GET /api/v1/subscribe
Returns current subscription details and status.
Cancel Subscription
DELETE /api/v1/subscribe
Cancels the user’s subscription.
Approve or Remove Video
PUT /api/v1/admin/videos/{videoId}/approve
For moderating flagged videos.
Ban User
POST /api/v1/admin/users/{userId}/ban
Restricts user access due to policy violations.
View Platform Analytics
GET /api/v1/admin/analytics
Returns dashboards on usage, uploads, views, and revenue.
User Table
sql
CopyEdit
CREATE TABLE users (
user_id UUID PRIMARY KEY,
email VARCHAR(255) UNIQUE NOT NULL,
password_hash TEXT NOT NULL,
name VARCHAR(100),
created_at TIMESTAMP,
last_login TIMESTAMP
);
Profile Table (Netflix-style multiple profiles)
sql
CopyEdit
CREATE TABLE profiles (
profile_id UUID PRIMARY KEY,
user_id UUID REFERENCES users(user_id),
profile_name VARCHAR(100),
language VARCHAR(10),
is_kid BOOLEAN
);
Videos
sql
CopyEdit
CREATE TABLE videos (
video_id UUID PRIMARY KEY,
uploader_id UUID REFERENCES users(user_id),
title TEXT,
description TEXT,
category VARCHAR(50),
visibility VARCHAR(20), -- public/private/unlisted
upload_time TIMESTAMP,
duration INT,
status VARCHAR(20) -- processing, ready, failed
);
Tags
sql
CopyEdit
CREATE TABLE video_tags (
video_id UUID REFERENCES videos(video_id),
tag TEXT
);
Comments Document (MongoDB-style)
json
CopyEdit
{
"_id": "comment_id",
"video_id": "vid123",
"user_id": "user456",
"text": "Nice video!",
"created_at": "2024-03-30T12:00:00Z",
"replies": [
{ "user_id": "user789", "text": "Agreed!", "created_at": "..." }
]
}
Likes Table (for fast toggle)
(video_id, user_id)WatchHistory Table
cql
CopyEdit
CREATE TABLE watch_history (
user_id UUID,
video_id UUID,
last_watched TIMESTAMP,
position_seconds INT,
PRIMARY KEY (user_id, last_watched)
) WITH CLUSTERING ORDER BY (last_watched DESC);
Subscriptions
sql
CopyEdit
CREATE TABLE subscriptions (
subscription_id UUID PRIMARY KEY,
user_id UUID REFERENCES users(user_id),
plan_type VARCHAR(50),
status VARCHAR(20),
start_date DATE,
end_date DATE
);
Payments
sql
CopyEdit
CREATE TABLE payments (
payment_id UUID PRIMARY KEY,
subscription_id UUID REFERENCES subscriptions(subscription_id),
amount DECIMAL,
status VARCHAR(20),
transaction_date TIMESTAMP
);
POST /users/register or POST /users/login to API Gateway.POST /videos/upload request to API Gateway with video file and metadata.GET /videos/{videoId}/play to API Gateway.GET /search?q=query to API Gateway.POST /videos/{videoId}/like or POST /videos/{videoId}/comments.POST /users/{userId}/history/{videoId} with current playback time.GET request to same service fetches last playback time to resume.GET /videos/recommendations to API Gateway.POST /subscribe to API Gateway.PUT /admin/videos/{videoId}/remove via internal dashboard.Functional:
Non-functional:
Functional:
Non-functional:
Functional:
Non-functional:
video_ingest_topic for encoding pipeline.Functional:
Non-functional:
video_encoded_topic.Functional:
Non-functional:
Functional:
.m3u8 for HLS).Non-functional:
exp claim in JWT or signed query param)Functional:
Non-functional:
Functional:
Non-functional:
Functional:
Non-functional:
Functional:
Non-functional:
pending_payment until confirmation