A fully functional and scalable authentication-based image upload API built with Node.js, Express, MongoDB, JWT, and Cloudinary. Ideal for mini-projects and hackathons.
✅ User authentication (Register/Login) ✅ Role-based access (User/Admin) ✅ Secure image upload (Cloudinary) ✅ Pagination for image viewing ✅ Admin-restricted image deletion (only uploader can delete) ✅ Protected routes for users and admins
Backend: Node.js, Express, MongoDB, Mongoose
JWT, bcrypt.js
Multer.js, Cloudinary
Postman
- Fork & Clone the Repo
- Install Dependencies : npm install
- Setup Environment Variables : Create a .env file in the root directory & Add the following variables:
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
CLOUDINARY_CLOUD_NAME=your_cloudinary_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret - Run the Server : npm run dev
Use Postman to test the endpoints. Screenshots of testing are available in the repo.
Don't forget to add a gitIgnore file to hide your .env file from git.
Feel free to fork and contribute! Proper commit messages and structured code make it easy for beginners to understand.