Files
health-app/README.md
marcus 65bf540ea0
Some checks failed
Build & Release APK / build (push) Has been cancelled
Replace Basic-auth login with an API token set in Settings
The app no longer shows a login screen. It opens straight to the Today
screen, which shows nothing until a bearer API token is saved in the new
Settings screen. The token is verified against health-meta.json before it
is stored in the keychain, and can be removed from the same screen.

Server side: health-auth accepts Authorization: Bearer <HEALTH_APP_TOKEN>
(read + write for the Fitbit sync, but not admin-only /life/* paths).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-19 23:07:00 -08:00

73 lines
2.8 KiB
Markdown

# health-app
Cross-platform (iOS + Android) Expo app — native front end for the private
health dashboard at **https://health.rehbock.xyz**.
The app is a pure client: all data lives on the server and is fetched live over
HTTPS with a bearer API token. Nothing is stored on the device except the auth
token (in the platform keychain via `expo-secure-store`).
## Screens
| Screen | Data source |
| --- | --- |
| Today | overview cards + clinical priorities (`health-meta.json`) |
| Blood | `/api/health/v1/biomarkers` + `/draws` — search, flags, sparklines |
| Sleep | `/api/health/v1/sleep` + `sleep-data.json` — stacked stage chart |
| Train | `/api/health/v1/workouts` — weekly volume chart, expandable sessions |
| Body | `dexa-scans.json` — DXA summary with deltas, regions, indices |
| Mind | `/api/meditation/v1/stats` + `/sessions` |
| DNA | `ancestry-traits.json` — 99 AncestryDNA traits |
Ported from the PWA at `health.rehbock.xyz/app/`
(repo `marcus/health.rehbock.xyz`, `app/index.html`); charts are
react-native-svg, tap a bar for the night/week detail.
## Development
```sh
npm install
npx expo start # scan the QR with Expo Go (iOS or Android)
```
There is no login screen. Open **Settings** (⚙️ on the Today screen) and paste the API token;
without one the app has no data. The server accepts it via `HEALTH_APP_TOKEN` in
`health-auth` (`~/personal/health-auth/.env` on the VPS, passed through `docker-compose.yml`).
Rotate it by changing that value and running `docker compose up -d`.
## Android release APK
Signing expects (auto-skipped if absent, falling back to the debug key):
- keystore `~/.android-keys/health-app-release.jks` (alias `health`), or `$HEALTH_KEYSTORE`
- password in `~/.android-keys/health-app-release.password`, or `$KEYSTORE_PASSWORD`
The signing config is injected by `plugins/with-release-signing.js` at prebuild.
```sh
npx expo prebuild --platform android
cd android && ./gradlew assembleRelease
# → android/app/build/outputs/apk/release/app-release.apk
```
Install on GrapheneOS by copying the APK over, or via Obtainium.
## CI (Gitea Actions)
Every push to `main` runs `.gitea/workflows/release.yml`: prebuild →
signed arm64 APK → Gitea release tagged `v1.0.<run_number>`, APK attached.
`app.config.js` stamps `VERSION_CODE`/`VERSION_NAME` from the run number so
each release installs as an upgrade (Obtainium-friendly).
Repo secrets: `KEYSTORE_B64` (base64 of the jks), `KEYSTORE_PASSWORD`.
## iOS
No Mac is available in this setup, so there is no local iOS build. Options:
- **Expo Go** (zero setup): `npx expo start`, scan the QR from the iPhone.
- **EAS Build** (real install): `npx eas build -p ios` — needs an Apple
Developer account; produces a TestFlight/ad-hoc build in the cloud.
The `ios.bundleIdentifier` is already set to `xyz.rehbock.health`.