Repository navigation
Architecture
Simone Di Mambro edited this page Oct 8, 2026
·
4 revisions
iPhone (Wellness Booking) ──HTTPS/Bearer──▶ wellness-gateway (Unraid container) ──HTTPS──▶ mywellness API
▲ │
└────────────── APNs push ◀──────────────┘
- Users are local gateway accounts (Simone, Daniela, Sofia…). Each login from a device issues a long-lived bearer token stored in the iPhone Keychain.
- Profiles are mywellness accounts. Each user sees their own profile only; administrators see every profile (the family) and can act on any of them. Only the gateway talks to Technogym; the phone never holds mywellness credentials.
-
Engine loop (one goroutine): every tick it evaluates all tracked items:
pending→ atfireAt − leadbecomesbursting(Book every 1.5 s forburstSeconds) →booked, orwaitingList/watchingwhen full → reads the day's public schedule (no token; one request per club and day shared by every profile and class) everypollSeconds(default 15 s) and everynearPollSeconds(default 3 s) in the lastnearHourshours (default 4), ±15% jitter, plus one authenticated read per class every 60 s for participation and waiting-list position; it books the moment a place shows up (availablePlaces > 0, participants < max, orbookingUserStatus = CanBook), retrying 3 times 0.7 s apart. Items expire 5 minutes before the class starts. -
Calendar refresh every 10 minutes per profile (authenticated, so
isParticipantis known): updates places, marks items booked/cancelled from outside, attaches weekly recurrences, recounts active bookings. - Push fan-out to every device of the users who can see the profile; bad tokens are dropped automatically.
-
State is a single
state.jsonwritten atomically; mywellness passwords are AES-256-GCM encrypted with a key insecret.key(orWG_SECRET_KEY).
wellness-gateway