Developer Documentation - Sidduri2025/RehabEdge GitHub Wiki

RehabEdge – Developer Setup, Testing, and Deployment Guide

1. Tools and Services Used

Backend

  • Node.js with Express (API and server)
  • MySQL Database
  • Prisma ORM (database management)
  • JWT (authentication)
  • bcrypt (password hashing)
  • Nodemailer (email services)
  • node-cron (scheduled reminders)

Frontend (Web)

  • HTML, CSS, JavaScript

Mobile Application

  • Android (Kotlin)
  • CameraX (camera integration)
  • MediaPipe (posture detection)
  • Retrofit & OkHttp (API communication)
  • Room Database & SharedPreferences (local storage)

Notifications

  • Firebase Cloud Messaging (FCM)

2. Project Structure

rehabedge/

├── backend/ → Node.js + Express API ├── android/ → Android application (Kotlin) ├── prisma/ → Database schema and migrations ├── assets/ → MediaPipe models and resources └── .env.example → Environment variables template

3. Development Environment Setup

Prerequisites

  • Git
  • Node.js (LTS version)
  • MySQL Server
  • Android Studio
  • Google Chrome (for testing APIs if needed)

Step-by-Step Setup

Clone the Repository

git clone <YOUR_REPO_LINK> cd rehabedge

cd backend

npm install

Configure Environment Variables Copy .env.example and rename it to .env

Update the following values:

  • DATABASE_URL (your MySQL connection string)
  • JWT_SECRET (any secure random string)
  • EMAIL_USER and EMAIL_PASS (for email services)
  • Set Up Database

Create a MySQL database named:

  • rehabedge
  • Run Prisma migrations:
  • npx prisma migrate dev
  • (Optional) Seed the database:
  • npx prisma db seed
  • Start Backend Server
  • npm run dev

Backend will run on:

  • http://localhost:5000
  • Android Setup
  • Open the android folder in Android Studio
  • Allow Gradle to sync
  • Replace google-services.json with your Firebase configuration file
  • Update backend API URL in:
  • ApiClient.kt
  • Ensure MediaPipe model files are present in the assets folder
  • Run the application on an emulator or physical device
  1. Running the Code for Testing
  • Backend API Testing (Postman)
  • Start backend server:
  • npm run dev
  • Open Postman

Test health endpoint:

  • GET http://localhost:5000/api/health
  • Expected response:
  • { "status": "OK" }
  • Test Authentication APIs
  • POST /auth/register
  • POST /auth/login
  • Test other APIs
  • Patient dashboard APIs
  • Reminder APIs
  • Verify
  • Responses are correct
  • Data is stored in MySQL database
  • Android App Testing
  • Launch app from Android Studio
  • Register and login
  • Start therapy session
  • Test posture detection using camera
  • Verify
  • Posture detection works (MediaPipe)
  • API calls are successful
  • Notifications work (if Firebase configured)
  1. Configuring Your Own Services

Developers should configure their own services as follows:

  • Database
  • Create your own MySQL database
  • Update DATABASE_URL in .env
  • Authentication
  • Set your own JWT_SECRET
  • Email Services
  • Provide your own SMTP credentials in .env
  • Firebase
  • Create a Firebase project
  • Download google-services.json
  • Replace the existing file in Android project
  1. Deployment Requirements
  • Node.js hosting environment (e.g., Render, AWS, etc.)
  • MySQL database (cloud or local)
  • Firebase project (for notifications)
  • Configured environment variables
  • Public domain or API URL
  1. Production Deployment Steps
  • Backend Deployment

  • Set up production MySQL database

  • Update .env with production values

  • Install dependencies:

  • npm install

  • Run migrations:

  • npx prisma migrate deploy

  • Start server:

  • npm start

  • Android Deployment

  • Update API base URL to production server

  • Configure Firebase project

  • Build release version:

  • Build → Generate Signed Bundle / APK

  • Create signing keystore

  • Generate APK or AAB file

  • Upload to Google Play Store

  1. Conclusion

This documentation provides complete instructions for setting up, testing, and deploying the RehabEdge system. A developer with no prior environment setup can follow these steps to install, configure, and run the project successfully using their own services.