A secure and robust cloud storage web application built with Node.js, Express.js, and MongoDB.
Upload, manage, and access your files from anywhere with a clean, intuitive interface.
- 👤 User Account Management: Create accounts, sign in, and sign out with ease.
- 🔒 Secure Authentication & Authorization:
- Passwords are securely hashed using bcrypt.
- JWT tokens stored in cookies for persistent sessions.
- Custom middleware ensures only authenticated users can access their data.
- ☁️ File Uploads via Cloudinary:
- Seamlessly upload files with a drag-and-drop interface or a traditional browse button.
- File metadata is stored in MongoDB and linked to user accounts for privacy.
- 🎨 Frontend with EJS and Tailwind CSS:
- A clean, modern, and responsive UI built with Tailwind CSS.
- User-friendly pop-up notifications for errors and success messages.
- ⚙️ Robust Error Handling:
- All routes are wrapped in
try-catchblocks for graceful error handling. - Custom middleware for validating requests and handling errors ensures a smooth user experience.
- All routes are wrapped in
- Backend: Node.js, Express.js
- Frontend: EJS Templates, Tailwind CSS
- Database: MongoDB (with Mongoose ODM)
- Cloud Storage: Cloudinary
- Authentication: JWT (JSON Web Tokens), bcrypt
- File Handling: Multer
- User Registration: A new user signs up. Their password is automatically hashed with
bcryptand stored securely in the MongoDBUserscollection. - User Login: The user logs in with their credentials. A JWT token is generated and stored as a cookie in their browser to maintain the session.
- File Upload: The authenticated user uploads a file.
Multerhandles the file stream, which is then sent toCloudinaryfor storage. The file's metadata (URL, name, type) is saved in the MongoDBFilescollection, linked by the user's ID. - Data Access: The
authMiddlewareverifies the JWT token on every request to a protected route, ensuring that users can only access their own files. - Error Handling: If an error occurs, the middleware catches it and sends a user-friendly pop-up notification to the frontend instead of a raw JSON response.
Here's a look at the project's structure:
MyCLOUD/
├── public/ # Static assets (CSS, client-side JS, images)
├── views/ # EJS templates for the UI
├── routes/ # Express route definitions (auth, upload)
├── middleware/ # Custom middleware (authMiddleware)
├── models/ # Mongoose schemas (User, File)
├── app.js # Main Express application file
├── package.json # Project dependencies
├── .env # Environment variables (not committed to Git)
└── README.md
- Drag-and-Drop Uploads: A modern and seamless user experience for uploading files.
- Middleware-Driven Architecture: Clean, organized, and maintainable code.
- User-Friendly Feedback: Pop-up based error handling for better UI communication.
- Complete Session Management: Secure and persistent sessions using JWT stored in cookies.
- Modular and Scalable: A fully modular route structure that is easy to extend.
Here are some features planned for the future:
- File Sharing: Implement file sharing with other users using role-based access (view/edit).
- Email & Password: Add email verification and a "Forgot Password" feature.
- User Dashboard: Create a dashboard with storage usage analytics.
- Large File Support: Implement file chunking to support larger file uploads.
This project is licensed under the MIT License. See the LICENSE file for more details.