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
- sequelize - ORM for sql dialects
- jsonwebtoken - authentication
- bcryptjs - password hashing
Features
- Login/Signup
- Upload video
- Search video by channel name
- Search video by title, description
- Like/Dislike video
- Subscribe/Unsubscribe from channels
- Add comment
- Edit profile (avatar, cover)
- Liked videos
- 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
UI
Home
Trending
Watch
Suggestions
Channel
Edit Profile
Library
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