Syntropy Health
How it works

How Syntropy Health works

A technical overview of how Syntropy Health connects to your health accounts and keeps your data on your own devices, for curious users, security reviewers and EHR app-program teams.

Summary

Syntropy Health is a patient-facing, self-hosted personal health record. A person runs it on their own computer or home server. Using the SMART App Launch standalone patient launch, it retrieves that person's own records from their healthcare organizations and stores them in a local database, where they can view trends, prepare visit summaries and export their data. There is no Syntropy-operated backend that receives patient data.

Intended usersPatients and caregivers (parents, or adult children managing a parent's records with proxy access).
Launch typeStandalone patient launch, public client, authorization code with PKCE (S256).
Ongoing accessoffline_access where the server supports it. On Epic, each instance registers its own signing key (dynamic client registration) and renews access with a signed JWT assertion.
FHIR versionR4 (US Core / USCDI).
AccessRead-only, per-resource patient/*.read scopes, trimmed to what each server supports.
Redirect URIhttps://health.syntropylabs.io/callback

Architecture

Patient portal (Epic, Oracle Health, athenahealth, ...)
        |  OAuth 2.0 authorization code (+ PKCE), TLS
        v
health.syntropylabs.io/callback   static page, runs in the browser only
        |  browser navigation to the instance named in "state"
        v
Your Syntropy Health instance      localhost, home network or Tailscale
        |  token exchange with PKCE verifier, FHIR R4 API calls (TLS)
        v
Encrypted local database           records, normalized trends, tokens

The callback page

OAuth requires a fixed HTTPS redirect URI, but every Syntropy Health instance has its own address. The callback page bridges that gap:

  • It is a static file with a strict Content-Security-Policy. It loads nothing else, stores nothing, and its script contacts nothing. Its link does carry the sign-in's one-time code and the state parameter, which holds your instance's address and, in release builds, the key those builds share, so Cloudflare Pages, which hosts the page, handles them as part of the request for it.
  • It reads the destination from state. Only this computer (localhost, 127.x) returns straight away. Any other address gets a page that names it, and the code goes on only after you click to confirm it's your own server. That includes home-network addresses (10.x, 172.16–31.x, 192.168.x), Tailscale's 100.64.0.0/10 addresses and .local names, which anyone on the same network can claim, Tailscale names ending in .ts.net, which Tailscale Funnel can make public, public domains, and short names like nas. So a phone or browser that reaches your server over the network asks you once per sign-in.
  • The only sensitive value it handles is the one-time authorization code. Redeeming it takes the PKCE verifier held by whoever started the sign-in, which is your instance when you started it. Someone else could start a sign-in that names their own server and send you the link, which is why the page asks, and why you should not continue if you didn't start it.

An instance on its own domain works the same way. Behind a reverse proxy, pass on X-Forwarded-Proto and X-Forwarded-Host so the instance knows its public address, and add the domain to SYNTROPY_ALLOWED_HOSTS.

Wearable sign-in

Oura and WHOOP don't support PKCE-only public clients and require a client secret. For these, an edge worker at syntropy-auth-relay.syntropylabs.workers.dev performs the code exchange, then hands the tokens to your instance in the URL fragment (never sent to any server) and keeps no copy. It sends them only where the callback page would: straight back to this computer, and to any other address, your home network included, only after you confirm it, before it exchanges anything. Renewals go through the same worker. The worker:

  • has request logging turned off and is rate-limited per IP address;
  • requests only read-only scopes (Oura: daily summaries, heart rate, workouts and blood oxygen; WHOOP: recovery, cycles, workouts and sleep), not email or profile;
  • never calls the wearable data APIs itself.

To keep tokens off the worker entirely, register your own Oura or WHOOP developer app, then enter its client ID, secret and, if you registered anything other than your instance's own /callback, its redirect URI in Settings → Wearables. Sign-in and renewals then go straight from your instance to the provider. Google Health (Fitbit and Pixel Watch) always works this way, with your own Google Cloud app, and never uses the worker. Google's scopes for this are restricted: a Cloud project left in testing mode works for named test users, and Google expires its sign-ins after 7 days, so you sign in again weekly. Google Health is an advanced setup; Fitbit and Pixel Watch will also come through the Android app and Health Connect.

Data handled

CategoryFHIR resources
DemographicsPatient
Problems, allergiesCondition, AllergyIntolerance
MedicationsMedicationRequest, Medication
Results and vitalsObservation (laboratory, vital-signs, social-history), DiagnosticReport
Care historyEncounter, Procedure, Immunization, DocumentReference, Binary
Care coordinationCareTeam, CarePlan, Goal, Device, Coverage

Security

  • A password is required (scrypt). Sessions are opaque, hashed server-side, HttpOnly and SameSite, and repeated failed sign-ins are slowed down.
  • A new instance can be set up from the same computer, the home network or Tailscale. From anywhere else it needs the one-time setup code the server prints, so no one on the internet can claim it first.
  • The database and data folder are readable only by the account that runs Syntropy Health.
  • OAuth tokens, signing keys and secrets are encrypted at rest with a per-instance key (or the one in the SYNTROPY_SECRET_KEY setting). A backup includes that key.
  • Your records are encrypted on disk with SQLCipher (AES-256). On Mac and Windows the key is in the Keychain or the system's protected storage; on Linux and Docker it's in a file beside the data unless you put it elsewhere, so use full-disk encryption there. A database from before this stays as it is until you choose to encrypt it in Settings → Security. Encryption protects a copy of the files, not a running computer: keep FileVault or BitLocker on, and treat the data folder and your backups as the record itself. If you lose the key and every backup, nobody can bring the records back. The full threat model says what's protected from whom.
  • Phones sign in with the password or a single-use code and receive individually revocable device tokens; the password is never stored on the phone.
  • Every sign-in, sync and export is written to a local activity log the user can review.
  • The built-in assistant is optional. Before a provider outside the user's network answers for the first time, the app asks the user to confirm that it will see their questions and the records it looks up. Connected AI apps get read-only access.

Run it yourself

curl -fsSL https://health.syntropylabs.io/install.sh | sudo sh
# or, with Docker:
docker run -d --name syntropy-health --restart unless-stopped -p 8000:8000 -v syntropy-data:/data ghcr.io/enriqueneyra/syntropy-health

Step-by-step instructions are in the setup guides.