https://github.com/robiningelbrecht/statistics-for-strava
Self-hosted statistics generated using Strava data
https://github.com/robiningelbrecht/statistics-for-strava
self-hosted statistics strava strava-data
Last synced: 2 months ago
JSON representation
Self-hosted statistics generated using Strava data
- Host: GitHub
- URL: https://github.com/robiningelbrecht/statistics-for-strava
- Owner: robiningelbrecht
- License: agpl-3.0
- Created: 2024-12-10T10:14:46.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2025-04-11T18:58:26.000Z (2 months ago)
- Last Synced: 2025-04-11T19:52:20.663Z (2 months ago)
- Topics: self-hosted, statistics, strava, strava-data
- Language: HTML
- Homepage: https://statistics-for-strava.robiningelbrecht.be/
- Size: 106 MB
- Stars: 451
- Watchers: 4
- Forks: 19
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
![]()
Statistics for Strava
---
Statistics for Strava is a self-hosted web app designed to provide you with better stats.
Showcase •
Disclaimer •
Wiki •
Prerequisites •
Installation •
Import and build statistics •
Locales and translations •
Discord## 📸 Showcase
> [!NOTE]
> This app is in no way affiliated with or part of the official Strava software suite.https://github.com/user-attachments/assets/9aaaafd9-bc8f-4e1d-bb9d-45d3c661a080
### Key Features
* Dashboard with various stats and charts
* Detailed list of all your activities
* Monthly stats with calendar view
* Gear stats
* Eddington for biking and running activities
* Detailed list of your segments and corresponding efforts
* Heatmap
* History of completed Strava challenges
* History of activity photos
* User badges## ⚠️ Disclaimer
* 📦 __Backup before updates__: Always backup your Docker volumes before upgrading.
* 🔄 __Stay up-to-date__: Make sure you're running the latest version for the best experience.
* 🤓 __Check the release notes__: Always check the release notes to verify if there are any breaking changes.## 📚 Wiki
Read [the wiki](https://github.com/robiningelbrecht/statistics-for-strava/wiki) before opening new issues. The question you have might be answered over there.
## 🪄 Prerequisites
You'll need a `Strava client ID`, `Strava client Secret` and a `refresh token`
* Navigate to your [Strava API settings page](https://www.strava.com/settings/api).
Copy the `client ID` and `client secret`
* Next you need to obtain a `Strava API refresh token`.
* Navigate to https://developers.strava.com/docs/getting-started/#d-how-to-authenticate
and scroll down to "_For demonstration purposes only, here is how to reproduce the graph above with cURL:_"
* Follow the 11 steps explained there
* Make sure you change the `&scope=read` to `&scope=activity:read_all` to make sure your refresh token has access to all activities## 🛠️ Installation
> [!NOTE]
> To run this application, you'll need [Docker](https://docs.docker.com/engine/install/) with [docker-compose](https://docs.docker.com/compose/install/).Start off by showing some ❤️ and give this repo a star. Then from your command line:
```bash
# Create a new directory
> mkdir statistics-for-strava
> cd statistics-for-strava# Create docker-compose.yml and copy the example contents into it
> touch docker-compose.yml
> nano docker-compose.yml# Create .env and copy the example contents into it. Configure as you like
> touch .env
> nano .env
```### docker-compose.yml
```yml
services:
app:
image: robiningelbrecht/strava-statistics:latest
volumes:
- ./build:/var/www/build
- ./storage/database:/var/www/storage/database
- ./storage/files:/var/www/storage/files
- ./storage/gear-maintenance:/var/www/storage/gear-maintenance
env_file: ./.env
ports:
- 8080:8080
```### .env
> [!IMPORTANT]
> Every time you change the .env file, you need to restart your container for the changes to take effect.```bash
# ⚠ ️Every time you change the .env file, you need to restart your container for the changes to take effect.# The URL on which the app will be hosted. This URL will be used in the manifest file.
# This will allow you to install the web app as a native app on your device.
MANIFEST_APP_URL=http://localhost:8080/
# The client id of your Strava app.
STRAVA_CLIENT_ID=YOUR_CLIENT_ID
# The client secret of your Strava app.
STRAVA_CLIENT_SECRET=YOUR_CLIENT_SECRET
# The refresh of your Strava app.
STRAVA_REFRESH_TOKEN=YOUR_REFRESH_TOKEN
# Strava API has rate limits (https://github.com/robiningelbrecht/statistics-for-strava/wiki),
# to make sure we don't hit the rate limit, we want to cap the number of new activities processed
# per import. Considering there's a 1000 request per day limit and importing one new activity can
# take up to 3 API calls, 250 should be a safe number.
NUMBER_OF_NEW_ACTIVITIES_TO_PROCESS_PER_IMPORT=250
# The schedule to periodically run the import and HTML builds. Leave empty to disable periodic imports.
# The default schedule runs once a day at 04:05. If you do not know what cron expressions are, please leave this unchanged
# Make sure you don't run the imports too much to avoid hitting the Strava API rate limit. Once a day should be enough.
IMPORT_AND_BUILD_SCHEDULE="5 4 * * *"
# Set the timezone used for the schedule
# Valid timezones can found under TZ Identifier column here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
TZ=Etc/GMT# Allowed options: en_US, fr_FR, nl_BE, de_DE, pt_PT or zh_CN
LOCALE=en_US
# Allowed options: metric or imperial
UNIT_SYSTEM=metric
# Time format to use when rendering the app
# Allowed formats: 24 or 12 (includes AM and PM)
TIME_FORMAT=24
# Date format to use when rendering the app
# Allowed formats: DAY-MONTH-YEAR or MONTH-DAY-YEAR
DATE_FORMAT=DAY-MONTH-YEAR
# Sport types to import. Leave empty to import all sport types
# With this list you can also decide the order the sport types will be rendered in.
# A full list of allowed options is available on https://github.com/robiningelbrecht/statistics-for-strava/wiki/Supported-sport-types/
SPORT_TYPES_TO_IMPORT='[]'
# Activity visibilities to import. Leave empty to import all visibilities
# This list can be combined with SPORT_TYPES_TO_IMPORT.
# Allowed values: ACTIVITY_VISIBILITIES_TO_IMPORT='["everyone", "followers_only", "only_me"]',
ACTIVITY_VISIBILITIES_TO_IMPORT='[]'
# Optional, the date (YYYY-MM-DD) from which you want to start importing activities.
# Any activity recorded before this date, will not be imported.
# This can be used if you want to skip the import of older activities. Leave empty to disable.
SKIP_ACTIVITIES_RECORDED_BEFORE=''
# An array of activity ids to skip during import.
# This allows you to skip specific activities during import.
# ACTIVITIES_TO_SKIP_DURING_IMPORT='["123456789", "987654321"]'
ACTIVITIES_TO_SKIP_DURING_IMPORT='[]'
# Your birthday. Needed to calculate heart rate zones.
ATHLETE_BIRTHDAY=YYYY-MM-DD
# History of weight (in kg or pounds, depending on UNIT_SYSTEM). Needed to calculate relative w/kg.
# Check https://github.com/robiningelbrecht/statistics-for-strava/wiki for more info.
ATHLETE_WEIGHT_HISTORY='{
"YYYY-MM-DD": 100,
"YYYY-MM-DD": 200
}'
# The formula used to calculate your max heart rate. The default is Fox (220 - age).
# Allowed values: arena, astrand, fox, gellish, nes, tanaka (https://pmc.ncbi.nlm.nih.gov/articles/PMC7523886/table/t2-ijes-13-7-1242/)
# Or you can set a fixed number for any given date range.
MAX_HEART_RATE_FORMULA='fox'
# MAX_HEART_RATE_FORMULA='{
# "2020-01-01": 198,
# "2025-01-10": 193
# }'
# Optional, history of FTP. Needed to calculate activity stress level.
# Check https://github.com/robiningelbrecht/statistics-for-strava/wiki for more info. Example:
# FTP_HISTORY='{
# "2024-10-03": 198,
# "2025-01-10": 220
#}'
FTP_HISTORY='[]'
# Optional, a link to your profile picture. Will be used to display in the nav bar and link to your Strava profile.
# Leave empty to disable this feature.
PROFILE_PICTURE_URL=''
# Optional, your Zwift level (1 - 100). Will be used to render your Zwift badge. Leave empty to disable this feature
ZWIFT_LEVEL=
# Optional, your Zwift racing score (0 - 1000). Will be used to add to your Zwift badge if ZWIFT_LEVEL is filled out.
ZWIFT_RACING_SCORE=
# Optional, full URL with ntfy topic included. This topic will be used to notify you when a new HTML build has run.
# Leave empty to disable notifications.
NTFY_URL=''# The UID and GID to create/own files managed by statistics-for-strava
# May only be necessary on Linux hosts, see File Permissions in Wiki
#PUID=
#PGID=
```### Importing challenges and trophies
> [!IMPORTANT]
> Only visible challenges on your public profile can be imported. Please make sure that your profile is public,
> otherwise the app won't be able to import them#### Importing complete history
Strava does not allow to fetch a complete history of your completed challenges and trophies.
There's a little workaround if you'd still like to import these:
* Navigate to https://www.strava.com/athletes/[YOUR_ATHLETE_ID]/trophy-case
* Open the page's source code and copy everything

* Make sure you save the source code to the file `./storage/files/strava-challenge-history.html`
* On the next import, all your challenges will be imported> [!WARNING]
> Make sure before you save the source code, your Strava account is set to be translated in English.
> The app can only handle this export in English for now.## ⚡️Import and build statistics
```bash
docker compose exec app bin/console app:strava:import-data
docker compose exec app bin/console app:strava:build-files
```## 🗺️ Locales and translations
Currently, the app is translated to:
* 🇬🇧 English
* 🇫🇷 French (thanks to [@llaumgui](https://github.com/llaumgui) and [@Ahmosys](https://github.com/llaumgui))
* 🇩🇪 German (thanks to [@daydreamer77](https://github.com/daydreamer77))
* 🇧🇪 Dutch
* 🇵🇹 Portuguese (thanks to [@jcnmsg](https://github.com/jcnmsg))
* 🇨🇳 Simplified Chinese (thanks to [@c0j0s](https://github.com/c0j0s))If you want to see a new locale added, please [open a new issue](https://github.com/robiningelbrecht/statistics-for-strava/issues/new?template=translations-and-localisation.md).
Only do this if you are willing to help on the actual translation 🙃.## 💡 Feature request?
For any feedback, help or feature requests, please [open a new issue](https://github.com/robiningelbrecht/statistics-for-strava/issues/new/choose).
Before you do, please read [the wiki](https://github.com/robiningelbrecht/statistics-for-strava/wiki). The question you have might be answered over there.