IntelliWatts is a personal cycling coach that parses your training data from intervals.icu and generates a weekly training plan for you using an LLM of your choice.
It is customizable in terms of:
- Training goals
- Weekly training volume
- Readiness & Recovery (HRV, Resting HR, Wellness)
- Available measurements
- HR measurements
- Power measurements
Current supported LLMs:
- OpenAI ChatGPT (requires subscription!)
- Google Gemini (free tier available!)
https://intelliwatts.onrender.com
https://intelliwatts.onrender.com/health
Important
The app is currently limited to personal usage as it uses the athlete ID and personal API-Token to parse intervals.icu.
API Tokens are used to authenticate with the respective APIs (Intervals.icu, OpenAI, Google Gemini). For local development, they are stored in the .env file which must not be shared publicly. For all required keys, checkout the env.example file.
End users can manage their API keys via the Secrets page after login.
Authentication to intervals.icu is required to parse past workouts.
Go to https://intervals.icu/settings Settings -> Dev --> API-Key and set INTERVALS_API_KEY and INTERVALS_ATHLETE_ID in ./env.
The API key for the language model selected must be set correctly either via .env or via the Secrets page after login. The default model is Gemini Flash which provides free usage.
- Open https://platform.openai.com/api-keys
Create new secret key- Set
OPENAI_API_KEYin.envto your key
- Open https://aistudio.google.com/api-keys
- Click "Create API Key"
- Set
GEMINI_API_KEYin.envto your key.
- Set up the environment: Run
./setup.shin the project root to install dependencies and build static assets (including Tailwind CSS themes). - Start the development server: Run
uvicorn app.main:app --reload. - Access the application: Open a web browser and navigate to the exposed link, e.g.
http://localhost:8000/. - Generate a plan: Interact with the UI to generate training plans.
- Run
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000to start the FastAPI server. - Call
curl -X POST http://localhost:8000/api/generate-planto retrieve the request.
- Run
python app/main.pyto generate the training plan.
To set up the local DevEnv, run the setup.sh script in your project's root directory:
./setup.shThis script will:
- Create and activate a Python virtual environment.
- Install Python dependencies using
uv. - Install pre-commit hooks.
The settings for the app are defined in app/config.py. There are three types of settings:
- Settings that can be updated via the App interface (e.g.,
SYSTEM_PROMPT,USER_PROMPT,weekly_hours,weekly_sessions). - Settings that are managed via
.env, Env variables or the Secrets page (e.g.,INTERVALS_API_KEY,INTERVALS_ATHLETE_ID,OPENAI_API_KEY,GEMINI_API_KEY). - Settings that are hardcoded and cannot be changed (e.g.,
CACHE_INTERVALS_HOURS).
This application uses SQLModel (built on SQLAlchemy) for database interactions. To manage the evolution of our database schema safely, we use Alembic.
As the application grows, we frequently add new features that require database changes (e.g., Task 6 added persistent user training preferences). Managing these changes manually is error-prone and can lead to data loss or inconsistent environments.
Alembic provides:
- Version Control for Data: Every schema change is captured in a migration script, allowing us to track how and when the database evolved.
- Safety: We can "upgrade" to the latest schema or "downgrade" if a change causes issues, without manually writing risky SQL
ALTER TABLEstatements. - Consistency: Ensures that all environments (Local Dev, CI/CD, Production) are running exactly the same database structure.
- Auto-generation: Alembic can automatically detect changes in our
SQLModelclasses and generate the necessary migration code for us.
When you pull new changes, you should always sync your local database with the latest schema:
uv run alembic upgrade headFor developers creating new models or modifying existing ones:
- Update your
SQLModelinapp/models/. - Generate a new migration script:
uv run alembic revision --autogenerate -m "describe_your_change". - Review the generated script in
migrations/versions/. - Apply the change:
uv run alembic upgrade head.
This application uses Tailwind CSS for its styling, processed via PostCSS.
To generate the static css files, execute the build_tailwind.sh script. This script will build Tailwind CSS assets for all available themes, generating app/static/tailwind-<theme>.css
Currently available themes are:
- Retro90s (Default): A nostalgic, terminal-inspired look with a dark background, neon pink text, and light blue accents.
- Minimalistic: A clean, accessible design with a light background and subtle colors.
The themes are defined in app/static/style-<theme>.css.
Switching themes is managed entirely on the client-side via a dropdown menu.