Giter VIP home page Giter VIP logo

youtubeclone-backend's Introduction

Youtube Clone Backend

NOTE: As of 10-06-2022 at 20:02 IST, I am archiving this repository. It was fun while it lasted.

Youtube clone using PERN stack (Postgres, Express, React, Node).

This is the backend repository, built with Express + Sequelize. If you are looking for the frontend repository, click here

Core packages

  1. sequelize - ORM for sql dialects
  2. jsonwebtoken - authentication
  3. bcryptjs - password hashing

Features

  1. Login/Signup
  2. Upload video
  3. Search video by channel name
  4. Search video by title, description
  5. Like/Dislike video
  6. Subscribe/Unsubscribe from channels
  7. Add comment
  8. Edit profile (avatar, cover)
  9. Liked videos
  10. History

Running locally

At the root of your project create an .env file with the following contents:

JWT_SECRET=<YOUR_SECRET>
JWT_EXPIRE=30d // or any reasonable value that you prefer
DATABASE_URL=<YOUR_DB_CONNECTION_URI>

Then run npm i and npm run dev to start the development server

For more detailed instructions, click here

Deploying to Heroku

Create your heroku account and install the heroku cli tool globally and login

npm i -g heroku
heroku login

Go to the root of this project, create an new heroku app and push it to the remote 'heroku'

heroku create
git push heroku master

Once the build finished successfully, you need to go to your heroku dashboard for this app and add the .env manually. If it sounds confusing, refer this guide

Heroku postgres addon

You can also use the heroku postgres addon and use that database for this clone

heroku addons:create heroku-postgresql:hobby-dev

Now you can use the DATABASE_URL connection string from heroku postgres and use that in your .env. To get your connection string use:

heroku config # if everything worked you will a connection string

Watch the Demo

Video

UI

Home

Home

Trending

Trending

Watch

Watch

Suggestions

Suggestions

Channel

Trending

Edit Profile

Edit Profile

Trending

Library

Library

Search

Search

My Clone Trilogy

With this clone, I am finishing what I call 'my clone trilogy'. If you are interested, you can visit my other clones that are part of this trilogy

  1. Twitter

  2. Instagram

youtubeclone-backend's People

Contributors

manikandanraji avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

youtubeclone-backend's Issues

API test support

Does this repo have any test support? Something like:

npm run mocha

describe('UserModel', function(){

[...]

it('should list users', async () => {

cheers

change storage for work on google drive

Hi Manikandan,
please make changes on storage structure for work on google drive
because edu gmails are not limited on gdrive disc quota & so much better than cloudinary.
waiting for your response
finest regards

Error at Query.run, might be located at auth.js

I am currently trying to redo your project on my own without heroku, hosted on localhost. Whenever I use postman to test the endpoints, I keep getting this error on my console:

Server started at http://localhost:5000
Error
    at Query.run (C:\Users\donal\videos\Web-Developement\videojs\vc-be\server\node_modules\sequelize\lib\dialects\postgres\query.js:50:25) 
    at C:\Users\donal\videos\Web-Developement\videojs\vc-be\server\node_modules\sequelize\lib\sequelize.js:313:28
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async PostgresQueryInterface.insert (C:\Users\donal\videos\Web-Developement\videojs\vc-be\server\node_modules\sequelize\lib\dialects\abstract\query-interface.js:297:21)
    at async model.save (C:\Users\donal\videos\Web-Developement\videojs\vc-be\server\node_modules\sequelize\lib\model.js:2424:35)
    at async Function.create (C:\Users\donal\videos\Web-Developement\videojs\vc-be\server\node_modules\sequelize\lib\model.js:1336:12)     
    at async C:\Users\donal\videos\Web-Developement\videojs\vc-be\server\controllers\auth.js:12:18

This is my current code for auth.js:

const { Op } = require("sequelize");
const { User } = require('../sequelize');
const bcrypt = require("bcryptjs");
const jwt = require("jsonwebtoken");
const asyncHandler = require('../middlewares/asyncHandler');

// exports.signup = asyncHandler(async (req, res, next) => {
//  console.log('this function works');
// });

exports.signup =  asyncHandler(async (req, res, next) => {
    const user = await User.create(req.body);

    await user.save();

    res.status(200).json({ success: true, data: token });

    console.log('this function works');
    
}); 

Did you ever experience something like this before?

Error with data store

Upon signing up this error is thrown: index.js:92 Uncaught (in promise) TypeError: Cannot read property 'data' of undefined at authenticate (index.js:92)

Backend Setup

hi this is the best !! i set up project with Postgress from heroku- however I am not sure that it is connecting for it wont allow sign up from sign up page. do i have to configurer the db first somehow in heroku??

thanks so much

Hello! Awesome work

I have set up the project with heroku postgress and put the other secret key in there.

however when i run the npm run dev, i get a CANNOT/GET error .

Is there anything I might be missing? Any help would be appreciated.

thanks- chris

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.