A hand-gesture-controlled Flappy Bird game designed for rehabilitation purposes. Available as both a desktop application (Pygame) and a web application (React + FastAPI) โ play anywhere on any device!

rehab_wingsgit clone https://github.com/Nihith303/rehab-wings-website-version.git
cd rehab-wings-website-version
Create a MySQL database:
CREATE DATABASE IF NOT EXISTS rehab_wings;
The backend will automatically create the required tables (
patients,game_sessions) on startup.
Create backend/.env:
DB_HOST=localhost
DB_PORT=3306
DB_NAME=rehab_wings
DB_USER=root
DB_PASSWORD=your_password_here
SECRET_KEY=your-secret-key-here
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=1440
cd backend
pip install -r requirements.txt
python -m uvicorn main:app --reload --port 8000
The API will be available at http://localhost:8000
API Documentation: Visit http://localhost:8000/docs for interactive Swagger UI.
cd frontend
npm install
npm run dev
The web app will be available at http://localhost:5173
pip install -r requirements.txt
python game.py
Requires a webcam for hand gesture detection.
| Layer | Technology |
|---|---|
| Frontend | React 18, Vite 5, TailwindCSS 3, Axios |
| Backend | FastAPI, SQLAlchemy, Uvicorn |
| Database | MySQL 8.0 |
| Auth | bcrypt (password hashing), JWT (session tokens) |
| Game Engine | HTML5 Canvas (web), Pygame (desktop) |
| Hand Tracking | MediaPipe.js (web), MediaPipe + OpenCV (desktop) |
| Input | Platform | Action |
|---|---|---|
Spacebar |
Desktop browser | Flap |
Click |
Desktop browser | Flap |
Tap |
Mobile browser | Flap |
Close Hand โ |
Webcam (any) | Flap |
| Method | Endpoint | Description |
|โโโ|โโโ-|โโโโ-|
| POST | /api/patients/register | Register new patient with password |
| POST | /api/patients/login | Login and receive JWT token |
| POST | /api/patients/set-password | Set password for desktop-migrated patients |
| GET | /api/patients/{id}/stats | Get player statistics |
| Method | Endpoint | Description |
|โโโ|โโโ-|โโโโ-|
| POST | /api/game/start | Start a game session |
| POST | /api/game/end | End session, save score & duration |
| GET | /api/game/check-playtime/{id} | Check remaining daily playtime |
| Method | Endpoint | Description |
|โโโ|โโโ-|โโโโ-|
| GET | /api/leaderboard | Top high scores |
| GET | /api/leaderboard/daily | Daily aggregated statistics |
| GET | /api/leaderboard/sessions/{id} | Session history for a player |
patients| Column | Type | Description |
|โโโ|โโ|โโโโ-|
| id | INT (PK, AI) | Primary key |
| name | VARCHAR(100) | Patient name |
| patient_id | VARCHAR(50, UNIQUE) | Unique patient identifier |
| password_hash | VARCHAR(255) | bcrypt password hash (nullable for desktop patients) |
| high_score | INT | All-time high score |
| created_at | TIMESTAMP | Account creation time |
| updated_at | TIMESTAMP | Last update time |
game_sessions| Column | Type | Description |
|โโโ|โโ|โโโโ-|
| id | INT (PK, AI) | Primary key |
| patient_id | VARCHAR(50, FK) | References patients.patient_id |
| session_date | DATE | Date of the session |
| start_time | TIME | Session start time |
| end_time | TIME | Session end time |
| duration_seconds | INT | Total session duration |
| score | INT | Score achieved in the session |
Both the desktop and web versions share the same MySQL database (rehab_wings). This means:
password_hash column is auto-added to the existing table if missingThis project is for rehabilitation and educational purposes.
Nihith โ GitHub