Design Video streaming application —

An interview assignment for technical skill assessment

Vasudha
3 min readMay 9, 2024

Problem statement

An OTT platform WEBFLIX, a video streaming company need backend
application to maintain their streaming contents with following functionalities:
1. Insert/Add the video details
2. Retrieve the video details as per genre
3. Retrieve the video details based upon videoID
4. Retrieve the video details whose durations are more than 10 min

Create a high-level design document consisting of the below:
1. Architectural assessment: High level solution design including API documentation.
2. Coding Assessment: Create RestFul micro service + Skeleton UI as per the above given
scenario.

Approach

Functional requirements

  • Users can publish/upload videos
  • Users can search/watch videos based on genre, videoID and durations

Non-functional requirements

  • highly available
  • scalable
  • good performance/response time should be less than a second.

Assumptions & Estimate

High level Design

HLD — video streaming app

Data Model

Data model

API Design

video upload API — large video file will be uploaded in chunks to the backend.

paths:
/video:
post:
tags:
- video
summary: Add a new video to the store
description: Add a new video to the store
operationId: addVideo
requestBody:
description: Create a new video in the store
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/Video'
type: object
properties:
title:
type: string
description:
type: string
duration:
type: string
genre:
type: string
file:
type: string
format: binary
required: true
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Video'
application/xml:
schema:
$ref: '#/components/schemas/Video'
'400':
description: Invalid input
'422':
description: Validation exception
security:
- webflixstore_auth:
- write:videos
- read:videos

video get/search API — uses custom query language/grammar (ANTLR or JMESPath) to specify filter condition in the request.

paths:
/video:
get:
tags:
- video
summary: Search and filter video by query
parameters:
- name: sort_by
in: query
description: sort result set by given list of video parameters
example: duration,title
required: false
schema:
type: string
- name: page_size
in: query
description: fetch result sets limited by the given page size
required: false
default: 20
schema:
type: integer
example: 25
- name: page_no
in: query
description: fetch result sets for the given page
required: false
default: 0
schema:
type: integer
example: 1
- name: filter
in: query
description: filters search results by the given condition. uses custom query language/grammar (ANTLR or JMESPath) to specify filter condition.
required: false
schema:
type: string
example: ("duration">"00:20:00") AND ("genre"="fantasy")
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Video'
application/xml:
schema:
type: array
items:
$ref: '#/components/schemas/Video'

'400':
description: Invalid ID supplied
'404':
description: Video not found
security:
- api_key: []
- webflixstore_auth:
- write:videos
- read:video

Tech stack

frontend — reactjs, react-router

backend — nodejs as the application does mostly asynchronous IO ops

database — postgresql for meta data storage

video store — aws s3 for video files

--

--