healthkit-cli
A command-line tool and Expo module for interacting with Apple HealthKit, allowing you to seed, query, and verify health data in development.
Introduction
The apple-health tool provides a comprehensive bridge between Expo-based React Native applications and Apple HealthKit. It is primarily designed for developers building health and fitness applications who require an efficient way to test data flows without manual input on a physical device. By leveraging a dedicated CLI and React hooks, it enables seamless reading and writing of over 70 quantity types, 40 category types, and 80 workout types. Whether you are generating mock health data, auditing application permissions, or visualizing activity rings, this tool provides a robust interface to simulate complex user health profiles.
-
Extensive support for HealthKit data types including step counts, heart rate, sleep analysis, nutrition metrics, and detailed workout parameters.
-
Includes a powerful command-line interface that enables bulk data seeding using NDJSON, efficient querying of historical health records, and real-time status monitoring.
-
Provides a set of React hooks like usePermissions, useHealthKitQuery, and useHealthKitStatistics to simplify data management and UI integration within Expo projects.
-
Features native modules for rendering Apple Watch-style activity rings, enhancing the visual feedback of user health progress.
-
Offers background delivery support and real-time subscriptions, allowing apps to remain responsive to health data updates even when minimized.
-
Comprehensive TypeScript support ensures type safety across all interactions, from permission requests to complex data queries.
-
To use the CLI, configure your Expo app with the devtools hook (useHealthKitDevTools) to establish a bridge between the terminal and the app instance.
-
Use the bunx apple-health batch command for importing large datasets; inputs should be formatted as newline-delimited JSON objects with specific start, duration, and type attributes.
-
When defining data for seeding, utilize the provided date formats such as relative offsets (e.g., -1h, -2d) or specific ISO8601 strings for precise temporal control.
-
The tool is strictly intended for iOS development environments where HealthKit is available; it includes a no-op shim for web and Android platforms to prevent runtime crashes.
-
Be aware that Apple HealthKit intentionally hides read authorization status; the SDK provides methods to request permissions and verify status, but testing via queries is the recommended approach for confirming access.
Repository Stats
- Stars
- 33
- Forks
- 3
- Open Issues
- 3
- Language
- TypeScript
- Default Branch
- main
- Sync Status
- Idle
- Last Synced
- May 1, 2026, 08:11 AM