Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

mehmoodulhaq570/WifiX

Repository files navigation

πŸ“‘ WifiX

Easy LAN File Sharing Made Simple

Python React Flask License PRs Welcome

Share files seamlessly across your local network with drag-and-drop simplicity, QR code access, and real-time updates.

Features β€’ Quick Start β€’ Documentation β€’ 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

# 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:

python backend/app.py
# Server runs on http://localhost:5000

Terminal 2 - Frontend:

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:

# 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


☁️ Cloud Deployment (For Public Access):

For production deployment with Docker, systemd, HTTPS, and more, see DEPLOYMENT.md.

Quick production options:

# 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 - 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:

    cd D:\Projects\WifiX
    python -m venv .venv
    .\.venv\Scripts\Activate.ps1
  2. Install Python dependencies:

    pip install -r backend/requirements.txt
  3. Configure environment variables (optional):

    # 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:

    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:

    cd frontend\react
  2. Install Node dependencies:

    npm install
  3. Configure environment variables: Create or edit .env file:

    VITE_API_URL=http://localhost:5000
    
  4. Run the Vite dev server:

    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:

πŸ“‹ 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):

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):

VITE_API_URL=http://localhost:5000  # Backend API URL

File Upload Limits

Modify in backend/app.py:

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.

πŸ“Š 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/<filename> Delete file 20/min
GET /api/download/<filename> 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 for complete documentation.

πŸ› οΈ Development

Prerequisites

  • Python 3.8+
  • Node.js 16+
  • Git

Setup Development Environment

# 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):

$env:FLASK_ENV="development"
python backend/app.py

Terminal 2 - Frontend (with HMR):

cd frontend\react
npm run dev

Building for Production

cd frontend\react
npm run build
# Build output in dist/ folder

See 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.

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 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 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)

  • Docker support (see DEPLOYMENT.md)
  • 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 for version history and GitHub Issues for tracking.

πŸ™ Acknowledgments

Built with amazing open-source tools:

πŸ“ž Support & Community


Made with ❀️ for easy local file sharing

If you find WifiX useful, please ⭐ star this repository!

Report Bug Β· Request Feature Β· Documentation

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.).