This project provides a web interface for viewing Apple Health data via a web interface using Grafana and a Node.js server.
This project aims to be as beginner-friendly as possible, so if you're just getting started with programming, or consider yourself a "non-technical" person, this is a safe space! Of course, this also serves as a great base for the more seasoned developers to build on.
In order to use this project, you will need:
- The Health Auto Export app for iPhone
- Docker Desktop installed on your computer
- Download and install Docker Desktop for your platform here
- Clone or download this repository to your desired location on your computer
- Open a terminal/command prompt in the project folder
- Run
sh ./create-env.shto create the.envfile, or create the file manually with the following variables:NODE_ENV:productionMONGO_HOST:hae-mongoMONGO_USERNAME:adminMONGO_PASSWORD:mypassword(set a secure password)MONGO_DB:health-auto-exportMONGO_PORT:27017
- You may need to uncomment the line
user: "0:0"indocker-compose.yamlwhen running Ubuntu. - Run
docker compose up -din your terminal. - Open Grafana in your browser at http://localhost:3000
- Login with the default credentials:
admin / admin - Determine your computer's local IP address and note it down
- Configure the Health Auto Export app to send data to http://your-computer-ip:3001/api/data as outlined in Step 3
- Configure the Grafana data source by selecting
Administrationin the left sidebar, then search forInfinity - Select and install
Infinityplugin. After installation, selectAdd new data source - Give the data source a name, for example
Health Auto Export - In the
URL, Headers & Paramssection, set theBase URLtohttp://host.docker.internal:3001 - Select
Save & testto complete the data source setup - This data source can now be used to create dashboards using the synced data
- Install and open the Health Auto Export app on your iPhone
- Navigate to the
Automationstab - Create a new automation
- Configure the automation with the following settings:
- Automation Type:
REST API - URL:
http://your-computer-ip:3001/api/data - Headers:
api-keysk-xxx(write token in.env) - Data Type:
Health MetricsorWorkouts(create separate automations for each if you want to sync different data types) - Export Format:
JSON - Aggregate Data:
Enabled🟢 - Aggregate Interval:
Days(this can be adjusted according to the level granularity you want when viewing your data) - Batch Requests:
Enabled🟢
- Automation Type:
- Tap
Updatein the top navigation bar to save the automation - Use
Manual Exportto select a date range and manually trigger a data export to your computer
- Open Grafana in your browser at http://localhost:3000
- Create a new dashboard or import a pre-configured dashboard as described in Step 5
If you are unfamiliar with Grafana, you can import pre-configured dashboards to get started quickly.
- Navigate to the
Dashboardstab - Select
Newand thenImport - Upload the dashboard JSON file from the
dashboard-examplesfolder, or copy the JSON into theImport via dashboard JSON modeltext area - You can find a full list of metrics available in
MetricName.ts. These can be used in the datasource URL in order to fetch each metric from the database.
If you encounter issues:
- You can use ChatGPT or Claude to help you troubleshoot or fix specific errors
- Ensure Docker is running
- If you're still stuck, feel free to reach out using the support options below.
If you need assistance:
- Open an issue on GitHub
- Join the Discord server
- Contact support
Your contributions are welcome! Whether it's a bug fix, a new feature, a documentation update, or sharing your dashboards, we appreciate your help.
If you'd like to contribute to this project, create a pull request with your changes.
