{"id":35129642,"url":"https://github.com/thydrslen/form-factor","last_synced_at":"2026-03-06T03:01:10.410Z","repository":{"id":266797187,"uuid":"899379865","full_name":"ThyDrSlen/form-factor","owner":"ThyDrSlen","description":"Form Factor provides real-time workout form cues for form correction.","archived":false,"fork":false,"pushed_at":"2026-02-23T09:43:40.000Z","size":31048,"stargazers_count":1,"open_issues_count":24,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-23T13:40:25.030Z","etag":null,"topics":["fitness","ios","website"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ThyDrSlen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"docs/AGENTS.md","dco":null,"cla":null}},"created_at":"2024-12-06T06:31:38.000Z","updated_at":"2026-02-23T05:17:35.000Z","dependencies_parsed_at":"2024-12-06T07:29:52.754Z","dependency_job_id":"64099d9f-2d14-4e52-b571-483f627b65ea","html_url":"https://github.com/ThyDrSlen/form-factor","commit_stats":null,"previous_names":["thydrslen/form-factor"],"tags_count":50,"template":false,"template_full_name":null,"purl":"pkg:github/ThyDrSlen/form-factor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThyDrSlen%2Fform-factor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThyDrSlen%2Fform-factor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThyDrSlen%2Fform-factor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThyDrSlen%2Fform-factor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ThyDrSlen","download_url":"https://codeload.github.com/ThyDrSlen/form-factor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThyDrSlen%2Fform-factor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30160022,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T22:39:40.138Z","status":"online","status_checked_at":"2026-03-06T02:00:08.268Z","response_time":250,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fitness","ios","website"],"created_at":"2025-12-28T04:58:22.675Z","updated_at":"2026-03-06T03:01:10.364Z","avatar_url":"https://github.com/ThyDrSlen.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Form Factor 💪\n\n\n\nForm Factor is an iOS-first fitness and health app built with Expo and Supabase. It gives real-time form cues from the phone camera—counting reps, flagging issues (e.g., swing on pull-ups, squat depth), and auto-logging sets—to improve outcomes and reduce injury. It also delivers fast offline workout/food logging, HealthKit-powered trends, video and form capture, and an experimental ARKit body-tracking flow. Web is mostly display-first.\n\n## What it does\n- Tracking: Offline-first foods and workouts using SQLite with sync queue, realtime backfill, conflict handling, and soft delete to Supabase.\n- Health: HealthKit permissions, summaries (steps, HR, weight), trend analysis, and historical bulk sync to Supabase; watch connectivity helpers included.\n- Form \u0026 media: ARKit body-tracking tab (pull-up/push-up rep detection, speech cues, Vision Camera overlay), Fusion Engine (combines camera, watch, and audio data), video capture/upload to Supabase Storage, and a feed with signed URLs plus comments.\n- Coach \u0026 notifications: AI coach backed by Supabase Edge Function `coach` (OpenAI), push token registration and preferences, and Edge Function `notify` for Expo push delivery.\n- UI/Navigation: Expo Router tabs, React Native Paper components; web target is read-only with Playwright smoke coverage.\n\n## Status and roadmap\n- Implemented: offline foods/workouts, HealthKit summaries/trends, video upload + feed, AI coach, push notification plumbing, Playwright auth flow, Jest unit scaffolding, Fusion Engine (v1).\n- In progress: ARKit body-tracking polish (see `docs/ARKIT_BODY_TRACKING_GUIDE.md`) and metrics upload, broader E2E coverage, telemetry/error-handling hardening.\n- Planned: Richer social/feed interactions, ML recommendations, production push campaigns.\n\n## Repository layout\n- `app/`: Expo Router screens (`(auth)`, `(tabs)`, `(modals)`); ARKit scan and dashboard live here.\n- `components/`, `contexts/`, `hooks/`, `lib/`: shared UI, data, services (offline sync, healthkit, notifications, coach/video services).\n- `lib/fusion/`: **Fusion Engine** core logic (sensor fusion, degradation modes).\n- `modules/arkit-body-tracker/`: custom native module for ARKit.\n- `backstage/`: POC for a developer portal (see `backstage/README.md`).\n- `supabase/`: migrations and Edge Functions (`coach`, `notify`), plus storage bucket policies.\n- `scripts/`: env/setup helpers (e.g., `preinstall-clean.js`), native build utilities, and repair scripts (UUID fixes, `ci_local.py`).\n\n## Quick Start\n\nFor a detailed setup guide, see [docs/DEVELOPER_ONBOARDING.md](docs/DEVELOPER_ONBOARDING.md).\n\n1.  **Install**: `bun install`\n2.  **Env**: `cp .env.example .env.local` (fill in Supabase/Expo keys)\n3.  **Run**: `bun run ios` (Simulator) or `bun run ios:device` (Physical Device)\n\n## EAS Build Policy\n- `eas build` does **not** run for pull requests; paid builds happen on `main` after merge (and on `develop` if you keep staging deploys automatic).\n- Deploy jobs are gated by workflow policy checks, blocking security checks, and deploy preflight validation.\n- Husky `pre-push` always runs `python3 scripts/ci_local.py --quick`. Local iOS preview builds run by default on `main`/`develop`, and can be enabled on feature branches with `CI_LOCAL_RUN_EAS_PREVIEW_LOCAL=1`.\n- You can run `bun run ci:push` anytime to reproduce the hook, or `bun run preview:local:submit` to build locally and upload/submit the same `.ipa`.\n\n## Testing and QA\n- Lint/types: `bun run lint`, `bun run check:types`, `bun run check:dead-code`.\n- Unit: `bun run test` (Jest + Testing Library).\n- E2E (web target): `bun run test:e2e` (Playwright + Bun).\n- E2E in Docker: `bun run test:e2e:docker` (containerized testing).\n- E2E with UI: `bun run test:e2e:ui` (interactive debugging).\n\nSee [TESTING.md](TESTING.md) for detailed testing documentation.\n\n## Backend (Supabase)\n\n### Edge Functions (request flow)\n\n```mermaid\nsequenceDiagram\n  autonumber\n  actor User\n  participant App as Expo App\n  participant Coach as Edge Function: coach\n  participant OpenAI as OpenAI API\n\n  User-\u003e\u003eApp: Enter prompt\n  App-\u003e\u003eCoach: functions.invoke('coach')\u003cbr/\u003eJWT + {messages, context}\n  Coach-\u003e\u003eOpenAI: Chat completion (OPENAI_API_KEY)\n  OpenAI--\u003e\u003eCoach: Response text\n  Coach--\u003e\u003eApp: { message }\n  App--\u003e\u003eUser: Render response\n```\n\n```mermaid\nsequenceDiagram\n  autonumber\n  participant Server as Cron/Webhook/Backend\n  participant Notify as Edge Function: notify\n  participant DB as Postgres (service role)\n  participant Expo as Expo Push API\n  participant Device as User Device\n\n  Server-\u003e\u003eNotify: POST + x-notify-secret (optional)\u003cbr/\u003e{userIds or tokens, title, body, data}\n  Notify-\u003e\u003eDB: Lookup tokens (SUPABASE_SERVICE_ROLE_KEY)\n  DB--\u003e\u003eNotify: Tokens\n  Notify-\u003e\u003eExpo: Send batch (\u003c= 90 tokens/request)\n  Expo--\u003e\u003eNotify: Receipts\n  Notify-\u003e\u003eDB: Prune invalid tokens\n  Notify--\u003e\u003eServer: {delivered, invalidTokens, attempted}\n  Expo--\u003e\u003eDevice: Push notification\n```\n\n### Source-of-truth links\n- Migrations / schema: `supabase/migrations/`\n- Storage policies: `supabase/migrations/012_create_video_buckets.sql`\n- Coach guide: `docs/COACH_FUNCTION.md`\n- Edge function code: `supabase/functions/coach/index.ts`, `supabase/functions/notify/index.ts`\n\n## Documentation\n- **Start Here**: `docs/DEVELOPER_ONBOARDING.md`.\n- Repo standards and commands: `docs/AGENTS.md`.\n- ARKit: `docs/ARKIT_BODY_TRACKING_GUIDE.md`.\n- HealthKit sync/trends: `docs/HEALTHKIT_SYNC_AND_TRENDS_GUIDE.md` and `docs/HEALTHKIT_SYNC_QUICK_START.md`.\n- Platform-specific/native tips: `docs/PLATFORM_SPECIFIC_CODE_GUIDE.md`, `docs/WATCH_APP_GUIDE.md`.\n- CI/CD and releases: `docs/CI-CD.md`, `docs/TESTFLIGHT_WORKFLOW.md`, `docs/TESTFLIGHT_RELEASE.md`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthydrslen%2Fform-factor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthydrslen%2Fform-factor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthydrslen%2Fform-factor/lists"}