Skip to content

About

Science-constrained workout API. Rules pick the sets and loads.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

SolveForge

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.

What it returns

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.

Run it

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 8000

On 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 --build

The API listens on port 8000. The optional Streamlit client listens on port 8501.

Configure

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.

Test

pytest tests/test_unit_phase1.py tests/test_honesty.py tests/test_plan_quality.py -q

Layout

src/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

License

MIT. See LICENSE.

About

Science-constrained workout API. Rules pick the sets and loads.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages