A scalable and modular backend clone of YouTube built with Node.js and Express.js, featuring user authentication, video management — inspired by YouTube’s core features.
- User registration and login with JWT
- Upload videos with Cloudinary
- View history, playlists, and user-specific content
- RESTful APIs using Express
- MongoDB + Mongoose for database layer
- Node.js
- Express.js
- MongoDB + Mongoose
- JWT (Authentication)
- Multer (file uploads)
- Cloudinary (optional)
- dotenv for environment management
Youtube-backend/
├── public/temp/
│ └── .gitkeep
├── src/
│ ├── controllers/
│ ├ └── user.controller.js
| ├── middlewares/
│ | └── auth.middleware.js
│ | └── multer.middleware.js
| ├── db/
│ | └── index.js
| ├── models/
│ | └── subscription.model.js
│ | └── user.models.js
| | └── video.models.js
| ├── routes/
│ | └── user.route.js
| ├── utils/
│ | └── ApiError.js
│ | └── ApiResponse.js
│ | └── cloudinary.js
│ | └── asyncHandler.js
│ ├── app.js
│ ├── constants.js
│ ├── index.js
├── .env.sample
├── .gitignore
├── .prettierignore
├── .prettierrc
├── package-lock.json
├── Screenshot 2025-03-05 205445.png
├── package.json
└── Readme.md
- Node.js v18+
- MongoDB (local or Atlas)
- Cloudinary account
git clone https://github.com/anand11206/Youtube-backend.git
cd Youtube-backend
npm installCreate a .env file in the root directory renaming the .env.sample file and filling values
npm run devServer will run on:
http://localhost:PORT (PORT in .env file)
Auth
POST /api/v1/users/registerPOST /api/v1/users/loginPOST /api/v1/users/logoutPOST /api/v1/users/refresh-access-tokenPOST /api/v1/users/change-passwordPOST /api/v1/users/update-detailsPOST /api/v1/users/update-avatar-cover-images
- Postman or Thunder Client for API testing
- MongoDB Compass for DB inspection
This project is licensed under the MIT License.
See the LICENSE file for full details.
Your Name
GitHub: @anand11206
PRs and suggestions are always welcome.
Please fork the repository and submit a pull request.