
RecoverFit
HRV · Sleep · Recovery
RecoverFit is a 100% on-device health app that computes a daily 0–100 recovery score from Apple HealthKit data. It weights heart rate variability (HRV), resting heart rate, sleep, and training load into a single readiness signal that shows how recovered your body is today. Every calculation runs on-device with no server, and AI insights are generated locally via Apple Foundation Models.
Apple Watch collects rich HRV, sleep, and workout data, but scattered numbers make it hard to answer 'should I train today?'. RecoverFit fuses that data into one recovery score using algorithms grounded in sports-science literature (e.g. Hulin et al. 2014 EWMA-ACWR) to reduce overtraining and injury risk—while keeping all processing on-device with no privacy trade-off.
App preview
What it does
Daily Recovery Score
Auto-computes a 0–100 score each day by weighting HRV (35%), resting heart rate (20%), sleep (30%), and training load (15%). Full weights apply when both HRV and RHR exist; otherwise weights are redistributed and a missing-data penalty (up to 0.15) is applied to avoid over-extrapolation.
Baseline-Relative HRV & RHR
Uses each user's trailing 7-day average as a personal baseline: today's HRV is scored as a ratio to baseline (≥1.10 → 100) and resting heart rate as an absolute delta from baseline (≤−5 bpm → 100), interpolated across bands—a relative assessment tuned to each person's normal range.
Training Load & ACWR
Computes the acute:chronic workload ratio (ACWR) with an EWMA model from Hulin et al. (2014), using λ_acute = 2/(7+1) = 0.25 and λ_chronic = 2/(28+1) ≈ 0.069. ACWR zones (sweet spot 0.8–1.3, caution 1.3–1.5, danger ≥1.5) are color-coded to flag overtraining risk.
HR-Zone Training Strain
Derives daily strain by splitting workout heart rate into five %-of-max-HR zones, multiplying time-in-zone by zone weights (Zone 1 = 1× … Zone 5 = 8×). When HR samples are unavailable, it falls back to an active-calorie estimate (kcal/100).
Sleep Analysis
Derives a dedicated sleep score from duration (40%), efficiency (25%), consistency (20%), and stages (15%). Stages are scored by deviation from ideal ratios (deep 20%, REM 25%); when stage data is missing, it re-weights to duration (55%), consistency (30%), and efficiency (15%).
On-Device AI Coach
Uses Apple Foundation Models' LanguageModelSession (iOS 26) to assemble recovery score, HRV, sleep, and ACWR into context and generate daily insights and weekly summaries on-device, falling back to score/recommendation-based template insights on unsupported devices.
Trends & Home Widgets
Visualizes trends with Swift Charts and powers three home-screen widgets—recovery score, sleep score, training readiness—through App Group shared storage. Widget timelines refresh hourly, and the recovery widget supports the small and medium families.
Privacy-First Data
Integrates HealthKit read-only—never writing health data—and lets users export their own recovery, sleep, and training history via CSV. All persistence stays in a local SwiftData container.
How it's built
Language
UI
Widgets
Health
Persistence
On-Device AI
Commerce
Architecture
Protocol-first Clean Architecture separates View → ViewModel → Protocol → Implementation, with all computation done on-device and no server. Recovery, sleep, and training-load engines are isolated as pure-function structs for easy unit testing, and Swift 6 strict concurrency is enforced by isolating SwiftData repositories as @ModelActor actors.
- 1
Recovery score fusion: combines HRV 35% · RHR 20% · sleep 30% · training load 15%, redistributing weights when HRV/RHR are missing, applying a missing-data penalty (0.15), and capping the score at 70 when data is sparse.
- 2
EWMA-ACWR training-load model: based on Hulin et al. (2014), it uses acute λ = 0.25 (7-day) and chronic λ ≈ 0.069 (28-day) to compute the acute:chronic ratio, carrying prior load forward to accumulate the trend.
- 3
100% on-device: HealthKit inputs, recovery/sleep/training-load computation, and AI insights all run locally, so health data never leaves the device. HealthKit access is read-only and persistence stays in a local SwiftData container.
- 4
Protocol-first DI: nine repository/service protocols abstract external dependencies and are init-injected into DailyCalculationService and ViewModels, enabling unit tests that swap all nine dependencies with mocks.
- 5
Swift 6 concurrency safety: four SwiftData repositories are implemented as @ModelActor actors with @unchecked Sendable on @Model types to safely cross actor boundaries, while recovery computation parallelizes HealthKit fetches via async let inside a @MainActor @Observable service.
- 6
App Group shared storage: the app and the WidgetKit extension read the same data through the group.com.junsoft.recoverfit container, refreshing widget data right after computation and reflecting the latest recovery score on an hourly timeline.
- 7
Graceful AI fallback: it checks Foundation Models availability at runtime and, on unsupported devices, switches to rule-based template insights driven by score, HRV deviation, sleep duration, and recommendation band for a consistent experience across all hardware.
41
Engine unit tests
9
DI protocols
3
Home widgets
4
@ModelActor repos
100% on-device
Data processing



