A full-stack file sharing application similar to Google Drive, built with React, Node.js, Express, and MongoDB.
- ✅ User Authentication - Secure registration and login with JWT tokens
- ✅ File Upload - Upload multiple files with drag-and-drop support
- ✅ File Management - View, download, and delete files
- ✅ User-based Sharing - Share files with specific users
- ✅ Link-based Sharing - Generate shareable links for files
- ✅ Access Control - Only authenticated users can access shared files
- ✅ File Metadata - Display filename, size, type, and upload date
- ✅ Link Expiry - Set expiration time for shares (hours)
- ✅ Audit Log - Track file views and downloads
- ✅ Per-user Roles - Owner/Viewer access levels
- ✅ Bulk Upload - Upload multiple files at once
- Authorization checks on all routes
- JWT-based authentication
- Password hashing with bcrypt
- File type and size validation
- Protected API endpoints
- Middleware for authentication
- React 18+
- React Router DOM
- Axios for API calls
- React Icons
- CSS3 with modern styling
- Node.js
- Express.js
- MongoDB with Mongoose
- JWT for authentication
- Multer for file uploads
- Bcrypt for password hashing
Before running this application, make sure you have:
- Node.js (v14 or higher)
- MongoDB (local or cloud instance)
- npm or yarn package manager
git clone <your-repo-url>
cd DocuFlowcd backend
# Install dependencies
npm install
# Create .env file
cp .env.example .env
# Edit .env file with your configuration
# Required variables:
# - PORT=5000
# - MONGODB_URI=mongodb://localhost:27017/docuflow
# - JWT_SECRET=your_secret_key
# - FRONTEND_URL=http://localhost:3000cd frontend
# Install dependencies
npm install
# Create .env file
cp .env.example .env
# Edit .env file:
# REACT_APP_API_URL=http://localhost:5000/apiMake sure MongoDB is running:
# If using local MongoDB
mongod
# Or start MongoDB service (macOS)
brew services start mongodb-community
# Or start MongoDB service (Linux)
sudo systemctl start mongodBackend (Terminal 1):
cd backend
npm start
# or for development with auto-reload:
npm run devFrontend (Terminal 2):
cd frontend
npm startThe application will open at http://localhost:3000
DocuFlow/
├── backend/
│ ├── models/
│ │ ├── User.js # User schema
│ │ ├── File.js # File schema
│ │ └── Share.js # Share schema
│ ├── routes/
│ │ ├── auth.js # Authentication routes
│ │ ├── files.js # File management routes
│ │ └── share.js # Sharing routes
│ ├── middleware/
│ │ ├── auth.js # JWT authentication middleware
│ │ └── upload.js # File upload middleware
│ ├── uploads/ # Uploaded files storage
│ ├── server.js # Express server
│ ├── package.json
│ └── .env
├── frontend/
│ ├── public/
│ ├── src/
│ │ ├── components/
│ │ │ ├── FileUpload.js # File upload component
│ │ │ ├── FileList.js # File list component
│ │ │ ├── ShareModal.js # Share modal component
│ │ │ └── PrivateRoute.js # Protected route component
│ │ ├── context/
│ │ │ └── AuthContext.js # Auth context provider
│ │ ├── pages/
│ │ │ ├── Login.js # Login page
│ │ │ ├── Register.js # Register page
│ │ │ ├── Dashboard.js # Main dashboard
│ │ │ └── SharedFile.js # Shared file viewer
│ │ ├── services/
│ │ │ ├── api.js # Axios instance
│ │ │ └── services.js # API services
│ │ ├── App.js
│ │ └── index.js
│ ├── package.json
│ └── .env
└── README.md
POST /api/auth/register- Register new userPOST /api/auth/login- Login userGET /api/auth/me- Get current userGET /api/auth/users/search- Search users
POST /api/files/upload- Upload files (authenticated)GET /api/files/my-files- Get user's filesGET /api/files/shared-with-me- Get shared filesGET /api/files/:id- Get file detailsGET /api/files/:id/download- Download fileDELETE /api/files/:id- Delete file
POST /api/share/user- Share with specific usersPOST /api/share/link- Generate share linkGET /api/share/link/:shareLink- Access via share linkGET /api/share/file/:fileId- Get file sharesDELETE /api/share/:shareId- Revoke shareDELETE /api/share/:shareId/user/:userId- Remove user from shareGET /api/share/audit/:fileId- Get audit log
- Navigate to
/registerto create an account - Or login at
/loginwith existing credentials
- Drag and drop files or click to browse
- Support for PDF, images, CSV, Excel, Word, text files, ZIP
- Maximum file size: 10MB
- Bulk upload supported (up to 10 files)
- Click the share icon on a file
- Select "Share with Users" tab
- Search for users by username or email
- Select users and set access level
- Optionally set expiration time (in hours)
- Click "Share with Users"
- Click the share icon on a file
- Select "Share via Link" tab
- Set access level (Viewer/Editor)
- Optionally set expiration time
- Click "Generate Share Link"
- Copy and share the generated link
- View files shared with you in the "Shared With Me" tab
- Access share links (must be logged in)
- Download shared files
- Set environment variables:
PORT=5000
MONGODB_URI=<your-mongodb-connection-string>
JWT_SECRET=<your-secret-key>
FRONTEND_URL=<your-frontend-url>
NODE_ENV=production
- Build command:
npm install - Start command:
npm start
- Set environment variable:
REACT_APP_API_URL=<your-backend-url>/api
- Build command:
npm run build - Publish directory:
build
- Create a free cluster at MongoDB Atlas
- Get connection string
- Update
MONGODB_URIin backend.env
PORT=5000
MONGODB_URI=mongodb://localhost:27017/docuflow
JWT_SECRET=your_jwt_secret_key_here
NODE_ENV=development
FRONTEND_URL=http://localhost:3000REACT_APP_API_URL=http://localhost:5000/api- Authentication: JWT tokens stored in localStorage
- Authorization: Middleware checks on all protected routes
- File Access: Verified ownership or share permissions
- Password Security: Bcrypt hashing with salt
- File Validation: Type and size checks
- CORS: Configured for frontend URL only
- Documents: PDF, Word (.doc, .docx), Text (.txt)
- Spreadsheets: Excel (.xls, .xlsx), CSV
- Images: JPEG, PNG, GIF, WebP
- Archives: ZIP
- Maximum file size: 10MB per file
- Maximum files per upload: 10 files
- Bulk Upload: Select multiple files at once
- Drag & Drop: Drag files directly to upload area
- Share Management: View and revoke existing shares
- Audit Log: Track who accessed your files
- Expiry: Automatic access revocation after expiry
- Ensure MongoDB is running
- Check connection string in
.env - Verify network access (for MongoDB Atlas)
- Check file size (max 10MB)
- Verify file type is supported
- Ensure
uploads/directory exists
- Clear localStorage and login again
- Check JWT_SECRET in backend
.env - Verify token is being sent in headers
cd backend
npm run dev # Uses nodemon for auto-reloadcd frontend
npm start # Hot reload enabled- File preview functionality
- Folder organization
- File compression
- Search and filtering
- Advanced permissions
- File versioning
- Activity notifications
- Mobile app
ISC
Jayaram Uday
For issues and questions, please open an issue on GitHub.