This repository contains an API server built with the Nest framework to support YouTube video sharing. The server provides APIs to share, manage, and retrieve YouTube videos, as well as features for user login and sign-up.
API document: https://youtube-sharing-api.onrender.com/swagger
- Register new user via API
[POST] /v1.0/auth/register
with valid email and strong password - Login via API
[POST] /v1.0/auth/login
- Get list shared videos via API
[GET] /v1.0/videos
[Authentication Required]
Share a Youtube videos via API[POST] /v1.0/videos
with valid Youtube Video URL
Application is deployed on OnRender and config trigger hook at develop
branch. App run as Container and configured in DockerFile
. Parameters are configured directly on OnRender project setting.
This application is using Free Package for cost saving purpose. It caused Cold Start problem if server is inactive for a while and It takes from 50 seconds to some minutes to start at first time.
Note: Trigger Backend API docs before open React App is help us to prevent unexpected timeout issue.
Follow these steps to quickly start the application:
- Docker
- Docker Compose
Create a .env.local
file in the root directory with the following content:
NODE_ENV=local
POSTGRES_HOST=postgres
POSTGRES_PORT=5432
POSTGRES_USER=username
POSTGRES_PASSWORD=password
POSTGRES_DB=postgres
CORS_ORIGIN=*
JWT_SECRET=testSecret
YOUTUBE_API_KEY=This key is used to authenticate with the YouTube API and need to protected. Provide while submit via form
YOUTUBE_API_V3_URL=https://www.googleapis.com/youtube/v3
YOUTUBE_API_KEY is provided in submit form
Start the application and PostgreSQL database:
$ docker-compose up --build
- NodeJS >= v.18
$ yarn install
Start the application and PostgreSQL database:
$ docker-compose up postgres --build -d
# development
$ yarn start
Application ready at http://localhost:3000/swagger
Terminate Docker containers
$ docker-compose down
- NodeJS >= v.18
- Installed packages by
yarn install
$ yarn test
$ yarn test:cov
- NodeJS >= v.18
- Installed packages by
yarn install
- Start
Postgres test
database by$ docker-compose up postgres_test --build -d
$ yarn test:e2e
Terminate Docker container
$ docker-compose down postgres_test