Thanks to visit codestin.com
Credit goes to github.com

Skip to content

drive-express-mini-project is a lightweight web app inspired by Google Drive. Through building it with Express.js and EJS, I learned about file upload handling, server-side rendering, and user-friendly interface design. This project deepened my understanding of web development and Node.js fundamentals.

Notifications You must be signed in to change notification settings

GarvitGupta001/drive-express-mini-project

Repository files navigation

Drive Express Mini Project

A minimal Google Drive-like file storage web application built with Node.js, Express, MongoDB, and Firebase Storage. Users can register, log in, upload files, and download their files securely.

Features

  • User registration and authentication (JWT-based)
  • Secure password hashing with bcrypt
  • File upload and storage using Firebase Storage
  • File metadata stored in MongoDB
  • Download files with signed URLs (secure, time-limited access)
  • Responsive UI using Tailwind CSS and Flowbite
  • Input validation with express-validator
  • Protected routes (only authenticated users can access their files)

Tech Stack

  • Backend: Node.js, Express.js
  • Database: MongoDB (via Mongoose)
  • File Storage: Firebase Storage
  • Authentication: JWT (jsonwebtoken), bcrypt
  • Frontend: EJS templates, Tailwind CSS, Flowbite
  • Validation: express-validator

Folder Structure

drive-express-mini-project/
│
├── models/           # Mongoose models (User, File)
├── routes/           # Express route handlers
├── utils/            # Utility modules (Firebase, Multer, DB connection)
├── middlewares/      # Custom Express middlewares (auth)
├── views/            # EJS templates for UI
├── .env              # Environment variables (not committed)
├── package.json
└── README.md

Setup Instructions

1. Clone the Repository

git clone <repo-url>
cd drive-express-mini-project

2. Install Dependencies

npm install

3. Configure Environment Variables

Create a .env file in the root directory with the following variables:

PORT=3000
MONGODB_URI=<your-mongodb-uri>
JWT_SECRET=<your-jwt-secret>
FIREBASE_PROJECT_ID=<your-firebase-project-id>
FIREBASE_CLIENT_EMAIL=<your-firebase-client-email>
FIREBASE_PRIVATE_KEY=<your-firebase-private-key>
FIREBASE_STORAGE_BUCKET=<your-firebase-storage-bucket>

Note: For FIREBASE_PRIVATE_KEY, replace actual newlines with \n in the .env file.

4. Run the Application

npm start

The server will start on http://localhost:3000 (or your specified port).

Usage

  1. Register: Go to /user/register to create a new account.
  2. Login: Go to /user/login to log in.
  3. Home: After login, access /home to upload and view your files.
  4. Upload: Use the upload form to select and upload files.
  5. Download: Click the download icon next to a file to get a secure, time-limited download link.

Security Notes

  • Passwords are hashed before storage.
  • JWT tokens are used for session management.
  • File downloads use signed URLs for secure, temporary access.
  • All file and user actions are protected by authentication middleware.

About

drive-express-mini-project is a lightweight web app inspired by Google Drive. Through building it with Express.js and EJS, I learned about file upload handling, server-side rendering, and user-friendly interface design. This project deepened my understanding of web development and Node.js fundamentals.

Resources

Stars

Watchers

Forks