Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

Docs: self-hosting answers from #install-help (Coach needs an admin, nginx under /gym, passkeys on http, iPhone, phone to server)

Duarte Santos5c1c0e9c07e2
diff --git a/.env.example b/.env.example
index 5699b2685..9ab1cbc19 100644
--- a/.env.example
+++ b/.env.example
@@ -20,9 +20,10 @@ RP_NAME=openGym
# (Point your proxy at the web container's WEB_PORT. See docs/SELF_HOSTING.md.)
# ── Admin dashboard & invite-only signup (optional) ────────────────────────
-# A fresh instance has open signup, and the FIRST profile created on it becomes
-# its admin. Admins get an "Admin dashboard" link in Settings to see users,
-# disable accounts, generate invite codes and view workout history.
+# A fresh instance has open signup and no admin. With FIRST_USER_ADMIN=1 (below)
+# the FIRST profile created on it becomes its admin. Admins get an "Admin
+# dashboard" link in Settings to see users, disable accounts, generate invite
+# codes, view workout history and set up the AI Coach.
#
# "First" means: the instance had no profiles at all when it registered. An
# instance that already has profiles promotes nobody when you upgrade, and an
@@ -233,9 +234,11 @@ RP_NAME=openGym
# VAPID_SUBJECT=mailto:[email protected]
# ── AI Coach (optional, off by default) ────────────────────────────────────
-# The Coach stays off until an admin turns it on in Settings → Admin and
-# connects a provider. An instance that never does is byte-for-byte the same
-# app it was before the feature existed.
+# The Coach stays off until an admin turns it on in Settings → Account →
+# Admin dashboard → AI Coach and connects a provider. There is no variable here
+# that switches it on: what you need is to BE an admin (FIRST_USER_ADMIN or
+# ADMIN_UIDS above). An instance that never does is byte-for-byte the same app
+# it was before the feature existed.
#
# Anthropic, OpenAI, Gemini and any OpenAI-compatible endpoint (Ollama, LM
# Studio, vLLM, OpenRouter…) are driven over plain HTTPS with an API key and
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ec4b571ec..992a97aa6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -122,6 +122,10 @@ you leave it alone. Handy for deciding whether those legs are really ready (than
- A phone app connected to your server now hears about a suggestion the server's automatic
review left. The server only knew how to say it by web push, which the app doesn't have, so the
review ran and the phone stayed quiet. Now the app tells you when you next open it.
+- Self-hosting docs for the questions Discord asked this week: getting from zero to a working
+ AI Coach (it starts with making yourself admin), nginx under `/gym` in both flavours with the
+ three mistakes that break it, passkeys without a fingerprint reader or on plain http, the
+ iPhone web app, and moving your phone's data onto your own server. All in the FAQ too.
## v1.4.2 (2026-10-18)
diff --git a/docs/AI_COACH.md b/docs/AI_COACH.md
index 8ddf906db..aac9b922a 100644
--- a/docs/AI_COACH.md
+++ b/docs/AI_COACH.md
@@ -38,6 +38,25 @@ configuration. (On the server, that is. The phone app's own-key Coach needs `htt
Nothing here is an environment variable or a restart — the whole point of the admin card is that
enabling the Coach is a decision you make in the app.
+### From zero to a working Coach (self-hosted)
+
+The one thing that does need `.env` is being an admin, because the switch lives in the admin
+dashboard. If **Settings → Account → Admin dashboard** isn't there for you, that's why the Coach
+"isn't showing up".
+
+1. **Be an admin.** Either `FIRST_USER_ADMIN=1` in `.env` *before* you create the very first
+ profile, or, if you already have one, copy **Settings → Account → Account ID** into
+ `ADMIN_UIDS=<that id>`. Then `docker compose up -d` (not `restart`, which keeps the old
+ environment) and reload the app. Details: [SELF_HOSTING.md §4](SELF_HOSTING.md#4-multiple-users).
+2. **Connect a provider.** **Settings → Account → Admin dashboard**, the **AI Coach** card:
+ **Set up the Coach**, pick a provider, paste its API key (or the endpoint, for a local
+ model), **Test the Coach**. Anthropic, OpenAI, Gemini and OpenAI-compatible endpoints work on
+ the default image; leave `API_TARGET` alone unless you want the Claude Agent SDK or Codex
+ (see [below](#with-a-runtime-in-the-container-claude-agent-sdk-codex-cli)).
+3. **Check the switch at the top of the card is on**, and that `COACH_DISABLED` isn't set.
+4. **Open it:** the menu at the top right of **Plan**, last entry, **Coach**. Everyone else on
+ the instance sees it after they reload.
+
### Where people find it
The Coach has one door: the **Coach** entry in the **Plan** menu (the button in the top-right
diff --git a/docs/FAQ.md b/docs/FAQ.md
index 2e59a8a64..3e494e145 100644
--- a/docs/FAQ.md
+++ b/docs/FAQ.md
@@ -28,6 +28,21 @@ it is listed there, the [public TestFlight beta](https://testflight.apple.com/jo
same app. A self-hosted instance added to the home screen from Safari works too (a full PWA that
works offline). See [MOBILE.md](MOBILE.md).
+### How do I use it on my iPhone right now?
+
+As a web app, which takes a minute:
+
+1. Open your openGym address in **Safari**. It has to be `https://` (see
+ [the passkey question](#passkeys-dont-work-on-plain-http-or-my-laptop-has-no-fingerprint-reader)
+ below); just looking around? The [demo](https://opengym.ch/demo/) works too, data stays in
+ the browser.
+2. **Share → Add to Home Screen.**
+3. Open it from the new icon and create your profile. Face ID makes the passkey.
+
+From the icon it runs full screen, works offline and can send notifications (iOS only allows web
+push from a home-screen app, not from a Safari tab). The native App Store app is coming; when it
+lands it can connect to the same server, so nothing you log now is wasted.
+
### Is it on Google Play?
It's coming: a new developer account has to run a closed test first (see the
@@ -84,6 +99,30 @@ gives your device a new passkey. Running the server yourself? `docker compose ex
recover.js "Your name"` prints one, the owner's included. Details in
[SELF_HOSTING.md](SELF_HOSTING.md#recovery-codes-when-every-way-in-is-gone).
+### Passkeys don't work on plain http, or my laptop has no fingerprint reader.
+
+Two separate things, both fixable:
+
+- **Plain `http://192.168.1.20:8080` (or any `http://ip:port`).** Browsers only do passkeys over
+ HTTPS, plus `http://localhost` on the machine itself. No setting in openGym changes that, and
+ an SSH tunnel doesn't help unless the browser ends up on `localhost`. Put HTTPS in front:
+ [SELF_HOSTING.md §3](SELF_HOSTING.md#3-expose-it-over-https-on-your-own-domain) for a domain or
+ Tailscale Serve, [SELF_HOSTING_HTTPS.md](SELF_HOSTING_HTTPS.md) for a real certificate on a
+ LAN-only address.
+- **No fingerprint reader.** You don't need one. A passkey can live in lots of places: your phone
+ (the browser shows a QR code, scan it, confirm on the phone), a password manager such as
+ Bitwarden, 1Password or Proton Pass, a security key, or Windows Hello with a PIN. If the browser
+ only ever asks for a fingerprint, look for "use another device" or "use a phone" in that dialog.
+ Already signed in on your phone? **Settings → Account → Add another device** gives the laptop
+ a passkey of its own. More in
+ [which passkey providers work](SELF_HOSTING.md#which-passkey-providers-work).
+
+Rather skip passkeys on that device? Put `PASSWORD_LOGIN=1` in `.env`, then `docker compose up -d`
+(not `restart`). The sign-in screen then offers **Sign in with password**, and **Create new
+profile** can use a password instead of a passkey. A profile you already made with a passkey gets
+its password under **Settings → Account → Password**, confirmed with that passkey once. Over plain
+http the password crosses your network unencrypted, so keep that to a network you trust.
+
### Can I use a password instead of a passkey?
Yes, if the instance allows it: set `PASSWORD_LOGIN=1`. It's off by default. See
@@ -95,6 +134,45 @@ Yes. Everyone creates their own profile and sees only their own data. You can ma
invite-only and give yourself an admin dashboard; see
[multiple users](SELF_HOSTING.md#4-multiple-users).
+### The AI Coach doesn't show up on my server.
+
+There's no setting in `.env` that turns it on: an admin switches it on in the app. So the usual
+missing piece is that nobody is admin yet (`FIRST_USER_ADMIN` is off by default). If **Settings →
+Account → Admin dashboard** isn't there for you:
+
+1. Copy your id from **Settings → Account → Account ID**, put `ADMIN_UIDS=<that id>` in `.env`,
+ run `docker compose up -d` (not `restart`) and reload the app.
+2. **Admin dashboard → AI Coach → Set up the Coach**: pick a provider, paste the key (or a local
+ model's address), **Test the Coach**, and make sure the switch at the top of the card is on.
+3. The Coach is the last entry in the menu at the top right of **Plan**.
+
+API-key providers and local models run on the normal image; `API_TARGET=coach` is only for the
+Claude Agent SDK and Codex. The full walk-through is in
+[AI_COACH.md](AI_COACH.md#from-zero-to-a-working-coach-self-hosted).
+
+### How do I serve it under a subpath like `/gym` with nginx?
+
+Two working setups, pick one: nginx passes `/gym/` through to the container and `.env` has
+`BASE_PATH=/gym`, or nginx strips it (`proxy_pass http://127.0.0.1:8080/;`, trailing slash) and
+`BASE_PATH` stays empty. Never both. `ORIGIN` is just `https://example.com`, no `/gym`, and leave
+out `proxy_cookie_path`: it breaks the session cookie over https. Copy-paste configs for both, and
+what each mistake looks like, are in
+[SELF_HOSTING.md](SELF_HOSTING.md#nginx-under-gym-both-ways).
+
+### Can I move my data from the phone app to my own server?
+
+Yes, two ways:
+
+- **Connect the app to the server** (the easy one). On the server's website, in a browser where
+ you're signed in: **Settings → Account → Pair the mobile app**. In the phone app: **Settings →
+ Account → Connect to my server**, enter the address and the code. The app asks whether to add
+ this device's workouts to your profile; say **Add them**. From then on the phone syncs with the
+ server. See [MOBILE.md](MOBILE.md#connecting-the-app-to-your-own-server).
+- **Export and import a file.** In the phone app: **Settings → Data & backup → Export backup
+ (JSON)** (or the .zip, if your own exercises have photos). On the server, signed in: **Settings →
+ Data & backup → Import backup**. If the profile there already has workouts the file doesn't,
+ it asks whether to replace or merge them in.
+
### How do I update?
`git pull && docker compose pull && docker compose up -d`. Your data is untouched. See
diff --git a/docs/SELF_HOSTING.md b/docs/SELF_HOSTING.md
index b6699bc5b..c445d2fa8 100644
--- a/docs/SELF_HOSTING.md
+++ b/docs/SELF_HOSTING.md
@@ -256,6 +256,18 @@ out and locked out everywhere until you re-enable it), and — with `INVITE_ONLY
revoking invite codes. Existing accounts keep working when you switch invite-only on. Admin access
is gated by your passkey and enforced server-side, so it needs no separate login.
+**Already registered and there's no Admin dashboard?** That's the usual way to find out
+`FIRST_USER_ADMIN` was off when you signed up (it is by default). It only ever applies to the very
+first profile, so switching it on now does nothing. Do this instead:
+
+1. Copy your id from **Settings → Account → Account ID** (tap it to copy).
+2. Put it in `.env`: `ADMIN_UIDS=<that id>`.
+3. `docker compose up -d`. Not `docker compose restart`: that keeps the old environment.
+4. Reload the app. **Settings → Account → Admin dashboard** is there now.
+
+The [AI Coach](AI_COACH.md#turning-it-on), invite codes and recovery codes all live in that
+dashboard, so this is step one for each of them.
+
### Default language
An instance whose people share a language can start everyone in it:
@@ -544,6 +556,71 @@ Either way, keep `ORIGIN` and `RP_ID` pointing at the address in the browser's b
subpath changes nothing about section 2 — but it does mean two instances under one hostname share
a passkey scope and can see each other's credentials. Give each its own hostname if that matters.
+#### nginx under `/gym`, both ways
+
+Pick one of these two and keep `.env` in step with it. Both were run against the shipped web
+container's config behind nginx with TLS, with a passkey sign-up and a password sign-up going
+through each. `8080` is `WEB_PORT`; use yours.
+
+**Passing the prefix through** (nothing after the port in `proxy_pass`), with `BASE_PATH=/gym`:
+
+```nginx
+location = /gym { return 301 /gym/; }
+
+location /gym/ {
+ proxy_pass http://127.0.0.1:8080; # no trailing slash: the container sees /gym/...
+ proxy_http_version 1.1;
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ client_max_body_size 48m; # photos and videos of custom exercises
+ proxy_read_timeout 300s; # a Coach request can take minutes
+}
+```
+
+```bash
+# .env
+BASE_PATH=/gym
+RP_ID=example.com
+ORIGIN=https://example.com
+```
+
+**Stripping the prefix** (a slash after the port), with `BASE_PATH` left empty:
+
+```nginx
+location = /gym { return 301 /gym/; }
+
+location /gym/ {
+ proxy_pass http://127.0.0.1:8080/; # trailing slash: the container sees /...
+ proxy_redirect / /gym/; # keeps the container's own redirects under /gym
+ proxy_http_version 1.1;
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ client_max_body_size 48m;
+ proxy_read_timeout 300s;
+}
+```
+
+```bash
+# .env
+BASE_PATH=
+RP_ID=example.com
+ORIGIN=https://example.com
+```
+
+Then `docker compose up -d` (a plain `restart` does not re-read `.env`). The three ways this
+goes wrong, so you can spot them:
+
+- **Stripping and `BASE_PATH=/gym` at the same time.** The page loads, so it looks fine, but
+ every `/api` call answers 404: no profile can be created and nothing signs in. One or the
+ other, never both.
+- **A path in `ORIGIN`.** `ORIGIN=https://example.com/gym` makes every passkey fail with
+ *Unexpected registration response origin*. An origin never has a path; the prefix lives in
+ `BASE_PATH` and in the proxy.
+- **`proxy_cookie_path / "/gym; Secure";`** Leave it out. Over https the session cookie is
+ called `__Host-gymsid`, and browsers throw away any `__Host-` cookie whose path isn't `/`. The
+ profile gets created, then the app insists you're not signed in. The cookie is already
+ `Secure`, `HttpOnly` and tied to its host without help.
+
### Photos and videos of custom exercises
Anyone signed in can give an exercise they made one photo, GIF or short video (and, separately,
@@ -878,6 +955,8 @@ browser (see section 2).
| No "Reminders" page in Settings | Requires a signed-in profile and HTTPS (or `localhost`) — guest mode and plain HTTP over LAN can't subscribe. |
| Day reminder fires at the wrong time | Toggle it off and on in Settings → Reminders so it re-detects your browser's timezone (also happens automatically on every app load — see section 7). |
| Notifications switch is off although I turned it on | The server no longer holds the subscription (rebuilt `data/db.json`, regenerated `vapid.json`); the app re-registers on the next start, or switch it on again. On iOS, push only works from the Home Screen icon. |
+| No Admin dashboard in Settings, so no AI Coach either | Nobody is admin yet. Put your **Settings → Account → Account ID** in `ADMIN_UIDS`, `docker compose up -d`, reload. See [§4](#4-multiple-users). |
+| Under a subpath: the page loads but no profile can be created, or you sign up and are "not signed in" | `BASE_PATH` doesn't match what the proxy does, or `proxy_cookie_path` rewrote the session cookie. See [nginx under /gym](#nginx-under-gym-both-ways). |
| Want to reset a stuck login | Delete the cookie in your browser; sessions are just signed cookies. |
| The app says "Your server no longer accepts this phone" (or "this browser") | The server answered 401. Usual causes: "sign out everywhere" was used, the account was disabled, `data/secret` was lost or replaced when the stack was moved (every session and pairing dies with it), or a proxy with its own login rejects requests that carry `Authorization: Bearer`. Nothing on the device is lost: pair the phone again (browser: Settings → "Pair the mobile app"), or sign in again in the browser, and what the device kept is merged into the account. |
| The app says the server "answered with something other than openGym (HTTP 200)" | Something other than the API answered `/api/*` with a success page — an auth proxy's sign-in page, or a catch-all route serving `index.html`. Every API answer is JSON; forward `/api/*` to the API unchanged. |
diff --git a/website/docs.html b/website/docs.html
index 1aec117bc..1f813648a 100644
--- a/website/docs.html
+++ b/website/docs.html
@@ -517,8 +517,11 @@ curl http://localhost:8080/api/health # {"ok":true,...}</code></pre>
<b>cannot</b> use <code>http://192.168.x.x:8080</code> — that's neither localhost nor
HTTPS, and the passkey prompt won't appear. To use openGym from your phone you need a
real HTTPS hostname (below). Until then, LAN devices can still use <b>guest mode</b>
- (data stays in that browser) or the <a href="#mobile-server">mobile app's pairing
- mode</a>.</p>
+ (data stays in that browser), <a href="#admin-signin">password sign-in</a>
+ (<code>PASSWORD_LOGIN=1</code>) or the <a href="#mobile-server">mobile app's pairing
+ mode</a>. No fingerprint reader on your laptop is a different story and needs none of
+ that: a passkey can sit on your phone (scan the browser's QR code), in a password manager
+ or on a security key.</p>
<h3 id="sh-https">HTTPS on your own domain</h3>
<p>Put anything that terminates TLS in front of the <code>web</code> container. Pick
@@ -529,6 +532,11 @@ curl http://localhost:8080/api/health # {"ok":true,...}</code></pre>
<li><b>Caddy</b> (automatic Let's Encrypt): <code>gym.example.com { reverse_proxy localhost:8080 }</code></li>
<li><b>Traefik / nginx / Nginx Proxy Manager:</b> route the HTTPS hostname to
<code>web:80</code> or <code>&lt;docker-host&gt;:8080</code>. Any proxy works.</li>
+ <li><b>Tailscale Serve</b> (no domain, nothing on the internet):
+ <code>tailscale serve --bg http://127.0.0.1:8080</code> gives the host a
+ <code>https://&lt;name&gt;.&lt;tailnet&gt;.ts.net</code> address with a real certificate;
+ use that name as <code>RP_ID</code>/<code>ORIGIN</code>. Phones need the Tailscale app.
+ Steps in <a href="https://github.com/DuarteSantos8/openGym/blob/main/docs/SELF_HOSTING.md#option-d--tailscale-serve-no-domain-nothing-on-the-internet" rel="noopener">SELF_HOSTING.md</a>.</li>
</ul>
<p>Then set the domain in <code>.env</code> and apply it:</p>
<pre><code># .env
@@ -585,6 +593,29 @@ docker compose up -d # restart alone does NOT re-read .env</code></pre>
<code>.env</code> settings — <code>WEB_PORT</code>, <code>NGINX_PORT</code>,
<code>BACKEND</code>, <code>PORT</code>. The web image renders its nginx config from
these <i>at container start</i>, so they work on a prebuilt image, no rebuild.</p>
+ <p>Under a <b>subpath</b> such as <code>https://example.com/gym/</code>, with nginx passing
+ the prefix through:</p>
+ <pre><code>location = /gym { return 301 /gym/; }
+location /gym/ {
+ proxy_pass http://127.0.0.1:8080; # no trailing slash
+ proxy_http_version 1.1;
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ client_max_body_size 48m;
+ proxy_read_timeout 300s;
+}
+
+# .env
+BASE_PATH=/gym
+RP_ID=example.com
+ORIGIN=https://example.com # no /gym here</code></pre>
+ <p>Prefer <code>proxy_pass http://127.0.0.1:8080/;</code> (trailing slash, prefix stripped)?
+ Then leave <code>BASE_PATH</code> empty and add <code>proxy_redirect / /gym/;</code>.
+ Stripping <i>and</i> setting <code>BASE_PATH</code> loads the page but 404s every API call.
+ And skip <code>proxy_cookie_path</code>: over https the session cookie is a
+ <code>__Host-</code> cookie, which browsers drop when its path isn't <code>/</code>, so you'd
+ sign up and still not be signed in. Both setups are in
+ <a href="https://github.com/DuarteSantos8/openGym/blob/main/docs/SELF_HOSTING.md#nginx-under-gym-both-ways" rel="noopener">SELF_HOSTING.md</a>.</p>
<h3 id="sh-update">Updating</h3>
<pre><code>git pull # picks up compose/config changes
@@ -611,7 +642,8 @@ docker compose up -d</code></pre>
<tr><td><code>BACKEND</code></td><td>Name of the API service <code>/api</code> is proxied to — change it if yours isn't called <code>api</code>.</td></tr>
<tr><td><code>PORT</code></td><td>Port the API listens on; the web container proxies to the same value. Default <code>3000</code>.</td></tr>
<tr><td><code>SESSION_DAYS</code></td><td>How long a sign-in lasts, in days. Default <code>90</code>.</td></tr>
- <tr><td><code>ADMIN_UIDS</code></td><td>Comma-separated user ids that get the <a href="#admin">admin dashboard</a>. Default: none — a fresh instance has no admin.</td></tr>
+ <tr><td><code>ADMIN_UIDS</code></td><td>Comma-separated user ids that get the <a href="#admin">admin dashboard</a> (your id: Settings → Account → Account ID). Default: none, so a fresh instance has no admin.</td></tr>
+ <tr><td><code>FIRST_USER_ADMIN</code></td><td>Set <code>1</code> and the first profile created on an instance with no profiles becomes its admin. Has no effect once profiles exist. Default: off.</td></tr>
<tr><td><code>INVITE_ONLY</code></td><td>Set <code>1</code> and new profiles need an invite code you generate from the dashboard. Existing accounts keep working. Default: off.</td></tr>
<tr><td><code>ALLOW_GUEST</code></td><td>Set <code>0</code> to remove <b>Continue without account</b>. Guest data isn't deleted — it stays in that browser and returns if you re-enable guests, or moves into a profile created on the same device. Default: on.</td></tr>
<tr><td><code>AUDIT_LOG</code></td><td>Record sign-ins and admin actions to the <a href="#admin-log">activity log</a> — set <code>0</code> to record nothing. Default: on.</td></tr>
@@ -621,7 +653,7 @@ docker compose up -d</code></pre>
<tr><td><code>PASSWORD_LOGIN</code></td><td>Set <code>1</code> to offer <a href="#admin-signin">name-and-password sign-in</a> next to passkeys. Default: off.</td></tr>
<tr><td><code>TRUST_PROXY</code></td><td>Let the sign-in throttle read the visitor's address from proxy headers. <code>1</code> in <code>docker-compose.yml</code>, where the web container is the only way to the API; leave it off if you run the API without it.</td></tr>
<tr><td><code>DEFAULT_LANG</code></td><td>Language of the sign-in screen and of new profiles, e.g. <code>de</code> or <code>pt-BR</code>. Default: the visitor's browser language.</td></tr>
- <tr><td><code>BASE_PATH</code></td><td>Serve openGym under a subpath such as <code>/gym</code>, no trailing slash. Default: the site root.</td></tr>
+ <tr><td><code>BASE_PATH</code></td><td>Serve openGym under a subpath such as <code>/gym</code>, no trailing slash, when your proxy passes that prefix through. A proxy that strips it needs this empty. Default: the site root. See <a href="#sh-stack">existing stack</a>.</td></tr>
<tr><td><code>MEDIA_UPLOADS</code></td><td>Set <code>0</code> to turn off photo and video uploads (custom-exercise pictures, workout photos); the link field stays. Default: on.</td></tr>
<tr><td><code>MEDIA_QUOTA_MB</code></td><td>Upload space per profile in MB; <code>0</code> for no cap. Default <code>200</code>. Lower it on an instance with open signup.</td></tr>
<tr><td><code>MEDIA_MIN_FREE_MB</code></td><td>Uploads are refused while the disk under <code>./data</code> has less free space than this. Default <code>512</code>. Size limits per file type are in <a href="https://github.com/DuarteSantos8/openGym/blob/main/docs/SELF_HOSTING.md#photos-and-videos-of-custom-exercises" rel="noopener">SELF_HOSTING.md</a>.</td></tr>
@@ -639,11 +671,17 @@ docker compose up -d</code></pre>
<h2 id="admin">Multiple users, admin &amp; the activity log</h2>
<p>Anyone who can reach the URL can create their own profile — each gets isolated data.
That's the default: open signup, no admin. To control who gets in:</p>
- <pre><code>ADMIN_UIDS=youruserid # your id is in ./data/db.json under users[].id
+ <pre><code>FIRST_USER_ADMIN=1 # the first profile on an empty instance becomes admin
+ADMIN_UIDS=youruserid # or name admins by id: Settings → Account → Account ID
INVITE_ONLY=1 # new profiles need an invite code
ALLOW_GUEST=0 # remove "Continue without account"</code></pre>
- <p>Register your own passkey profile <i>first</i>, then put your id in
- <code>ADMIN_UIDS</code>. You'll get an <b>Admin dashboard</b> link in Settings → Account: who's
+ <p>On a brand-new instance, set <code>FIRST_USER_ADMIN=1</code> before anyone signs up and
+ register your own profile first. Already registered? <code>FIRST_USER_ADMIN</code> only ever
+ applies to the very first profile, so copy your id from <b>Settings → Account → Account
+ ID</b> into <code>ADMIN_UIDS</code>, run <code>docker compose up -d</code> (a plain
+ <code>restart</code> keeps the old <code>.env</code>) and reload the app. You'll get an
+ <b>Admin dashboard</b> link in Settings → Account (it's also where the <a href="#coach">AI
+ Coach</a> is switched on): who's
training right now, each user's workout history and body weight, disabling an account
(signed out and locked out everywhere until re-enabled), and — with invite-only on —
generating and revoking invite codes. Admin access rides on your passkey and is enforced
@@ -732,7 +770,9 @@ ALLOW_GUEST=0 # remove "Continue without account"</code></pre>
<h3 id="coach-providers">Providers</h3>
<p>It is <b>off by default</b>. An admin turns it on in <b>Settings → Account → Admin dashboard</b>,
- on the <b>AI Coach</b> card, and picks who answers:</p>
+ on the <b>AI Coach</b> card, and picks who answers. No admin dashboard in your Settings?
+ Then nobody is admin yet, and that comes first: <a href="#admin">make yourself admin</a>.
+ There's no <code>.env</code> switch for the Coach itself.</p>
<table class="cfg">
<tr><td><b>Anthropic, OpenAI, Google&nbsp;Gemini</b></td><td>Paste an API key from the provider's console. Plain HTTPS from the api process — runs on the default image.</td></tr>
<tr><td><b>OpenAI-compatible endpoint</b></td><td>Any server that speaks the Chat Completions API: <b>Ollama</b>, <b>LM Studio</b>, <b>vLLM</b>, <b>OpenRouter</b>, a gateway of your own. A key only if the endpoint wants one. Also the default image.</td></tr>
@@ -1012,6 +1052,40 @@ Leg Day,Leg Press,2026-08-21,200,1</code></pre>
On Android the <a href="#android">signed APK</a> is the way in until then, and the same key
signs both, so moving to Play later keeps your data. The store apps are the same AGPL code,
with nothing collected and nothing to buy.</p>
+ <h3>How do I use it on my iPhone right now?</h3>
+ <p>As a web app: open your openGym address (it has to be <code>https://</code>) in
+ <b>Safari</b>, tap <b>Share → Add to Home Screen</b>, open the new icon and create your
+ profile; Face ID makes the passkey. It runs full screen, works offline and can send
+ notifications from there. The native App Store app is coming and can connect to the same
+ server, so nothing you log now is wasted. Just curious? The <a href="/demo/">demo</a> works
+ in Safari too.</p>
+ <h3>Passkeys don't work on plain http, or my laptop has no fingerprint reader.</h3>
+ <p>Browsers only do passkeys over HTTPS (and on <code>http://localhost</code>), so
+ <code>http://ip:port</code> never gets a passkey prompt, whatever you set. Put HTTPS in
+ front (<a href="#sh-https">see above</a>, Tailscale Serve included, or a LAN certificate via
+ <a href="https://github.com/DuarteSantos8/openGym/blob/main/docs/SELF_HOSTING_HTTPS.md" rel="noopener">SELF_HOSTING_HTTPS.md</a>).
+ A fingerprint reader is not required: any passkey works, from your phone via the browser's
+ QR code, a password manager, a security key or a Windows Hello PIN. Or switch on passwords
+ with <code>PASSWORD_LOGIN=1</code> in <code>.env</code> and <code>docker compose up -d</code>:
+ the sign-in screen then offers <b>Sign in with password</b> and new profiles can use one.</p>
+ <h3>The AI Coach doesn't show up on my server.</h3>
+ <p>Nothing in <code>.env</code> switches it on; an admin does, in the app. If Settings →
+ Account has no <b>Admin dashboard</b>, nobody is admin yet: copy <b>Settings → Account →
+ Account ID</b> into <code>ADMIN_UIDS</code>, <code>docker compose up -d</code>, reload.
+ Then <b>Admin dashboard → AI Coach → Set up the Coach</b>, connect a provider, test it, and
+ the Coach appears in the menu at the top right of <b>Plan</b>.
+ <a href="#coach-providers">More on providers</a>.</p>
+ <h3>How do I serve it under /gym with nginx?</h3>
+ <p>Either nginx passes <code>/gym/</code> through and <code>.env</code> has
+ <code>BASE_PATH=/gym</code>, or nginx strips it and <code>BASE_PATH</code> stays empty;
+ never both. <code>ORIGIN</code> has no path, and leave out <code>proxy_cookie_path</code>.
+ A working config is under <a href="#sh-stack">Fitting it into an existing stack</a>.</p>
+ <h3>Can I move my data from the phone app to my server?</h3>
+ <p>Yes. Easiest: pair the app with the server (<a href="#mobile-server">how</a>) and answer
+ <b>Add them</b> when it asks about this device's workouts. Or export a backup in the app
+ (<b>Settings → Data &amp; backup → Export backup</b>) and import it on the server, signed in,
+ under <b>Settings → Data &amp; backup → Import backup</b>; it asks before replacing anything
+ the server has that the file doesn't.</p>
<h3>Mobile app or self-hosted — which one should I pick?</h3>
<p>If you just want to track your training: the mobile app. If you want your data on your
own hardware, synced across devices, with profiles for the people you train with: