Overview
The Synheart Wear CLI is an all-in-one local development tool that combines a command-line interface with an embedded FastAPI server for testing WHOOP, Garmin, and Fitbit integrations. Features:- Local FastAPI server with OAuth flows
- Automatic ngrok tunnel exposure
- Webhook recording and inspection
- Token management (list, refresh, revoke)
- Data pulling from cloud APIs
- Hot-reload for development
Installation
From PyPI (Recommended)
From Source
Prerequisites
- Python 3.11+
- ngrok account (free): https://ngrok.com/
- Wearable API credentials (WHOOP, Garmin, etc.)
Quick Start
1. Configure ngrok
2. Create Environment File
Create.env.local:
3. Start Development Server
Commands
wear start dev - Start Local Server
Start local development server with ngrok tunneling.
--vendor, -v: Vendor to run (whoop,garmin, or omit for all)--port, -p: Port (default: 8000)--reload/--no-reload: Auto-reload on code changes (default: enabled)--env: Environment file (.env.local,.env.production)--open-browser: Auto-open OAuth URL--webhook-record/--no-webhook-record: Enable webhook recording (default: enabled)--verbose: Enable verbose logging
wear pull once - Fetch Data
Pull data from vendor cloud API (requires OAuth first).
--vendor: Vendor to pull from (required)--since: Time range (e.g.,7d,30d,2h)--data-types: Comma-separated types (recovery, sleep, workouts, cycles)--user-id: Specific user ID (optional)
wear tokens - Manage OAuth Tokens
List, refresh, or revoke OAuth tokens.
wear webhook - Inspect Webhooks
Inspect webhook events recorded during development.
Development Workflow
1. Start Local Server
2. Complete OAuth Flow
The browser opens automatically. Log in and authorize.3. Configure SDK
Use the ngrok URL in your Flutter app:4. Fetch Data
5. Test Webhooks
Webhooks are auto-recorded to__dev__/webhooks_recent.jsonl:
API Endpoints
WHOOP Endpoints
GET /v1/oauth/authorize- Get OAuth authorization URLGET /v1/oauth/callback- OAuth callback (GET)POST /v1/oauth/callback- OAuth callback (POST, mobile)POST /v1/webhooks/whoop- Webhook handlerDELETE /v1/oauth/disconnect- Disconnect userGET /v1/data/{user_id}/recovery- Fetch recovery dataGET /v1/data/{user_id}/sleep- Fetch sleep dataGET /v1/data/{user_id}/workouts- Fetch workout dataGET /v1/data/{user_id}/cycles- Fetch cycle data
Health Check
GET /health- Service health status
Troubleshooting
ngrok Issues
Problem: “ngrok endpoint already online” Solution:Port Already in Use
Problem: “Port 8000 is already in use” Solution:OAuth Flow Fails
Problem: “Authentication failed” Solution:- Check environment variables in
.env.local - Verify redirect URI matches vendor configuration
- Check ngrok URL is correct
- Look at server logs for detailed errors
Architecture
Security
- Token Storage: DynamoDB with KMS encryption (production)
- Dev Mode: Tokens stored locally in
__dev__/tokens.json - Webhook Verification: HMAC signature validation
- Environment Variables: Never commit
.env.localfiles
Resources
- Repository: synheart-wear-cli
- PyPI: synheart-wear-cli
- Issues: GitHub Issues
Author: Israel Goytom