https://github.com/mehmoodulhaq570/wifix
A local server file sharing system over the same WIFI.
https://github.com/mehmoodulhaq570/wifix
file-sharing no-cloud wifi-share
Last synced: 3 months ago
JSON representation
A local server file sharing system over the same WIFI.
- Host: GitHub
- URL: https://github.com/mehmoodulhaq570/wifix
- Owner: mehmoodulhaq570
- License: other
- Created: 2025-10-25T20:10:01.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-12-10T18:22:06.000Z (6 months ago)
- Last Synced: 2025-12-11T05:02:54.168Z (6 months ago)
- Topics: file-sharing, no-cloud, wifi-share
- Language: JavaScript
- Homepage: https://wifix.readthedocs.io/
- Size: 948 KB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# π‘ WifiX
**Easy LAN File Sharing Made Simple**
[](https://www.python.org/)
[](https://react.dev/)
[](https://flask.palletsprojects.com/)
[](LICENSE)
[](CONTRIBUTING.md)
Share files seamlessly across your local network with drag-and-drop simplicity, QR code access, and real-time updates.
[Features](#-features) β’ [Quick Start](#-quick-start) β’ [Documentation](https://mehmoodulhaq570.github.io/WifiX/) β’ [Contributing](#-contributing)
---
## β¨ Features
### Core Functionality
- π **Drag & Drop Uploads** - Intuitive file upload with progress tracking
- β¬οΈ **Instant Downloads** - Quick file retrieval from any connected device
- π± **QR Code Access** - Scan to connect from mobile devices instantly
- π **Real-Time Sync** - WebSocket-powered live updates across all clients
### Security & Control
- π **Host/Client Approval** - Host authorizes all client connections
- π **PIN Protection** - Global and per-file PIN authentication
- π **Secure Filenames** - Automatic sanitization prevents path traversal
- π‘οΈ **Rate Limiting** - Built-in protection against abuse
- π **Zeroconf Discovery** - Auto-discover WifiX servers on local network (mDNS/Bonjour)
### User Experience
- π **Dark Mode** - Toggle between light and dark themes
- ποΈ **Safe Deletion** - Confirmation modals prevent accidental removals
- π **Upload Progress** - Real-time feedback during file transfers
- πΎ **File Persistence** - Files remain until explicitly deleted
## π Quick Start
### Prerequisites
- Python 3.8 or higher
- Node.js 16 or higher
- npm or yarn
### Installation
```powershell
# Clone repository
git clone https://github.com/yourusername/WifiX.git
cd WifiX
# Backend setup
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r backend/requirements.txt
# Frontend setup
cd frontend\react
npm install
```
### Running the Application
**Terminal 1 - Backend:**
```powershell
python backend/app.py
# Server runs on http://localhost:5000
```
**Terminal 2 - Frontend:**
```powershell
cd frontend\react
npm run dev
# Development server on http://localhost:5173
```
### Access
- **Host Dashboard:** `http://localhost:5173`
- **Client Access:** Scan QR code or use displayed IP address
- **Mobile:** Scan QR code from any mobile device on same network
### Production Deployment
**π₯οΈ Desktop App (Recommended for Personal Use):**
WifiX can be packaged as a standalone desktop application using **Tauri**:
```powershell
# Quick start (after Rust installation)
.\START_TAURI.ps1
# Or manually:
cd frontend\react
npm run tauri:dev # Development mode
npm run tauri:build # Build .exe installer
```
π± **Benefits:**
- β
Single .exe file (~5 MB)
- β
No hosting costs
- β
Python backend auto-starts
- β
No internet required
- β
Users just download and run
π **Desktop app guide:** [TAURI_DESKTOP_APP.md](TAURI_DESKTOP_APP.md)
---
**βοΈ Cloud Deployment (For Public Access):**
For production deployment with Docker, systemd, HTTPS, and more, see **[DEPLOYMENT.md](DEPLOYMENT.md)**.
**Quick production options:**
```bash
# Docker deployment
docker-compose up -d
# Linux systemd service
sudo systemctl start wifux
# Production server (Gunicorn)
gunicorn -k eventlet -w 1 --bind 0.0.0.0:5000 backend.app:app
```
π **Full deployment guide:** [DEPLOYMENT.md](DEPLOYMENT.md) - Covers Docker, nginx, HTTPS, Zeroconf, monitoring, and more.
## π οΈ Tech Stack
| Layer | Technology | Purpose |
| ----------------- | ---------------------- | ------------------------- |
| **Backend** | Flask 2.3.2 | Web framework |
| | Flask-SocketIO | WebSocket support |
| | Flask-Limiter | Rate limiting |
| | Zeroconf | Network service discovery |
| | Werkzeug | Security utilities |
| **Frontend** | React 19 | UI framework |
| | Vite | Build tool & dev server |
| | Tailwind CSS + DaisyUI | Styling |
| | Socket.IO Client | Real-time communication |
| **Communication** | WebSocket | Live updates |
| | REST API | File operations |
## Project Structure
```
WifiX/
βββ backend/
β βββ app.py # Flask backend server
β βββ requirements.txt # Python dependencies for backend
βββ backend/uploads/ # File storage directory
βββ frontend/
β βββ react/
β βββ src/
β β βββ components/ # React components
β β β βββ Header.jsx
β β β βββ ServerControl.jsx
β β β βββ FileUploadZone.jsx
β β β βββ FileList.jsx
β β β βββ DeleteModal.jsx
β β β βββ ConnectionApprovalModal.jsx
β β β βββ ConnectionStatus.jsx
β β β βββ UploadErrorModal.jsx
β β β βββ DarkModeToggle.jsx
β β β βββ Footer.jsx
β β βββ hooks/ # Custom React hooks
β β β βββ useSocket.js
β β β βββ useFileUpload.js
β β β βββ useAuth.js
β β βββ utils/ # Utility functions
β β β βββ api.js
β β β βββ constants.js
β β βββ App.jsx # Main React component
β β βββ main.jsx # React entry point
β βββ .env # Environment variables
β βββ package.json # Node dependencies
β βββ vite.config.js # Vite configuration
βββ README.md
```
## Setup Instructions
### Backend Setup
1. **Create and activate Python virtual environment**:
```powershell
cd D:\Projects\WifiX
python -m venv .venv
.\.venv\Scripts\Activate.ps1
```
2. **Install Python dependencies**:
```powershell
pip install -r backend/requirements.txt
```
3. **Configure environment variables** (optional):
```powershell
# Create a .env file or set environment variables
$env:ACCESS_PIN = "1234" # Enable PIN authentication
$env:CORS_ORIGINS = "http://localhost:5173,http://localhost:5174"
$env:FILE_TTL_SECONDS = "0" # 0 = files persist until deleted
$env:SECRET_KEY = "your-secret-key" # Session encryption key
```
4. **Run the Flask backend**:
```powershell
python backend/app.py
```
Backend will start on `http://localhost:5000`
Note: uploaded files are now stored in `backend/uploads/`. During the migration the original top-level `uploads/` directory was copied and the original was renamed to `uploads_backup_20251111154617/` in the repo root as a safety backup β delete it only after you verify everything is present.
### Frontend Setup
1. **Navigate to frontend directory**:
```powershell
cd frontend\react
```
2. **Install Node dependencies**:
```powershell
npm install
```
3. **Configure environment variables**:
Create or edit `.env` file:
```
VITE_API_URL=http://localhost:5000
```
4. **Run the Vite dev server**:
```powershell
npm run dev
```
Frontend will start on `http://localhost:5173` (or 5174 if 5173 is in use).
## π Documentation
Comprehensive documentation is available in the `docs/` folder:
- **[Features Guide](docs/FEATURES.md)** - Detailed feature documentation
- **[Usage Guide](docs/USAGE.md)** - How to use WifiX
- **[API Documentation](docs/API.md)** - REST & WebSocket API reference
- **[Architecture](docs/ARCHITECTURE.md)** - System design and architecture
- **[Troubleshooting](docs/TROUBLESHOOTING.md)** - Common issues and solutions
- **[Contributing Guide](CONTRIBUTING.md)** - How to contribute
- **[Changelog](CHANGELOG.md)** - Version history
- **[Security Policy](SECURITY.md)** - Security guidelines
## π Project Structure
```
WifiX/
βββ backend/
β βββ app.py # Flask application
β βββ requirements.txt # Python dependencies
β βββ uploads/ # File storage (gitignored)
βββ frontend/
β βββ react/
β βββ src/
β β βββ components/ # React components
β β βββ hooks/ # Custom hooks
β β βββ utils/ # Utility functions
β β βββ App.jsx # Main app component
β β βββ main.jsx # Entry point
β βββ package.json # Node dependencies
β βββ vite.config.js # Vite configuration
βββ docs/ # Documentation
β βββ INDEX.md # Documentation index
β βββ ARCHITECTURE.md # System architecture
β βββ TROUBLESHOOTING.md # Problem solving
β βββ USAGE.md # Usage guide
βββ CONTRIBUTING.md # Contribution guidelines
βββ CHANGELOG.md # Version history
βββ SECURITY.md # Security policies
βββ API.md # API documentation
βββ LICENSE # MIT License
βββ README.md # This file
```
## βοΈ Configuration
### Environment Variables
**Backend (`backend/.env` or system):**
```bash
ACCESS_PIN=1234 # Optional: Enable PIN authentication
SECRET_KEY=your-secret-key-here # Session encryption (auto-generated if not set)
CORS_ORIGINS=http://localhost:5173 # Allowed origins (comma-separated)
FILE_TTL_SECONDS=0 # File auto-cleanup (0=disabled)
CLEANUP_INTERVAL_SECONDS=60 # Cleanup check interval
```
**Frontend (`frontend/react/.env`):**
```bash
VITE_API_URL=http://localhost:5000 # Backend API URL
```
### File Upload Limits
Modify in `backend/app.py`:
```python
app.config['MAX_CONTENT_LENGTH'] = 1024 * 1024 * 1024 # 1GB default
```
## π Security
WifiX includes multiple security layers:
- **Host Approval** - All client connections require host authorization
- **PIN Authentication** - Optional global and per-file PIN protection
- **Rate Limiting** - Prevents abuse (10 uploads/min, 20 deletes/min)
- **Secure Filenames** - Automatic sanitization prevents path traversal
- **Session Management** - Secure, HTTP-only cookies
- **CORS Protection** - Configurable origin restrictions
For security issues, see [SECURITY.md](SECURITY.md).
## π API Reference
### REST Endpoints
| Method | Endpoint | Description | Rate Limit |
| -------- | -------------------------- | -------------- | ---------- |
| `GET` | `/api/files` | List all files | - |
| `POST` | `/api/upload` | Upload file | 10/min |
| `DELETE` | `/api/delete/` | Delete file | 20/min |
| `GET` | `/api/download/` | Download file | - |
| `GET` | `/api/info` | Server info | - |
### WebSocket Events
**Client β Server:**
- `become_host` - Register as host
- `stop_host` - Stop hosting
- `request_connect` - Request connection
- `approve_request` - Approve client (host only)
- `deny_request` - Deny client (host only)
**Server β Client:**
- `file_uploaded` - New file available
- `file_deleted` - File removed
- `incoming_request` - Connection request (host)
- `request_approved` - Connection approved
- `request_denied` - Connection denied
See [API.md](API.md) for complete documentation.
## π οΈ Development
### Prerequisites
- Python 3.8+
- Node.js 16+
- Git
### Setup Development Environment
```powershell
# Clone repository
git clone https://github.com/yourusername/WifiX.git
cd WifiX
# Backend
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r backend/requirements.txt
# Frontend
cd frontend\react
npm install
```
### Running Development Servers
**Terminal 1 - Backend (with auto-reload):**
```powershell
$env:FLASK_ENV="development"
python backend/app.py
```
**Terminal 2 - Frontend (with HMR):**
```powershell
cd frontend\react
npm run dev
```
### Building for Production
```powershell
cd frontend\react
npm run build
# Build output in dist/ folder
```
See [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidelines.
npm run build
npm run preview # Preview production build
````
### Lint Frontend Code
```powershell
cd frontend\react
npm run lint
````
## Improvements Implemented
- β
Environment-based CORS configuration
- β
Comprehensive logging system
- β
Enhanced error handling with user feedback
- β
Rate limiting on critical endpoints
- β
File size validation (100MB limit)
- β
Modular component architecture
- β
Custom React hooks for reusability
- β
Constants file for configuration
- β
Improved error messages
- β
Delete confirmation modal
- β
Upload progress tracking
- β
File persistence (no auto-cleanup by default)
## Future Enhancements
- [ ] TypeScript migration for better type safety
- [ ] Unit tests (pytest for backend, vitest for frontend)
- [ ] Docker support for easy deployment
- [ ] HTTPS support for production
- [ ] Toast notifications (react-hot-toast)
- [ ] Virtual scrolling for large file lists
- [ ] File search and filtering
- [ ] Multi-file upload
- [ ] Folder support
- [ ] Download all as ZIP
## π Troubleshooting
For detailed troubleshooting, see [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md).
### Common Issues
**Port Already in Use:**
- Vite auto-selects next available port (5174, 5175...)
- Update `CORS_ORIGINS` in backend if needed
**Socket.IO Connection Errors:**
- Ensure `CORS_ORIGINS` includes frontend dev server URL
- Check firewall/antivirus settings
- Verify backend is running
**Upload Failures:**
- Check file size limit (1GB default)
- Verify rate limits (10 uploads/min)
- Check backend logs for errors
**Files Not Showing:**
- Verify PIN authentication (if enabled)
- Check host approval (if client)
- Refresh browser or reconnect
## π€ Contributing
We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for:
- Code of Conduct
- Development setup
- Coding standards
- Pull request process
- Issue guidelines
Quick contribution steps:
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit changes (`git commit -m 'Add AmazingFeature'`)
4. Push to branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
## π License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## πΊοΈ Roadmap
### Version 1.0.0 (Current)
- β
Core file sharing functionality
- β
Host/Client approval system
- β
PIN authentication
- β
QR code generation
- β
Real-time updates via WebSocket
- β
Dark mode support
- β
Rate limiting
### Version 1.1.0 (Planned)
- [x] Docker support (see [DEPLOYMENT.md](DEPLOYMENT.md))
- [x] Zeroconf/mDNS auto-discovery
- [ ] Database integration (SQLite/PostgreSQL)
- [ ] File search and filtering
- [ ] Batch file operations
- [ ] Enhanced mobile UI
### Future Versions
- [ ] TypeScript migration
- [ ] Unit and integration tests
- [ ] Folder upload/download
- [ ] ZIP archive creation
- [ ] HTTPS/SSL by default
- [ ] Multi-language support
- [ ] Room codes for easy connections
See [CHANGELOG.md](CHANGELOG.md) for version history and [GitHub Issues](https://github.com/mehmoodulhaq570/WifiX/issues) for tracking.
## π Acknowledgments
Built with amazing open-source tools:
- [Flask](https://flask.palletsprojects.com/) - Web framework
- [React](https://react.dev/) - UI library
- [Vite](https://vitejs.dev/) - Build tool
- [Tailwind CSS](https://tailwindcss.com/) - Styling framework
- [DaisyUI](https://daisyui.com/) - Component library
- [Socket.IO](https://socket.io/) - Real-time communication
- [Lucide](https://lucide.dev/) - Icon library
## π Support & Community
- π **Documentation:** Browse [GitHub Pages](https://mehmoodulhaq570.github.io/WifiX/)
- π **Issues:** Report bugs on [GitHub Issues](https://github.com/mehmoodulhaq570/WifiX/issues)
- π¬ **Discussions:** Join [GitHub Discussions](https://github.com/mehmoodulhaq570/WifiX/discussions)
- π **Security:** Report vulnerabilities via [SECURITY.md](SECURITY.md)
---
**Made with β€οΈ for easy local file sharing**
If you find WifiX useful, please β star this repository!
[Report Bug](https://github.com/mehmoodulhaq570/WifiX/issues) Β· [Request Feature](https://github.com/mehmoodulhaq570/WifiX/issues) Β· [Documentation](https://mehmoodulhaq570.github.io/WifiX/)
## Contributing
Contributions are welcome! Please open an issue or submit a pull request.
---
**Note**: This application is designed for trusted local networks. For production use on untrusted networks, implement additional security measures (HTTPS, stronger authentication, network isolation, etc.).