A science-constrained workout API. A profile goes in. A multi-week program comes back. The numbers come from rules: set ranges, equipment, injuries, and the last logged set. A research note explains the week. It does not pick the sets or the loads.
Docs are served by the API at /docs/introduction.
| Endpoint | Result |
|---|---|
POST /generate_program |
A 4, 8, or 12 week program for muscle, strength, endurance, or fat loss |
POST /generate_workout |
Week 1 of that program |
GET /profile/questions |
Only the questions that change the week for a goal |
POST /profile/constraints |
Injury sentences checked against the exercise catalog |
POST /me/sessions |
A logged set, used the next time a program is built |
POST /nutrition/targets |
A daily protein range and a calorie direction |
Each program includes weekly set counts, a deload on weeks 4, 8, and 12, and a progression chart. A short week is labeled partial. Sport is optional and only edits the gym week. Nutrition is targets only: no meal plan, no supplements, and no medical diet.
This is not medical advice.
Python 3.10 or newer.
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
copy .env.example .env.local
uvicorn src.api.main:app --host 127.0.0.1 --port 8000On macOS or Linux, activate with source .venv/bin/activate and copy the env file with cp .env.example .env.local.
Open http://127.0.0.1:8000/docs/introduction.
MongoDB is optional for local use. Without it, the docs and the generator still run, and session logs stay in memory for that process. Production expects MongoDB and a JWT_SECRET of at least 32 characters.
docker compose up --buildThe API listens on port 8000. The optional Streamlit client listens on port 8501.
Copy .env.example to .env.local. Leave a key blank if you do not use that feature.
| Variable | Used for |
|---|---|
JWT_SECRET |
Signing access tokens. Required in production. |
ADMIN_EMAIL, ADMIN_PASSWORD |
Operator login for the docs |
MONGODB_URI, MONGODB_DB |
Stored programs, profiles, and session logs |
OPENROUTER_API_KEY |
Swap checks, and leftover injury sentences the phrase table cannot map |
TAVILY_API_KEY |
Source search for the research note and swap checks |
Generating a program does not require the research keys. If those services are down, the week still returns with a short template note.
pytest tests/test_unit_phase1.py tests/test_honesty.py tests/test_plan_quality.py -qsrc/api HTTP API and docs
src/generator Split, exercise choice, volume, sport, and loads
src/nutrition Protein and calorie targets
config Exercise catalog and goal prescriptions
tests Generator and plan checks
MIT. See LICENSE.