Skip to content

Fitness

Fitness records metric workouts, reusable routines, weekly plans, body measurements, weight goals, and reminders. Nutrition stays in Grocery. The web app is at /fitness; the gateway exposes the API at /api/v1/fitness and OpenAPI at /api/v1/fitness/openapi.json.

Run make setup, make lint, and .venv/bin/python -m pytest tests -v. Tests start an isolated PostgreSQL 17 container and stub notification delivery.

Running

Use the platform Compose stack. Enable the workers profile for the Fitness reminder worker. Notifications also needs its worker running to deliver created notifications to the inbox. LORYTH_NOTIFICATIONS_URL defaults to http://loryth-notifications-api:8000. Each reminder runs at most once per local day; notification idempotency keys also cover a crash after the HTTP request succeeds but before the database transaction commits. Failed requests leave the reminder eligible for the next minute.

For an existing PostgreSQL volume, create the fitness role and database with the configured DB_PASSWORD_FITNESS and install uuid-ossp as a database administrator before running the migrations. Initialization scripts only run for a fresh volume.

API details

All resource references are public UUIDs. Supply user_id in query parameters for reads and deletes, and in the JSON body for writes. The repeat-set endpoint is the exception: POST /workouts/{uuid}/exercises/{child_uuid}/sets?user_id=… takes {} to repeat the previous values while resetting completed to false. Date range ends are exclusive; timestamps must include an offset. Day and week views accept an IANA tz. Reminder weekdays are a bitmask with Monday in bit 0.

DELETE archives exercises and routines. Archiving a routine removes its future plan sessions and preserves workout history. The event consumer is configured but remains inactive until an outbox bridge exists, so completion events stay in the event log.

First visit

Today offers Start a workout, Build a routine, and Log your weight. The exercise library contains 24 built-ins: Barbell squat, Bench press, Deadlift, Overhead press, Barbell row, Dumbbell row, Dumbbell curl, Lateral raise, Lat pulldown, Leg press, Romanian deadlift, Lunge, Push-up, Pull-up, Dip, Crunch, Plank, Side plank, Run, Walk, Cycle, Row, Hip stretch, and Yoga.