This is a Node.js backend project using Express.js and MongoDB (Atlas) for managing users, subscribers, and videos. The backend includes CRUD operations, authentication, and aggregation pipelines for efficient data retrieval.
- User Authentication (JWT-based)
- User Management
- Subscriber Management
- Video Upload
- Mongoose Aggregation Pipelines for data processing
- Middleware for Error Handling, Image upload & Authentication
git clone https://github.com/your-username/your-repo.git
cd your-repo
npm install
Create a .env
file in the root directory:
PORT=5000
MONGO_URI=mongodb+srv://your-db-connection
JWT_SECRET=your-secret-key
npm start
Server will run on http://localhost:5000
.
├───public
│ └───temp
│ .gitkeep
│
└───src
│ app.ts
│ constant.ts
│ index.ts
│
├───controllers
│ channel.controller.ts
│ user.controller.ts
│
├───db
│ db.ts
│
├───middlewares
│ auth.middleware.ts
│ multer.middleware.ts
│
├───models
│ subscription.model.ts
│ user.model.ts
│ video.model.ts
│
├───routes
│ channel.routes.ts
│ user.routes.ts
│
└───utils
ApiError.ts
ApiResponse.ts
asyncHandler.ts
cloudinary.ts
Method | Route | Description |
---|---|---|
POST | /api/v1/users/register |
Register new user |
POST | /api/v1/users/login |
Login user |
POST | /api/v1/users/logout |
Logout user |
PATCH | /api/v1/users/change-password |
Change user password |
PUT | /api/v1/users/edit-user-details |
Edit user details |
DELETE | /api/v1/users/delete-user |
Delete user account |
POST | /api/v1/users/update-image |
Update user image |
GET | /api/v1/users/watch-history |
Get user watch history |
Method | Route | Description |
---|---|---|
GET | /api/v1/channel/:username |
Get channel by username |
- Node.js & Express.js (Backend Framework)
- MongoDB Atlas & Mongoose (Database & ORM)
- JWT Authentication (Secure Login)
- Multer (File Uploads)
- Cloudinary (Video Storage)
Feel free to fork this repository and submit a pull request!
If you like this project, give it a ⭐ on GitHub!