Strava Analyzer

Automatically capture, store, and visualize your Strava activities

How It Works

1

Automatic Capture

Strava sends a webhook whenever you complete an activity

2

Cloud Storage

Activity data is fetched and stored in Google Cloud Storage as JSON

3

Analytics Ready

Query your data with BigQuery or build custom visualizations

Architecture

┌─────────────┐     webhook      ┌─────────────────┐
│   Strava    │ ───────────────► │   Cloud Run     │
│     API     │                  │   (FastAPI)     │
└─────────────┘                  └────────┬────────┘
                                          │
                                          ▼
                                 ┌─────────────────┐
                                 │  Cloud Storage  │
                                 │   (JSON files)  │
                                 └────────┬────────┘
                                          │
                                          ▼
                                 ┌─────────────────┐
                                 │    BigQuery     │
                                 │ (External Table)│
                                 └─────────────────┘
                    

Activity Dashboard

Login to view your activity data

API Documentation

GET /health

Health check endpoint

{"status": "healthy"}
GET /auth/authorize

Redirects to Strava OAuth authorization page

GET /auth/callback?code={code}

OAuth callback - exchanges authorization code for tokens

{"detail": "Authorization successful!", "scope": "activity:read_all"}
GET /auth/users

List all registered users

{"users": [{"athlete_id": 123, "athlete_name": "John Doe"}], "count": 1}
GET /activities/?athlete_id={id}

Fetch all activities for a specific athlete

[{"id": 123, "name": "Morning Run", "distance": 5000, ...}]
GET /activities/{activity_id}?athlete_id={id}

Fetch a specific activity for an athlete

GET /strava/webhook

Strava webhook verification endpoint

POST /strava/webhook

Receives Strava webhook events. Automatically fetches new activity data and stores in GCS.

{"status": "ok"}

Setup Guide

1. Create Strava API Application

  1. Go to Strava API Settings
  2. Create a new application
  3. Set Authorization Callback Domain to strava.bngrd.com
  4. Note your Client ID and Client Secret

2. Configure GCP Project

  1. Create a new GCP project
  2. Enable Cloud Run, Cloud Storage, and Secret Manager APIs
  3. Create a GCS bucket for activity data

3. Deploy to Cloud Run

# Edit deploy.sh with your configuration
vim deploy.sh

# Run deployment
./deploy.sh

4. Configure DNS

  1. Add the CNAME record shown after deployment to Cloudflare
  2. Enable Cloudflare proxy (orange cloud) for SSL

5. Register Webhook

  1. Go to Strava API settings
  2. Set Webhook Callback URL: https://strava.bngrd.com/strava/webhook
  3. Set Verify Token to match your STRAVA_VERIFY_TOKEN

6. Authorize the App

  1. Visit https://strava.bngrd.com/auth/authorize
  2. Authorize the app to access your Strava data
  3. You're all set! New activities will be automatically captured.