diff --git a/.env.example b/.env.example index 380e6a0..52e25b1 100644 --- a/.env.example +++ b/.env.example @@ -52,8 +52,27 @@ RP_NAME=openGym # # SESSION_DAYS=90 +# ── Fitting into an existing stack (optional) ────────────────────────────── +# The defaults assume openGym is on its own: an API service called `api` on +# port 3000, and nginx listening on 80 inside the web container. If you are +# merging this into a compose file that already has an `api`, or you front the +# web container with your own reverse proxy, move them here. The web image +# renders its nginx config at start-up, so these apply to a prebuilt image and +# need no rebuild. BACKEND and PORT together are what /api is proxied to, so +# they must name a service the web container can reach on your network: +# +# NGINX_PORT=80 +# BACKEND=api +# PORT=3000 + # ── Notifications (optional) ─────────────────────────────────────────────── # Push works out of the box — nothing to set. VAPID keys are generated on first # run and saved to ./data/vapid.json. Each user's browser reports its own # timezone automatically, so the workout-day reminder fires at their local # time regardless of where the server runs or where they're travelling. +# +# Push services want a contact address for whoever operates the server, in case +# they need to get in touch about your pushes. Defaults to your ORIGIN, which is +# fine; set a mailto: if you would rather they mailed you: +# +# VAPID_SUBJECT=mailto:you@example.com diff --git a/CHANGELOG.md b/CHANGELOG.md index 76d8c71..b1417a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,71 @@ # Changelog +## v1.2.7 — 2026-08-18 + +The muscle map answers a third question. Balance showed where the volume went and Fatigue what was +still recovering; Strength now names the exercises behind a muscle and what each one is worth in +estimated 1RM. Fatigue itself got harder to fool — a set counts for more the closer it is to your +maximum, and it can no longer creep upward across a rest week. In a session, supersets finally +behave: pair them as you go, rest once per round, and drop an exercise you have decided against. + +### The muscle map, read as strength + +- **A per-muscle exercise breakdown** behind the muscle card — estimated 1RM per exercise, decay + bars, and primary/secondary tags, with a best-weight fallback for holds and carries that have no + reps to work from. Contributed by [@Space-Hermes](https://github.com/Space-Hermes) in + [#92](https://github.com/DuarteSantos8/openGym/pull/92), + [#93](https://github.com/DuarteSantos8/openGym/pull/93) and + [#94](https://github.com/DuarteSantos8/openGym/pull/94). +- **Fatigue is now intensity-weighted**, not volume alone: a set counts for more the closer it is + to your estimated maximum. It also reads against a stable historical reference, so fatigue can no + longer *rise* across a rest week, and bodyweight movements no longer register as zero load. A + property probe over 108,000 comparisons runs in CI to keep it that way. Contributed by + [@Space-Hermes](https://github.com/Space-Hermes) in + [#55](https://github.com/DuarteSantos8/openGym/pull/55). + +### In a session + +- 🔗 **Supersets advance properly.** Completing a set moves to the next member of the group, the + active exercise scrolls into view, and rest starts once the whole round is done rather than after + each set. Contributed by [@Space-Hermes](https://github.com/Space-Hermes) in + [#80](https://github.com/DuarteSantos8/openGym/pull/80). +- ➖ **Remove an exercise from a running session**, with a superset-aware picker and a confirmation. + Contributed by [@Space-Hermes](https://github.com/Space-Hermes) in + [#83](https://github.com/DuarteSantos8/openGym/pull/83). +- ⬅️ **The Android back button closes the open sheet** instead of leaving the screen or the app + ([#63]). Each open sheet gets its own history entry, so stacked sheets unwind one at a time. + Contributed by [@Space-Hermes](https://github.com/Space-Hermes) in + [#85](https://github.com/DuarteSantos8/openGym/pull/85). + +### Self-hosting + +- 🐳 **The API service no longer has to be called `api`** ([#99]). The web image builds its nginx + config at startup from `BACKEND`, `PORT` and `NGINX_PORT`, all defaulted to today's values, so + existing compose files are unaffected. Reported and fixed by + [@GAS85](https://github.com/GAS85) in [#100](https://github.com/DuarteSantos8/openGym/pull/100). +- **…and the shipped `docker-compose.yml` now actually passes those through.** The `web` service + had no environment of its own and published a hardcoded `:80`, so setting `BACKEND` or + `NGINX_PORT` in `.env` did nothing at all on the stock stack — the setting existed, the wiring + did not. Both services now read `PORT` from the same place, so nginx cannot end up proxying to a + port the API is not listening on. Defaults are unchanged, so an existing `.env` behaves exactly + as before. +- 🏷️ **Health checks and OCI image labels** on both images — source, licence, version, revision and + build date, so image tooling can tell what it is holding. Contributed by + [@GAS85](https://github.com/GAS85) in [#98](https://github.com/DuarteSantos8/openGym/pull/98). +- **Images are published from a release, not from any tag** ([#87]). A tag that gets consolidated + away before it becomes a release used to leave its image tags behind in the registry, where + dependency bots read them as newer versions. + +### Fixes + +- **Imported warm-up sets were counted as work.** The importer marks them with `phase`, but several + places still read the older boolean, so warm-ups from FitNotes/Strong/Hevy history inflated set + counts, progression and the fatigue map. + +[#63]: https://github.com/DuarteSantos8/openGym/issues/63 +[#87]: https://github.com/DuarteSantos8/openGym/issues/87 +[#99]: https://github.com/DuarteSantos8/openGym/issues/99 + ## v1.2.6 — 2026-08-11 The muscle map learned to answer a second question — not just where the volume went, but what is diff --git a/README.md b/README.md index 7afbf24..b4d8d22 100644 --- a/README.md +++ b/README.md @@ -61,21 +61,24 @@ as a home-screen app, passkey sign-in, offline support, sync across your phone a - 🗓️ **Reschedule any day** — sick, missed a session, or fewer gym days this week? Move a workout to another day without touching your weekly plan - ▶️ **Guided workouts** — it knows what day it is and starts today's session; asks your body weight first, pre-fills your weights from last time, rest timer, PR detection, per-exercise weight tracking - ☀️ **The screen stays awake while you train** — no unlocking the phone and finding your place again between every set. On for as long as a workout is running, released the moment you finish it, and switchable off in Settings -- 🔗 **Supersets** — build them, and log them back-to-back with a rest only after the pair +- 🔗 **Supersets** — plan them into a routine or pair two exercises *mid-session* with “make superset with previous/next”, then work through the group back-to-back with a single rest at the end of each round. Unpair at any time; a group of one dissolves itself +- 🔥 **Warm-up sets** — mark the ramp-up rows as warm-ups and they stay out of the numbers that should not see them: no effect on your estimated 1RM, your progression, or the fatigue map, while still being there in the session where you need them. A weight change cascades down the rows that share their phase, not across the divide +- ➖ **Change your mind mid-session** — add an exercise you decided to do, or remove one you didn't, without ending the workout. Removing a member of a superset asks which one - ⏱️ **Timed exercises** — planks, hangs, wall sits and loaded carries are logged by time, not reps, with a work timer that counts the set itself (separate from the rest timer) and logs the time you actually held. They can carry weight too - 📈 **Progression that follows a rule** — pick one per routine, override it per exercise: linear, **Greyskull LP** (AMRAP top set, double jumps, 10 % resets), double progression through a rep range, or adding time. Your weights are already right when the session opens, and every target says *why* it's that number. Missed reps never advance the load, stalls trigger a deload, and bodyweight exercises progress in reps instead - 💪 **Estimated 1RM** — per exercise, from your best eligible set (it names which one), with its own progress curve and a calculator for sets you haven't done. Won't guess above 12 reps - 🎯 **Effort per set, in your scale** — an optional third column rating how hard a set was, as **RIR** (reps left in the tank) or **RPE** (the same judgement on a 10-point scale). Off by default; each set keeps the scale it was logged with, and nothing else reads the value — your progression and 1RM are unaffected - 💪 **Bodyweight exercises, logged as bodyweight** — push-ups, pull-ups, dips and 300-odd others arrive knowing they carry no load, so there's no weight column and no working-weight prompt: one stepper, log the reps. Add a dip belt and it reads as an addition, and progression goes back to following the weight. Without one, reps climb — and past a ceiling you set, a set is added instead of a rep, up to the point where the honest advice is load or a harder variation - ↔️ **Reps per side** — for lunges, single-arm rows and the rest. You log the total, the app shows the split ("8 per side"), and the target steps in twos so it never lands on a number one side can't have +- 🎲 **Freestyle sessions** — train without a plan and pick exercises as you go. Each one arrives prefilled from the last time you did it — same sets, same reps and weight by position — so an unplanned session doesn't start by asking you to retype last week - 🏃 **Cardio** — log time + speed, not just weight × reps - 📤 **Share a plan** — send someone your routines and week schedule as a small file (no workouts, no weigh-ins), or print it as a clean PDF. Importing merges, so their plan is never overwritten - 🔧 **Filter by equipment** — narrow the library to what you actually own; the options adapt to what you've picked, so every combination on screen has results behind it - ✨ **Your own exercises** — a name and a body part is enough; they behave like built-in ones everywhere, with an optional description instead of an animation - 🟩 **Activity heatmap** — a GitHub-style year view, shaded by time spent training -- 💪 **Muscle map** — a front-and-back body diagram shaded by how much work each muscle got, over a week, a month or all time. It names the muscles you *haven't* trained in that period, previews what a routine hits while you build it, and shows what you just trained when you finish. Male or female figure, your pick +- 💪 **Muscle map, three ways** — a front-and-back body diagram you can read as **Balance** (where the volume went, over a week, a month or all time — naming the muscles you *haven't* trained), **Fatigue** (what is still recovering, weighted by how close each set was to your maximum, decaying smoothly rather than expiring at a window edge) or **Strength** (how long since you trained each muscle, and behind every one the exercises that built it with their estimated 1RM). It previews what a routine hits while you build it, and shows what you just trained when you finish. Male or female figure, your pick - 🔔 **Push notifications** — rest-timer alerts even with the app closed, plus an optional reminder on days you have a workout planned but haven't logged one. Opt in per profile; keys are generated on first run, nothing to configure -- 🔑 **Passkeys, not passwords** — Face ID / Touch ID / fingerprint login; each profile keeps its own data, synced across devices +- 🔑 **Passkeys, not passwords** — Face ID / Touch ID / fingerprint login; each profile keeps its own data, synced across devices. Sign-ins last 90 days by default (configurable), and “sign out everywhere” in Settings ends every session on every device at once - 🛠️ **Admin dashboard** (optional) — for whoever runs the instance: who's training right now, per-user history, disable accounts, and invite-only signup. Off by default, so a fresh instance stays open with no admin - 🎨 **Designed, not assembled** — light/dark themes and 8 accent colors saved to your profile, over a hand-drawn icon set instead of emoji, so it looks the same on every phone - 🌍 **12 languages** — full UI translation (EN, DE, ES, FR, IT, PT, PL, TR, RU, ZH, KO, HI); exercise instructions localized in 10 of them, loaded on demand so the app stays fast @@ -133,7 +136,7 @@ mobile app is the install-and-done flavor. ``` - **frontend/** — React + Vite (React Router + Zustand), built to static files **inside Docker** -- **api/** — Node with no framework, one dependency (`@simplewebauthn/server`), storing everything as plain JSON files under `./data` +- **api/** — Node with no framework, two dependencies (`@simplewebauthn/server` for passkeys, `web-push` for notifications), storing everything as plain JSON files under `./data` - **web/** — a multi-stage image that builds the frontend and serves it with nginx, proxying `/api` to the backend so it's all on **one origin** (passkeys require this) ## Your data @@ -152,15 +155,19 @@ All via `.env` (see `.env.example`): | `RP_ID` | Hostname passkeys are bound to | `localhost` | | `ORIGIN` | Full URL the app is served from | `http://localhost:8080` | | `WEB_PORT` | Host port for the web UI | `8080` | -| `NGINX_PORT` | Internal Nginx port for the web UI | `80` | -| `BACKEND` | Backend Service service name, so that API calls can be forwarded to | `api` | -| `PORT` | Port for the api backend Service | `3000` | +| `NGINX_PORT` | Port the web container listens on, inside the container | `80` | +| `BACKEND` | Name of the API service that `/api` is proxied to — change it if yours isn't called `api` | `api` | +| `PORT` | Port the API listens on; the web container proxies to the same value | `3000` | | `RP_NAME` | Name shown in the passkey prompt | `openGym` | +| `SESSION_DAYS`| How long a sign-in lasts, in days | `90` | | `ADMIN_UIDS` | User ids that get the admin dashboard (comma-separated) | *(none)* | | `INVITE_ONLY` | Require an invite code to create a profile | *(off)* | | `ALLOW_GUEST` | Offer "Continue without account" — set `0` to require a profile | *(on)* | +| `VAPID_SUBJECT` | Contact URL sent with push notifications | your `ORIGIN` | Push notification keys are generated on first run and saved to `./data/vapid.json` — nothing to set. +`DATA_DIR` is pinned to `/data` by `docker-compose.yml` and mapped to `./data` on the host; change the +host side of that volume, not the variable. ## Roadmap diff --git a/api/package.json b/api/package.json index 5e700b3..d8e2ad6 100644 --- a/api/package.json +++ b/api/package.json @@ -1,6 +1,6 @@ { "name": "gym-api", - "version": "1.2.6", + "version": "1.2.7", "private": true, "type": "module", "main": "server.js", diff --git a/assets/screenshots/home.png b/assets/screenshots/home.png index 0656c6d..3f58e79 100644 Binary files a/assets/screenshots/home.png and b/assets/screenshots/home.png differ diff --git a/assets/screenshots/library.png b/assets/screenshots/library.png index ca2e427..48cf561 100644 Binary files a/assets/screenshots/library.png and b/assets/screenshots/library.png differ diff --git a/assets/screenshots/plan.png b/assets/screenshots/plan.png index 5976b86..f2111b3 100644 Binary files a/assets/screenshots/plan.png and b/assets/screenshots/plan.png differ diff --git a/assets/screenshots/stats.png b/assets/screenshots/stats.png index e11c02f..e7ce1f4 100644 Binary files a/assets/screenshots/stats.png and b/assets/screenshots/stats.png differ diff --git a/assets/screenshots/workout.png b/assets/screenshots/workout.png index 9d45e80..cce8482 100644 Binary files a/assets/screenshots/workout.png and b/assets/screenshots/workout.png differ diff --git a/docker-compose.yml b/docker-compose.yml index 7f31bb0..b755f87 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,7 +36,9 @@ services: restart: unless-stopped env_file: .env environment: - - PORT=3000 # internal port (nginx proxies here) — do not change + # The port the API listens on. web proxies to this same value, so the two + # cannot drift — change it in .env and both follow. + - PORT=${PORT:-3000} - DATA_DIR=/data volumes: - ./data:/data # users, passkeys, per-user state, session secret — BACK THIS UP @@ -59,7 +61,14 @@ services: api: condition: service_started ports: - - "${WEB_PORT:-8080}:80" + - "${WEB_PORT:-8080}:${NGINX_PORT:-80}" + # nginx renders its config at start-up from these (web/nginx.conf.template), + # so the API service does not have to be called `api`. Defaults are the old + # hardcoded values, so an existing .env and an existing stack are unaffected. + environment: + - NGINX_PORT=${NGINX_PORT:-80} + - BACKEND=${BACKEND:-api} + - PORT=${PORT:-3000} volumes: - ./media/img:/usr/share/nginx/html/img:ro - ./media/gif:/usr/share/nginx/html/gif:ro diff --git a/docs/SELF_HOSTING.md b/docs/SELF_HOSTING.md index 71498f2..068073c 100644 --- a/docs/SELF_HOSTING.md +++ b/docs/SELF_HOSTING.md @@ -8,14 +8,14 @@ This guide takes you from "just cloned it" to "using it from my phone over the i Requirements: [Docker](https://docs.docker.com/get-docker/) with the Compose plugin. ```bash -git clone https://github.com/DuarteSantos8/gym-app opengym -cd opengym +git clone https://github.com/DuarteSantos8/openGym +cd openGym cp .env.example .env docker compose pull # prebuilt images from ghcr.io (amd64 + arm64) — or skip and build from source docker compose up -d ``` -- First start downloads the exercise images/GIFs (~140 MB) once into `app/img` and `app/gif`. +- First start downloads the exercise images/GIFs (~140 MB) once into `media/img` and `media/gif`. - Open **http://localhost:8080** and create a profile with a passkey. - Rather build from source than pull prebuilt images? Skip `docker compose pull` and run `docker compose up -d --build` instead — no Node needed locally either way. @@ -118,7 +118,30 @@ same device. Prefer to keep the whole thing off the open internet? A VPN or an auth proxy (Authelia, Cloudflare Access…) in front still works, and composes with the above. -## 5. Backups +## 5. Fitting it into an existing stack + +The defaults assume openGym is the only thing here: a service called `api` on port 3000, and nginx +on port 80 inside its container. If you are merging this into a compose file that already has an +`api`, or you put the web container behind your own reverse proxy on a different port, four +settings in `.env` move those without editing any config file: + +```bash +WEB_PORT=8080 # host port — what you browse to +NGINX_PORT=80 # port the web container listens on, inside the container +BACKEND=api # name of the API service that /api is proxied to +PORT=3000 # port the API listens on; web proxies to the same value +SESSION_DAYS=90 # how long a sign-in lasts +``` + +The web image renders its nginx config from these when the container starts, so they take effect +on a **prebuilt image** — no rebuild. `BACKEND` and `PORT` together are what `/api` is proxied to, +so they have to name a service the web container can actually reach on your compose network. + +Note the difference from `VITE_IMG_BASE` / `VITE_GIF_BASE` (see Troubleshooting): those are +build-time values baked into the frontend bundle, and setting them next to `docker compose` does +nothing to an image you pulled. + +## 6. Backups Everything is in `./data`: @@ -136,7 +159,7 @@ end up in every backup you are told to make — an archive like this gets copied cloud drives, and a refresh token keeps working wherever it lands. Nothing in `./coach-auth` needs backing up: if you lose it, sign the provider in again. -## 6. Notifications +## 7. Notifications openGym can push two kinds of alert to your phone/desktop, even when the app isn't open: rest-timer-over, and a reminder on days you have a workout planned but haven't logged one yet. @@ -153,7 +176,11 @@ Wake Lock API is only available over HTTPS or on `http://localhost`, so on a pla instance the switch shows as unsupported. Nothing to configure server-side either way, and iOS refuses the lock while the phone is in Low Power Mode. -## 7. Updating +Push services like a contact address for whoever runs the server, in case they ever need to reach +you about your pushes. openGym sends your `ORIGIN` by default; set `VAPID_SUBJECT=mailto:you@example.com` +in `.env` if you would rather they had an inbox. + +## 8. Updating Running prebuilt images: @@ -182,7 +209,7 @@ downloaded media are untouched. | Media didn't download | `docker compose logs media`. Re-run `docker compose up -d`, or run `./scripts/fetch-media.sh`. | | Port 8080 already used | Set `WEB_PORT=9090` in `.env` (and update `ORIGIN` for local testing). | | No "Notifications" option 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 so it re-detects your browser's timezone (also happens automatically on every app load — see section 6). | +| Day reminder fires at the wrong time | Toggle it off and on in Settings so it re-detects your browser's timezone (also happens automatically on every app load — see section 7). | | Want to reset a stuck login | Delete the cookie in your browser; sessions are just signed cookies. | | `docker compose pull` fails with "denied" / "unauthorized" | The prebuilt images aren't published yet, or need to be, or the GHCR package is still private — build from source instead (`docker compose up -d --build`). | | Exercise images/GIFs blank when a routine is open | Fixed in current images (issue #79). On an older build, see the note below. | diff --git a/frontend/android/app/build.gradle b/frontend/android/app/build.gradle index 2ac4cc1..3e7e59c 100644 --- a/frontend/android/app/build.gradle +++ b/frontend/android/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "ch.duartesantos.opengym" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 7 - versionName "1.2.6" + versionCode 8 + versionName "1.2.7" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. diff --git a/frontend/package.json b/frontend/package.json index 42aa3f9..836339b 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,7 @@ { "name": "opengym-frontend", "private": true, - "version": "1.2.6", + "version": "1.2.7", "type": "module", "scripts": { "dev": "vite", diff --git a/website/about.html b/website/about.html index fb1dae2..63f4b31 100644 --- a/website/about.html +++ b/website/about.html @@ -48,8 +48,10 @@

