Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robiningelbrecht/strava-statistics
Self-hosted statistics generated using Strava data
https://github.com/robiningelbrecht/strava-statistics
self-hosted statistics strava strava-data
Last synced: about 8 hours ago
JSON representation
Self-hosted statistics generated using Strava data
- Host: GitHub
- URL: https://github.com/robiningelbrecht/strava-statistics
- Owner: robiningelbrecht
- License: agpl-3.0
- Created: 2024-12-10T10:14:46.000Z (2 months ago)
- Default Branch: master
- Last Pushed: 2025-02-07T22:26:03.000Z (3 days ago)
- Last Synced: 2025-02-07T23:18:30.953Z (3 days ago)
- Topics: self-hosted, statistics, strava, strava-data
- Language: HTML
- Homepage: https://strava-statistics.robiningelbrecht.be/
- Size: 103 MB
- Stars: 229
- Watchers: 3
- Forks: 7
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
![]()
Strava Statistics
---
Strava Statistics 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## 📸 Showcase
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 badge## ⚠️ Disclaimer
* 🛠️ __Under active development__: Expect frequent updates, bugs, and breaking changes.
* 📦 __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/strava-statistics/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 strava-statistics
> cd strava-statistics# 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
env_file: ./.env
ports:
- 8080:8080
```### .env
```bash
# 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:8081/
# 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/strava-statistics/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 or nl_BE
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/strava-statistics/wiki/Supported-sport-types/
SPORT_TYPES_TO_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/strava-statistics/wiki for more info.
ATHLETE_WEIGHTS='{
"YYYY-MM-DD": 74.6,
"YYYY-MM-DD": 70.3
}'
# History of FTP. Needed to calculate activity stress level.
# Check https://github.com/robiningelbrecht/strava-statistics/wiki for more info.
FTP_VALUES='{
"YYYY-MM-DD": 198,
"YYYY-MM-DD": 220
}'
# 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=''
# An array of activity ids to skip during import.
# This allows you to skip specific activities during import.
ACTIVITIES_TO_SKIP_DURING_IMPORT='[]'# The UID and GID to create/own files managed by strava-statistics
# 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
![Trophy case source code](public/assets/images/readme/trophy-case-source-code.png)
* 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## ⚡️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
If you want to see a new locale added, please [open a new issue](https://github.com/robiningelbrecht/strava-statistics/issues/new/choose).
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/strava-statistics/issues/new/choose).
Before you do, please read [the wiki](https://github.com/robiningelbrecht/strava-statistics/wiki). The question you have might be answered over there.