"iform" (Norwegian for "in shape") is a web application designed to provide personalized training insights. It connects to your Strava account, fetches your recent activities, and uses an AI-powered coach to analyze your performance and offer actionable suggestions for improvement.
This project was initially created as a demonstration of the Gemini CLI's capabilities and has evolved into a functional tool for personal training analysis.
- Strava Integration: Securely connect your Strava account to fetch your last six months of activity data.
- AI-Powered Analysis: Utilizes a generative AI model to act as a personal running coach, providing:
- A summary of your recent training period.
- Concrete, actionable suggestions for improvement.
- A trend analysis chart visualizing your average pace and total distance over the last six months.
- Special Considerations Input: Provide additional context (e.g., injuries, upcoming events) to the AI for more tailored and safe training suggestions.
- Multi-language Support: The user interface is available in English, Norwegian, and Spanish.
- Light & Dark Mode: Switch between light and dark themes for your viewing preference.
The application consists of a simple frontend and a Node.js backend.
- Frontend: A static web page built with HTML, CSS, and vanilla JavaScript. It handles user interaction, displays data, and renders a trend chart using Chart.js.
- Backend: An Express.js server that manages:
- Strava OAuth authentication.
- Fetching activities from the Strava API.
- Interacting with a generative AI model to analyze the activity data.
- Serving language translations.
To run this project locally, you will need to have Node.js installed.
-
Clone the repository:
git clone https://github.com/torfinnnome/iform.git cd iform -
Install backend dependencies:
cd backend npm install -
Configure environment variables:
Create a
.envfile in thebackenddirectory and add the following, replacing the placeholder values with your actual credentials:STRAVA_CLIENT_ID=your_strava_client_id STRAVA_CLIENT_SECRET=your_strava_client_secret GOOGLE_API_KEY=your_google_api_key REDIRECT_URI=http://localhost:3000/api/strava/callback GEMINI_MODEL=gemini-2.0-flash SESSION_SECRET=your_very_secret_session_keyGenerating a secure
SESSION_SECRET: For production environments, it is crucial to use a strong, randomly generated string forSESSION_SECRET. You can generate one usingopenssl:openssl rand -base64 32
Replace
your_very_secret_session_keywith the output of this command. -
Start the server:
node server.js
-
Open the application:
Open your web browser and navigate to
http://localhost:3000.
Future plans for iform include:
- Interactive Chat: A chat interface to interact directly with the AI personal trainer for more dynamic and personalized coaching.
- Expanded Data Sources: Integration with other training data sources beyond Strava.
- AI Model Flexibility: The ability to choose from different AI service providers for analysis.
This is a personal project, but feedback and contributions are welcome. Please feel free to open an issue or submit a pull request.
