Skip to content

Anusree6154s/xflix-backend

Repository files navigation

XFlix Node - Backend

Backend for XFlix - A video sharing platform

Backend API DocumentationXFlix Frontend GithubXFlix Frontend Website

Table of Contents

  1. Project Overview
  2. Setup Instructions
  3. Project Breakdown

Project Overview

XFlix Node is a video sharing platform that allows users to watch and upload videos using external links (e.g., YouTube). This project covers the backend of Xflix node.

Built With:

  • Node.js: For server-side development.
  • Express.js: To create RESTful APIs easily.
  • MongoDB: For data persistence.
    • Mongoose: For creating MongoDB schemas and validating them.
  • Postman: For API testing and documentation.

Features:

  • RESTful API implementation.
  • Video title search functionality.
  • Filtering by genres and content ratings.
  • Sorting by upload date and view count.

Setup Instructions

  1. Installation

    # Clone the repository
    git clone https://github.com/Anusree6154s/xflix-backend.git
    
    # Navigate to the project directory
    cd xflix-backend
    
    # Install dependencies
    npm install
  2. Set up environment variables:

    • In .env file in the root directory
      NODE_ENV = your_port
      MONGO_URI = your_mongodb_uri
      
  3. Start the server:

    npm start

    The server should be running on http://localhost:PORT/v1/videos.

Project Breakdown

Project Structure

xflix-backend/
├── _CRIO_/           # Crio metadata
├── assessment/       # Crio assessment files
├── backend/          # Backend code implemented by me
│   ├── models/       # Database models
│   ├── index.js      # Server setup and configuration
│   └── server.js     # Routes
├── README.md         # Project documentation
├── package.json      # Project dependencies and scripts
└── runAssessment.sh  # Script to run assessments

Technical Architecture

  • Components:

    • Node.js & Express.js: Chosen for their non-blocking architecture and scalability, making it ideal for handling multiple requests simultaneously.
    • MongoDB: Used for its flexibility in data modeling, especially for unstructured video data.
  • Deployment Architecture:

    • Hosting: Deployed on Render for it ease of use and automatic deployments.

Implemented Routes

  • GET /v1/videos: Retrieve a list of videos.
  • GET /v1/videos/:videoId: Retrieve details of a specific video.
  • POST /v1/videos: Upload a new video.
  • PATCH /v1/videos/:videoId/votes: Update votes for a video.
  • PATCH /v1/videos/:videoId/views: Update view count for a video.

Future Features

  • User authentication and authorization.
  • Commenting system for videos.
  • User profiles to track uploaded videos.