A modern file sharing application built with React, Node.js, Express, PostgreSQL, and Machine Learning capabilities.
- ✅ User authentication (register/login with JWT)
- ✅ File upload/download
- ✅ File management (view, delete, rename)
- ✅ File search functionality
- ✅ Storage quota management
- ✅ Activity logging
- ✅ Responsive UI with TailwindCSS
- 📁 Folder management
- 🔗 File sharing with links (password-protected, expiring links)
- 🤖 ML-powered features:
- Auto-categorization
- Semantic search
- PII detection
- Image classification
- React 18 with TypeScript
- Vite (build tool)
- TailwindCSS (styling)
- Zustand (state management)
- React Router (routing)
- Axios (HTTP client)
- React Hot Toast (notifications)
- Lucide React (icons)
- Node.js with Express.js
- TypeScript
- PostgreSQL (database)
- JWT (authentication)
- Multer (file upload)
- Bcrypt (password hashing)
- Python with FastAPI
- Sentence Transformers (semantic search)
- spaCy (NER/PII detection)
- MobileNetV2 (image classification)
- Node.js 18+ (download from nodejs.org)
- PostgreSQL 15+ (download from postgresql.org)
- npm or yarn package manager
- 8GB RAM minimum
- 10GB+ free disk space
cd c:\Users\uk187\Desktop\ALLprojects\fileshare- Start PostgreSQL service
- Create a new database:
CREATE DATABASE fileshare;- Run the migration to create tables:
# Connect to PostgreSQL
psql -U postgres -d fileshare
# Run the migration file
\i database/migrations/001_initial_schema.sqlAlternatively, you can use a PostgreSQL GUI like pgAdmin or DBeaver to run the SQL file.
# Navigate to backend
cd backend
# Install dependencies
npm install
# Create .env file
copy .env.example .envEdit the .env file with your database credentials:
NODE_ENV=development
PORT=5000
HOST=localhost
# Database - UPDATE THESE
DB_HOST=localhost
DB_PORT=5432
DB_NAME=fileshare
DB_USER=postgres
DB_PASSWORD=your_postgres_password
# JWT Secret - CHANGE THIS
JWT_SECRET=your_super_secret_jwt_key_change_this_in_production
JWT_EXPIRES_IN=7d
# File Upload
MAX_FILE_SIZE=104857600
UPLOAD_DIR=./uploads
# Storage Quotas (in bytes)
DEFAULT_USER_QUOTA=5368709120
ADMIN_USER_QUOTA=53687091200
# CORS
CORS_ORIGIN=http://localhost:5173# Navigate to frontend (from project root)
cd frontend
# Install dependencies
npm installOption A: Run Backend and Frontend Separately
Terminal 1 (Backend):
cd backend
npm run devTerminal 2 (Frontend):
cd frontend
npm run devOption B: Run Both Together (from project root)
# First install root dependencies
npm install
# Then run both
npm run dev- Frontend: http://localhost:5173
- Backend API: http://localhost:5000
- Health Check: http://localhost:5000/health
fileshare/
├── backend/ # Node.js backend
│ ├── src/
│ │ ├── config/ # Configuration files
│ │ ├── controllers/ # Route controllers
│ │ ├── middlewares/ # Express middlewares
│ │ ├── models/ # Database models (future)
│ │ ├── routes/ # API routes
│ │ ├── services/ # Business logic
│ │ ├── types/ # TypeScript types
│ │ ├── utils/ # Utility functions
│ │ └── server.ts # Entry point
│ ├── uploads/ # File storage
│ ├── .env # Environment variables
│ └── package.json
│
├── frontend/ # React frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── pages/ # Page components
│ │ ├── services/ # API services
│ │ ├── store/ # Zustand stores
│ │ ├── types/ # TypeScript types
│ │ ├── utils/ # Utilities
│ │ ├── App.tsx # Main App component
│ │ └── main.tsx # Entry point
│ └── package.json
│
├── database/
│ └── migrations/ # SQL migrations
│
├── ml-service/ # Python ML service (future)
│
└── docs/ # Documentation
POST /api/auth/register- Register new userPOST /api/auth/login- Login userGET /api/auth/profile- Get user profile (protected)PUT /api/auth/profile- Update profile (protected)POST /api/auth/change-password- Change password (protected)
POST /api/files/upload- Upload file (protected)GET /api/files- Get user files (protected)GET /api/files/search?q=query- Search files (protected)GET /api/files/:id- Get file details (protected)GET /api/files/:id/download- Download file (protected)DELETE /api/files/:id- Delete file (protected)PUT /api/files/:id/rename- Rename file (protected)
- Navigate to http://localhost:5173/register
- Enter your name, email, and password
- Click "Register"
- Log in to your account
- Click "Upload File" button
- Select a file from your computer
- File will be uploaded and appear in your file list
- Click the download icon next to any file
- File will be downloaded to your default downloads folder
- Click the trash icon next to any file
- Confirm deletion
- File will be soft-deleted and storage will be freed
- Enter a search term in the search box
- Click "Search"
- Matching files will be displayed
- Stores user information
- Tracks storage quota and usage
- Handles authentication
- Stores file metadata
- Tracks file ownership
- Supports versioning
- Maintains file history
- Allows file recovery
- Manages file sharing links (future)
- Supports password protection and expiration
- Tracks user actions
- Audit trail for compliance
- Stores ML-generated metadata (future)
- Categories, tags, summaries
Backend:
cd backend
npm run build
npm startFrontend:
cd frontend
npm run build
npm run previewSee backend/.env.example for all available environment variables.
- Ensure PostgreSQL is running
- Check database credentials in .env
- Verify database exists:
psql -U postgres -l
- Check
MAX_FILE_SIZEin .env - Ensure
uploads/directory exists and is writable - Verify file type is in allowed MIME types
- Backend (5000): Change
PORTin backend/.env - Frontend (5173): Change port in frontend/vite.config.ts
- Check your storage usage in dashboard
- Delete unnecessary files
- Contact admin to increase quota (for future admin panel)
- Change
JWT_SECRETin production - Use HTTPS in production
- Never commit
.envfiles - Implement rate limiting for production
- Use strong passwords
- Regular database backups
- Files are streamed, not loaded in memory
- Database connection pooling
- Lazy loading for frontend
- Pagination for file lists
- Efficient file hashing
-
Folder Management
- Create/delete folders
- Move files between folders
- Folder sharing
-
File Sharing
- Generate shareable links
- Password protection
- Link expiration
- Download limits
-
ML Features (Resource-optimized)
- Semantic search with small models
- Auto-categorization
- Duplicate detection
- PII detection
- Image classification
-
Admin Panel
- User management
- Storage management
- System analytics
-
Additional Features
- File preview
- Trash/Recycle bin
- File comments
- Activity timeline
- Email notifications