A secure and efficient backend API for uploading videos, built with Node.js, Express, MongoDB, and Cloudinary. This project includes authentication using JWT and supports file uploads with Multer.
- ✅ User Authentication with JWT (Access + Refresh tokens)
- ☁️ Video upload support using Cloudinary
- 📂 File handling using Multer
- 🔐 Protected Routes with JWT Middleware
- 🧾 Environment-based configuration
- 📬 API tested using Postman
📦 project-root
┣ 📂 controllers
┣ 📂 middlewares
┣ 📂 models
┣ 📂 routes
┣ 📂 utils
┣ 📂 public
┣ 📄 app.js
┣ 📄 .env
┗ 📄 README.md
┗ 📄 .gitignore
┗ 📄 .prettierrc
- Backend Framework: Express.js
- Database: MongoDB + Mongoose
- Authentication: JSON Web Tokens (JWT)
- File Uploads: Multer
- Cloud Storage: Cloudinary
Create a .env file and include the following:
PORT=
CORS_ORIGIN=
ACCESS_TOKEN_SECRET=
ACCESS_TOKEN_EXPIRY=
REFRESH_TOKEN_SECRET=
REFRESH_TOKEN_EXPIRY=
CLOUDINARY_CLOUD_NAME=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=
MONGODB_URI=
git https://github.com/Mouanu/Javascript-Backend.git
npm installAdd the required environment variables to a .env file as shown above.
npm run devTested using Postman. Make sure to include the JWT token for protected routes in either cookies or the Authorization header as Bearer <token>.
- Login/Register → Receive Access & Refresh Tokens
- Store Access Token in
cookiesorAuthorizationheader - Use
verifyJWTmiddleware to protect private routes
- Handled by
multer.middleware.js - Uploaded videos are stored on Cloudinary
- Temporary files stored in
./public/temp
🔗 Live API Base URL: https://javascript-backend-mvo0.onrender.com/api/v1
✅ Postman Tested Endpoints:
POST {{server}}/users/register – User Registration
POST {{server}}/users/login – User Login
POST {{server}}/users/logout – User Logout
POST {{server}}/users/refresh-token – refresh token
GET {{server}}/users/history – get history
GET {{server}}/users/c/three - GET getUserChannelProfile
All endpoints were successfully tested using Postman with proper headers and authentication flow.
Anushila Biswas
4th Year CSE, IIIT Kottayam
Built as part of backend learning journey.