{"id":31917838,"url":"https://github.com/james-langridge/strava-sdk","last_synced_at":"2026-01-20T17:00:57.708Z","repository":{"id":317488866,"uuid":"1067025509","full_name":"james-langridge/strava-sdk","owner":"james-langridge","description":"TypeScript SDK for Strava API with OAuth, webhooks, and rate limiting.","archived":false,"fork":false,"pushed_at":"2025-10-05T07:32:52.000Z","size":320,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-22T07:45:20.535Z","etag":null,"topics":["strava","strava-api","strava-oauth"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/james-langridge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-30T09:29:36.000Z","updated_at":"2025-10-15T03:37:03.000Z","dependencies_parsed_at":"2025-10-01T08:39:23.917Z","dependency_job_id":null,"html_url":"https://github.com/james-langridge/strava-sdk","commit_stats":null,"previous_names":["james-langridge/strava-sdk"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/james-langridge/strava-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james-langridge%2Fstrava-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james-langridge%2Fstrava-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james-langridge%2Fstrava-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james-langridge%2Fstrava-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/james-langridge","download_url":"https://codeload.github.com/james-langridge/strava-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james-langridge%2Fstrava-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28607624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T16:10:39.856Z","status":"ssl_error","status_checked_at":"2026-01-20T16:10:39.493Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["strava","strava-api","strava-oauth"],"created_at":"2025-10-13T20:48:26.681Z","updated_at":"2026-01-20T17:00:57.492Z","avatar_url":"https://github.com/james-langridge.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Strava SDK\n\nTypeScript SDK for Strava API with OAuth, webhooks, and rate limiting.\n\n## Features\n\n- **Complete OAuth Flow**: Authorization URL generation and token exchange\n- **Rate Limiting**: Built-in Bottleneck integration respecting Strava's limits (200/15min, 2000/day)\n- **Token Management**: Automatic token refresh with configurable expiry buffer\n- **Webhook Support**: Full webhook subscription management and event handling\n- **Type-Safe**: Full TypeScript support with comprehensive type definitions\n- **Storage Agnostic**: Bring your own database via simple interface\n- **Framework Integrations**: Express middleware\n- **Error Handling**: Detailed error classification and retry logic\n\n## Installation\n\n```bash\nnpm install strava-sdk\n```\n\n## Quick Start\n\n```typescript\nimport { StravaClient, MemoryStorage } from \"strava-sdk\";\n\nconst strava = new StravaClient({\n  clientId: process.env.STRAVA_CLIENT_ID!,\n  clientSecret: process.env.STRAVA_CLIENT_SECRET!,\n  redirectUri: \"http://localhost:3000/auth/callback\",\n  storage: new MemoryStorage(), // Use your own storage implementation\n});\n\n// Generate OAuth URL\nconst authUrl = strava.oauth.getAuthUrl({\n  scopes: [\"activity:read_all\", \"activity:write\"],\n});\n\n// Exchange code for tokens\nconst tokens = await strava.oauth.exchangeCode(code);\n\n// Save tokens\nawait strava.storage.saveTokens(tokens.athlete.id.toString(), {\n  athleteId: tokens.athlete.id.toString(),\n  accessToken: tokens.access_token,\n  refreshToken: tokens.refresh_token,\n  expiresAt: new Date(tokens.expires_at * 1000),\n});\n\n// Get activity (with automatic token refresh)\nconst activity = await strava.getActivityWithRefresh(\"12345\", athleteId);\n\n// Update activity\nawait strava.updateActivityWithRefresh(\"12345\", athleteId, {\n  description: \"Amazing ride!\",\n});\n```\n\n## Express Integration\n\n```typescript\nimport express from \"express\";\nimport { createExpressHandlers } from \"strava-sdk\";\n\nconst app = express();\nconst handlers = createExpressHandlers(strava, \"webhook-verify-token\");\n\n// OAuth routes\napp.get(\"/auth/strava\", handlers.oauth.authorize());\napp.get(\n  \"/auth/callback\",\n  handlers.oauth.callback({\n    onSuccess: async (req, res, tokens) =\u003e {\n      // Save tokens and redirect\n      res.redirect(\"/dashboard\");\n    },\n    onError: (req, res, error) =\u003e {\n      res.status(500).send(\"Auth failed\");\n    },\n  }),\n);\n\n// Webhook routes\napp.get(\"/api/webhook\", handlers.webhooks.verify());\napp.post(\"/api/webhook\", handlers.webhooks.events());\n\n// Handle webhook events\nstrava.webhooks.onActivityCreate(async (event, athleteId) =\u003e {\n  console.log(`New activity: ${event.object_id}`);\n});\n```\n\n## Webhook Events\n\n```typescript\nstrava.webhooks.onActivityCreate(async (event, athleteId) =\u003e {\n  // Handle new activity\n});\n\nstrava.webhooks.onActivityUpdate(async (event, athleteId) =\u003e {\n  // Handle activity update\n});\n\nstrava.webhooks.onActivityDelete(async (event, athleteId) =\u003e {\n  // Handle activity deletion\n});\n\nstrava.webhooks.onAthleteDeauthorize(async (event, athleteId) =\u003e {\n  // Clean up athlete data\n  await strava.storage.deleteTokens(athleteId.toString());\n});\n```\n\n## Implementing Storage\n\nFor production, implement `TokenStorage` with your database:\n\n```typescript\nimport { TokenStorage, StoredTokens } from \"strava-sdk\";\n\nclass YourDatabaseStorage implements TokenStorage {\n  async getTokens(athleteId: string): Promise\u003cStoredTokens | null\u003e {\n    // Fetch from your database\n  }\n\n  async saveTokens(athleteId: string, tokens: StoredTokens): Promise\u003cvoid\u003e {\n    // Save to your database\n  }\n\n  async deleteTokens(athleteId: string): Promise\u003cvoid\u003e {\n    // Delete from your database\n  }\n}\n```\n\nSee [Storage Guide](./docs/storage.md) for complete examples with PostgreSQL, MongoDB, and Redis.\n\n## Documentation\n\n- **[Getting Started Guide](./docs/getting-started.md)** - Complete setup walkthrough\n- **[Examples](./examples/)** - Working example applications\n- [API Reference](./docs/api-reference.md) - Detailed API documentation\n- [Webhook Setup](./docs/webhooks.md) - Webhook configuration guide\n- [Storage Implementation](./docs/storage.md) - Database integration examples\n\n## Examples\n\nCheck out the [examples](./examples/) directory for complete applications:\n\n- **[basic-app](./examples/basic-app/)** - Minimal Express app with OAuth and webhooks\n\n## Requirements\n\n- Node.js 18 or higher\n- TypeScript 5.0 or higher (for TypeScript projects)\n\n## Contributing\n\nContributions are welcome! Please open an issue or pull request.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjames-langridge%2Fstrava-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjames-langridge%2Fstrava-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjames-langridge%2Fstrava-sdk/lists"}