StepSync is an AI-powered dance coaching platform that analyzes reference and practice videos, breaks choreography into learnable steps, and gives personalized feedback. Pose estimation, landmark alignment, Dynamic Time Warping, and similarity metrics identify differences in timing, posture, positioning, and execution.
Run the FastAPI backend and Expo frontend in separate terminals. The commands
below use Windows PowerShell. Start each terminal in the project root: the
folder containing backend/, frontend/, and run-local.ps1.
- Python 3.12.
- Node.js LTS and npm.
- Expo Go installed on your phone for testing the mobile app.
- FFmpeg and FFprobe available on your system
PATHfor video processing. - Deno available on
PATHfor full YouTube download support.
The pose model is included at backend/models/pose_landmarker_full.task.
See backend/README.md
for Windows FFmpeg and Deno setup.
Create the backend virtual environment and install its dependencies from the project root:
py -3.12 -m venv backend/venv
.\backend\venv\Scripts\python.exe -m pip install -r backend/requirements.txtInstall frontend dependencies:
cd frontend
npm ciCreate the environment files from the project root. These commands preserve any
existing .env files:
if (-not (Test-Path backend/.env)) { Copy-Item backend/.env.example backend/.env }
if (-not (Test-Path frontend/.env)) { Copy-Item frontend/.env.example frontend/.env }For login, saved dances, and progress, configure the same Supabase project in both files. Replace the example values with your project's values:
backend/.env:
STEPSYNC_SUPABASE_URL=https://your-project.supabase.co
STEPSYNC_SUPABASE_SECRET_KEY=your-server-secret-keyfrontend/.env:
EXPO_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
EXPO_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your-publishable-or-anon-key
EXPO_PUBLIC_API_URL=http://192.168.1.42:8000Replace 192.168.1.42 with your computer's Wi-Fi IPv4 address (ipconfig shows
it). Uncomment EXPO_PUBLIC_API_URL in the copied frontend file to connect to
the backend. npm start and npm run tunnel update an active local API address
to the computer's current IP automatically. A commented-out API URL keeps mock
analysis mode enabled.
Supabase configuration is needed for the complete saved-dance workflow. Without
frontend Supabase values, the login screen is skipped. To run the backend without
Supabase, remove or comment out its placeholder Supabase values. Optional Gemini
coaching uses GEMINI_API_KEY in backend/.env; without it, coaching uses the
rules-based fallback. Keep backend secret keys out of the frontend.
In terminal 1, from the project root:
cd backend
.\venv\Scripts\python.exe -m uvicorn app.main:app --host 0.0.0.0 --port 8000Binding to 0.0.0.0 lets your phone reach the backend on the local network.
On the computer, open http://127.0.0.1:8000/docs for the API documentation or
http://127.0.0.1:8000/health to check that the server is responding.
For backend-only testing on the computer, you can instead run ./run-local.ps1
from the project root. That launcher binds to 127.0.0.1, uses project-local
FFmpeg and Deno when present, and stores data under .local-tools/data.
In terminal 2, from the project root:
cd frontend
npm startKeep your phone and computer on the same Wi-Fi. On iPhone, scan the terminal's QR code with the Camera app and open it in Expo Go. On Android, scan it inside Expo Go. Camera recording should be tested in the phone app.
To start Expo with a tunnel instead, run this from frontend/:
npm run tunnelIf Expo prompts to install its tunnel dependency, follow the prompt. This tunnels
the frontend development server only. The backend still runs at the local
EXPO_PUBLIC_API_URL, so the phone must stay on the same network as the computer.
Keep both terminals running while using the app. Stop each process with Ctrl+C.
-
Open
http://<computer-ip>:8000/healthin the phone's browser. If it does not load, check the Wi-Fi connection, backend host binding, and Windows Firewall access for Python on your private network. -
If the startup script picks the wrong network adapter, set the correct IP in the frontend terminal before starting Expo:
$env:API_IP = "192.168.1.42" npm start
-
After editing environment values, restart the backend and frontend as needed. To clear Expo's cache, use
npm start -- --clearornpm run tunnel -- --clear.
The pose CSV keeps the original x_norm, y_norm, z_relative, and world_* fields. It also includes hip_relative_x_norm, hip_relative_y_norm, and hip_relative_z_norm: MediaPipe world coordinates translated so the midpoint between the hips is the origin, then divided by the distance from that hip midpoint to the shoulder midpoint. The normalized coordinates are unitless torso lengths; torso_scale_m records the scale used. These fields are blank when the hip/shoulder anchors are unreliable or world coordinates are unavailable.
Hip centering removes image placement differences and torso scaling reduces overall body-size differences. It does not make 2D camera viewpoints or individual limb proportions identical. Compare joint angles or normalized bone directions alongside these coordinates, confidence values, and a consistent left/right mirroring convention for more robust pose matching. Camera viewpoint changes may still require calibration or a compatible camera setup.
The CSV also preserves raw coordinates and adds smooth_x_norm, smooth_y_norm,
smooth_z_relative, and smooth_hip_relative_*_norm fields. These use a
conditional three-frame moving average gated by MediaPipe landmark visibility
and presence (both at least 0.50). Reliable points pass through unchanged
unless two small consecutive displacements reverse direction by at least 120
degrees, each at most 100 ms apart. Only then is the trailing average used.
The step limits are 0.03 in normalized image coordinates and 0.10 in torso
lengths; steps below 0.0001 are ignored. Adjust the jitter constants near the
top of backend/pose_extraction.py. The preview uses these processed coordinates.
This is an application heuristic: MediaPipe's legacy smooth_landmarks option
enables smoothing and does not expose a jitter-detection flag. The Tasks API used
here has no such flag. Small deliberate reversals can be classified as jitter;
isolated jumps and the first two samples are not corrected by this check.
Histories reset when tracking is unreliable, missing, or more than 100 ms apart;
gaps stay blank. Use consistent settings for reference and webcam poses.
- Python, TypeScript, and SQL
- React Native and MediaPipe
- FastAPI, OpenCV, NumPy, SciPy, PyTorch, and Supabase
- Pose estimation, TensorFlow Lite, and Gemini
The local YouTube intake and automatic pose-processing workflow is documented in backend/README.md, including Swagger requests, tests, configurable limits, and storage. Frontend details are in frontend/README.md. Docker remains a placeholder.
Make sure Docker Desktop is installed and running.
docker compose up -d
docker compose down
docker compose psThis is a generic starter configuration. The team can add project-specific dependencies and startup commands later.