Stravify is an AI-powered analytics dashboard that allows runners to chat with their Strava data using natural language. Built with a modern React frontend and a robust FastAPI backend, it leverages Google's Gemini models via LangChain to analyze your running history dynamically.
- Natural Language Querying: Ask questions like "How many miles did I run last week?" or "What was my average pace in December?".
- Real-time Analysis: Fetches your latest Strava activities on the fly.
- Secure Authentication: Uses Strava OAuth2 for secure user login.
- Modern UI: A dark-themed, responsive interface built with Tailwind CSS.
- React + Vite: Fast, component-based UI development.
- Tailwind CSS: Utility-first styling for a sleek, dark-mode design.
- Lucide React: Beautiful, consistent iconography.
- Axios: For handling API requests to the backend.
- FastAPI: High-performance Python web framework for handling API requests and async operations.
- LangChain: Orchestrates the AI interactions and tool usage.
- Google Gemini (gemini-2.5-flash): The underlying LLM that powers the analysis and code generation.
- Pandas: Used for efficient data manipulation and analysis of running activities.
- Supabase: (Optional) For persistent storage of chat logs and user profiles.
Stravify doesn't just "guess" answers. It uses a ReAct (Reasoning + Acting) agent workflow:
- Data Loading: When you log in, the backend fetches your last 200 activities from Strava.
- DataFrame Creation: These activities are converted into a structured Pandas DataFrame containing metrics like distance, moving time, elevation, and dates.
- Agent Execution:
- When you ask a question, the LangChain Pandas DataFrame Agent receives the query.
- The agent uses Google Gemini 2.5 Flash to reason about the data.
- It generates Python code (specifically Pandas operations) to calculate the exact answer.
- It executes this code in a secure sandboxed environment.
- Finally, it interprets the result and returns a friendly, human-readable response.
This approach ensures 100% mathematical accuracy for queries like sums and averages, as the AI isn't doing mental math but rather writing code to solve the problem.
- Node.js & npm
- Python 3.10+
- Strava API Credentials
- Google AI Studio API Key
- Navigate to
backend/:cd backend - Create and activate a virtual environment:
python -m venv .venv source .venv/bin/activate - Install dependencies:
pip install -r requirements.txt
- Configure
.env:STRAVA_CLIENT_ID=your_id STRAVA_CLIENT_SECRET=your_secret GOOGLE_API_KEY=your_gemini_key
- Run the server:
uvicorn main:app --reload
- Navigate to
frontend/:cd frontend - Install dependencies:
npm install
- Run the development server:
npm run dev
