Skip to content

dani-dev24/minidfs

Repository files navigation

Distributed File System - Google Drive Clone

A modern, distributed file system built with the MERN stack (MongoDB, Express, React, Node.js) that mimics Google Drive's functionality and UI.

Features

  • 🔐 User Authentication (Register/Login with JWT)
  • 📁 File Upload with drag-and-drop support
  • 📂 Folder Management (Create, Rename, Delete)
  • ⭐ Star/Unstar files and folders
  • 🗑️ Trash system for deleted items
  • 📊 Storage quota tracking
  • 📥 File Download
  • 🎨 Modern, professional UI similar to Google Drive
  • 📱 Responsive design

Tech Stack

Backend

  • Node.js & Express.js
  • MongoDB with Mongoose
  • JWT Authentication
  • Multer for file uploads
  • bcryptjs for password hashing

Frontend

  • React.js
  • Material-UI (MUI) for components
  • React Router for navigation
  • Axios for API calls
  • React Dropzone for file uploads

Installation

Prerequisites

  • Node.js (v14 or higher)
  • MongoDB (local or MongoDB Atlas)
  • npm or yarn

Setup Steps

  1. Clone the repository

    cd filesystem
  2. Install backend dependencies

    npm install
  3. Install frontend dependencies

    cd client
    npm install
    cd ..
  4. Configure environment variables

    Create a .env file in the root directory:

    MONGODB_URI=mongodb://localhost:27017/filesystem
    JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
    PORT=5000
  5. Start MongoDB

    Make sure MongoDB is running on your system. If using MongoDB Atlas, update the MONGODB_URI in .env.

  6. Run the application

    To run both server and client concurrently:

    npm run dev

    Or run them separately:

    Backend:

    npm run server

    Frontend:

    npm run client
  7. Access the application

    Open your browser and navigate to http://localhost:3000

Project Structure

filesystem/
├── server/
│   ├── models/
│   │   ├── User.js
│   │   ├── File.js
│   │   └── Folder.js
│   ├── routes/
│   │   ├── auth.js
│   │   ├── files.js
│   │   └── folders.js
│   ├── middleware/
│   │   └── auth.js
│   ├── uploads/
│   └── index.js
├── client/
│   ├── public/
│   ├── src/
│   │   ├── components/
│   │   │   ├── Auth/
│   │   │   └── Dashboard/
│   │   ├── context/
│   │   └── App.js
│   └── package.json
├── package.json
└── README.md

API Endpoints

Authentication

  • POST /api/auth/register - Register a new user
  • POST /api/auth/login - Login user

Files

  • GET /api/files - Get all files
  • POST /api/files/upload - Upload a file
  • GET /api/files/download/:id - Download a file
  • DELETE /api/files/:id - Delete a file
  • PATCH /api/files/:id/rename - Rename a file
  • PATCH /api/files/:id/star - Star/Unstar a file

Folders

  • GET /api/folders - Get all folders
  • POST /api/folders - Create a folder
  • GET /api/folders/:id - Get folder by ID
  • DELETE /api/folders/:id - Delete a folder
  • PATCH /api/folders/:id/rename - Rename a folder
  • PATCH /api/folders/:id/star - Star/Unstar a folder

Default Storage Limit

Each user gets 10GB of storage by default. This can be modified in the User model.

Security Features

  • Password hashing with bcryptjs
  • JWT token-based authentication
  • File access restricted to owners
  • Input validation and sanitization

Future Enhancements

  • File sharing with other users
  • File preview (images, PDFs, etc.)
  • Search functionality
  • File versioning
  • Real-time collaboration
  • Cloud storage integration (AWS S3, Google Cloud Storage)

License

ISC

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

i am building mini distributed file system and anyone who have want accesse the source code please let me konw

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages