Skip to content

Goal: To make an API to fetch latest videos sorted in reverse chronological order of their publishing date-time from YouTube for a given tag/search query in a paginated response.

License

Notifications You must be signed in to change notification settings

KunalGehlot/backend-api

Repository files navigation

Fampay Interview Assignment 🌋

Goal: To make an API to fetch the latest videos sorted in reverse chronological order of their publishing date-time from YouTube for a given tag/search query in a paginated response.

Tasks ✅

  • The server should call the YouTube API continuously in the background (async) with some interval (say 10 seconds) for fetching the latest videos for a predefined search query and should store the data of videos (specifically these fields - Video title, description, publishing DateTime, thumbnail URLs and any other fields you require) in a database with proper indexes.

  • A GET API that returns the stored video data in a paginated response sorted in descending order of published DateTime.

  • A basic search API to search the stored videos using their title and description.

  • Dockerize the project.

  • It should be scalable and optimized.

Bonus Points ✨:

  • Add support for supplying multiple API keys so that if the quota is exhausted on one, it automatically uses the next available key.

  • Make a dashboard to view the stored videos with filters and sorting options (optional).

  • Optimize search API so that it's able to search videos containing a partial match for the search query in either video title or description.

Ex 1: A video with title How to make tea? should match the search query tea how

How to run ❓

The application is completely dockerized and can be run using the following command:

docker-compose up --build

The application is running on port 8888 and can be accessed using the following URL:

localhost:8888

The API documentation is available at the following URL:

localhost:8888/docs

You can use the same to quickly test the application.

Logging 📝

The application logs are available in the console and in the fam(ily).log file in the root directory.

Application Stack 🏡

  • Docker
  • FastAPI
  • Uvicorn (async server)
  • MongoDB

NOTICE ⚠️

THIS IS A MPL 2.0 LICENSED PROJECT. IT IS A COPYLEFT LICENSE.

A copyleft license is a license that grants the right to copy, distribute and/or modify the work under certain conditions. The conditions are that the work is available for non-commercial use only, and the work is not distributed or modified in any way that would require the modified work or parts of it to be shared with anyone other than the original owner.

If you want to copy, distribute or modify the work, you have to obtain a license from the original owner.

MPL 2.0: https://www.mozilla.org/en-US/MPL/2.0/

Because it's about Fam(ily) 🤗

(Had to squeeze the meme in)

About

Goal: To make an API to fetch latest videos sorted in reverse chronological order of their publishing date-time from YouTube for a given tag/search query in a paginated response.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published