How It Works
Automatic Capture
Strava sends a webhook whenever you complete an activity
Cloud Storage
Activity data is fetched and stored in Google Cloud Storage as JSON
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
Login Required
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
- Go to Strava API Settings
- Create a new application
- Set Authorization Callback Domain to
strava.bngrd.com - Note your Client ID and Client Secret
2. Configure GCP Project
- Create a new GCP project
- Enable Cloud Run, Cloud Storage, and Secret Manager APIs
- 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
- Add the CNAME record shown after deployment to Cloudflare
- Enable Cloudflare proxy (orange cloud) for SSL
5. Register Webhook
- Go to Strava API settings
- Set Webhook Callback URL:
https://strava.bngrd.com/strava/webhook - Set Verify Token to match your
STRAVA_VERIFY_TOKEN
6. Authorize the App
- Visit https://strava.bngrd.com/auth/authorize
- Authorize the app to access your Strava data
- You're all set! New activities will be automatically captured.