A web-based interactive file sharing system built with the MERN stack (MongoDB, Express, React, Node.js). The frontend is built using React and TypeScript.
- User authentication (Login/Signup - Basic auth check seems implemented)
- File upload (including drag & drop) using MongoDB GridFS for storage.
- File listing and management (basic listing implemented).
- File download from GridFS.
- File sharing (placeholder UI, backend logic needs implementation).
- User roles (concept exists, needs further implementation).
- Backend: Node.js, Express.js, MongoDB (with Mongoose and GridFS), bcryptjs (for password hashing), express-session, connect-mongo, multer (for handling file uploads in memory before streaming to GridFS)
- Frontend: React, TypeScript, Tailwind CSS, Lucide Icons
- Node.js (v18 or v20 LTS recommended)
- npm or yarn
- MongoDB (local instance or MongoDB Atlas account)
-
Clone the repository:
git clone <your-repository-url> cd File_Sharing_System
-
Install Backend Dependencies:
cd server npm install -
Install Frontend Dependencies:
cd frontend npm install -
Set up Environment Variables (Backend - for Local Development)
- Navigate to the
serverdirectory. - Create a
.envfile if it doesn't exist. - Ensure it contains the following variables (the current project's
.envis pre-configured for the shared Atlas DB):MONGODB_URI=mongodb+srv://chrisworks1102:1IAfFdhFNO8x5CCx@cluster0.yqje5if.mongodb.net/fileShareDB?retryWrites=true&w=majority&appName=Cluster0 SESSION_SECRET=B28CF9CAFBB5BFAB3F3114AC58BD1 # Replace with your own strong secret if preferred # NODE_ENV=development # Typically defaults to development if not set # NODE_ENV=production # Keep this commented out for local development
- Note: For local development,
NODE_ENVshould generally not be set toproductionas this affects features like secure cookies.
- Navigate to the
-
Set up Environment Variables (Frontend - for Local Development)
- Navigate to the
frontenddirectory. - Create a
.envfile if it doesn't exist. - Add the
VITE_API_BASE_URLvariable pointing to your local backend server:VITE_API_BASE_URL=http://localhost:5001
- Note: When deploying, you'll need to configure the production
VITE_API_BASE_URLvia your hosting provider's environment variables (e.g., on Render), not by committing the production URL in this.envfile.
- Navigate to the
-
Start the Backend Server:
- Open a terminal in the
serverdirectory. - Run:
cd server npm run dev - The backend server should start, typically on
http://localhost:5001.
- Open a terminal in the
-
Start the Frontend Development Server:
- Open another terminal in the
frontenddirectory. - Run:
cd frontend npm run dev - The frontend application should be accessible at
http://localhost:3000.
- Open another terminal in the
-
Access the Application:
- Open your web browser and navigate to
http://localhost:3000.
- Open your web browser and navigate to
File_Sharing_System/
├── frontend/ # React Frontend Application
│ ├── index.html # HTML entry point
│ ├── src/
│ │ ├── components/ # Reusable React components
│ │ ├── pages/ # Page components
│ │ ├── styles/ # Stylesheets
│ │ └── utils/ # Utility functions
├── server/ # Node.js/Express Backend API
│ ├── src/
│ │ ├── config/ # Configuration files
│ │ ├── controllers/# Request handlers
│ │ ├── db/ # Database connection logic
│ │ ├── middleware/ # Express middleware
│ │ ├── models/ # Mongoose models
│ │ ├── routes/ # API routes
│
└── README.md # This file
Contributions are welcome! Please feel free to submit pull requests or open issues.
(Optional: Add your license information here, e.g., MIT License)