Then friends wanted in. That brought passkey profiles — sign in with your fingerprint, no passwords, everyone's data separate — and sync, so the log survives any phone. Somewhere along the way the little page got rewritten into a proper React app, learned - 12 languages, grew a muscle map, importers for FitNotes, Strong, Hevy and Apple Health, - and finally became a native Android app you can install from this site.

+ 12 languages, grew a muscle map that reads three ways — where the volume went, what is + still recovering, and what each muscle is actually strong at — plus importers for + FitNotes, Strong, Hevy and Apple Health, and finally became a native Android app you can + install from this site.

In July 2026 I open-sourced the whole thing under the AGPL. The license is the point, not a footnote: your training data should be yours, the software that holds it diff --git a/website/docs.html b/website/docs.html index 5250834..4cadfdd 100644 --- a/website/docs.html +++ b/website/docs.html @@ -39,6 +39,7 @@ Android iPhone Self-hosting + Ask an AI Import your history Backups Build it yourself @@ -90,6 +91,28 @@ docker compose up -d examples and the invite-only/admin options, is in docs/SELF_HOSTING.md. +

Settings worth knowing about

+

All of these live in .env; the defaults are what you get if you touch nothing.

+ + + + + + + + +
RP_ID / ORIGINThe domain passkeys are bound to, and the full URL you serve from. The two must agree, or sign-in fails.
WEB_PORTHost port for the web UI. Default 8080.
INVITE_ONLYSet 1 and new profiles need an invite code you generate.
ALLOW_GUESTSet 0 to remove Continue without account, so everyone using the instance has a profile.
ADMIN_UIDSWhich user ids get the admin dashboard.
SESSION_DAYSHow long a sign-in lasts. Default 90.
BACKEND / PORT / NGINX_PORTFor fitting openGym into a stack that already has an api service, or putting it behind your own proxy on another port. The web container renders its nginx config at start-up, so these work on a prebuilt image.
+ +

Ask an AI about your training

+

openGym ships an optional MCP server: a small read-only bridge that lets a client + like Claude Desktop or Cursor answer questions from your actual log — "what did I bench + last week?", "which muscle have I not trained this month?", "what's my + estimated 1RM on squats?"

+

It runs on your machine, is spawned by the client, and reads your exported data directly. + Nothing is sent anywhere, and it is not part of the Docker build — if you don't use + an AI assistant, it simply isn't there. Setup is a few lines of client config: + mcp/README.md.

+

Import your training history

Coming from another tracker? Settings → Data → Import from another app reads: