{"id":25827558,"url":"https://github.com/hanse/kafka-life-stream","last_synced_at":"2026-06-12T15:32:07.199Z","repository":{"id":136578733,"uuid":"149759083","full_name":"hanse/kafka-life-stream","owner":"hanse","description":"Kafka Life Stream: Activity Tracking (Strava), Open Banking (Sbanken) and what not","archived":false,"fork":false,"pushed_at":"2019-05-09T18:27:00.000Z","size":534,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-28T20:49:51.415Z","etag":null,"topics":["kafka","psd2","sbanken","strava","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hanse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2018-09-21T12:17:30.000Z","updated_at":"2023-03-08T04:01:54.000Z","dependencies_parsed_at":"2023-04-11T18:52:54.280Z","dependency_job_id":null,"html_url":"https://github.com/hanse/kafka-life-stream","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/hanse/kafka-life-stream","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanse%2Fkafka-life-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanse%2Fkafka-life-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanse%2Fkafka-life-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanse%2Fkafka-life-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hanse","download_url":"https://codeload.github.com/hanse/kafka-life-stream/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanse%2Fkafka-life-stream/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34251774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["kafka","psd2","sbanken","strava","typescript"],"created_at":"2025-02-28T16:34:44.130Z","updated_at":"2026-06-12T15:32:07.193Z","avatar_url":"https://github.com/hanse.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kafka Playground\n\n\u003e A collection of everything.\n\n## Life Stream\n\nCollect and act on events occuring in the life of an individual.\n\n## Packages\n\n- [Sbanken API Client](./blob/master/packages/sbanken-api-client/index.ts)\n- [Sbanken Transfers Consumer](./blob/master/packages/sbanken-transfers-consumer/index.ts)\n- [Strava API Client](./blob/master/packages/strava-api-client/index.ts)\n- [Strava Webhook Producer](./blob/master/packages/strava-webhook-producer/index.ts)\n- [Node Notifier Consumer](./blob/master/packages/node-notifier-consumer/index.ts)\n- [Console Consumer](./blob/master/packages/console-consumer/index.ts)\n\n## Create a `.env` file with a bunch of variables\n\n```bash\nexport SBANKEN_APPLICATION_CLIENT_ID=xxx\nexport SBANKEN_USER_ID=xxxxxxxxxxx\nexport SBANKEN_SECRET=xxx\nexport STRAVA_ACCESS_TOKEN=xxxxx\n```\n\n## Components\n\n### Strava Webhook Producer\n\nThe Strava webhook producer receives webhook events from [Strava](https://developers.strava.com/docs/webhooks/) and forwards them to Kafka.\n\n#### Running it locally\n\n1. Expose the running process\n\n```bash\nPORT=3000 node packages/strava-webhook-producer\nautossh -M 0 -R 80:localhost:3000 serveo.net\n```\n\n2. Register it with Strava\n\nReplace `client_id`, `client_secret` and `verify_token` with something else. The `callback_url` should match what the previous command gave you. You might also need to contact the Strava Developer team via email to have them enable webhooks for you.\n\n```\ncurl -X POST \\\n  https://api.strava.com/api/v3/push_subscriptions \\\n  -H 'Content-Type: application/x-www-form-urlencoded' \\\n  -F client_id=xxxxx \\\n  -F client_secret=xxxx \\\n  -F callback_url=https://xxxxx.serveo.net/strava \\\n  -F verify_token=hanse\n```\n\nAfter the registration is finished you should start receving events whenever things happen on Strava such as creating a new activity or changing the title of an exisiting. You must also remember to authorize your app with your account or else you won't get any data.\n\nStart the console consumer (`node packages/console-consumer strava`) to see the messages in this topic.\n\n## Sbanken Transfers Consumer\n\nThe Sbanken Transfers Consumer reads messages from the `strava` topic and does something cool whenever a new Strava activity is created.\n\n```bash\nnode packages/strava-transfers-consumer\n```\n\nThe cool things it does is to move an amount of money equal do the difference between the elapsed time and the configured target time from a **checking** account to a **savings** account utilizing [Sbanken Open Banking APIs](https://sbanken.no/bruke/utviklerportalen/).\n\nE.g. given a configured target of 20 minutes, **10 NOK** will be transferred if I run for 30 minutes. How useful 🍾.\n\n## Cookbook\n\n### Install locally on macOS\n\n```bash\nbrew install kafka\nbrew services start zookeeper\nbrew services start kafka\n```\n\n```bash\n# node-rdkafka needs this (see: https://github.com/Blizzard/node-rdkafka#mac-os-high-sierra)\nexport CPPFLAGS=-I/usr/local/opt/openssl/include\nexport LDFLAGS=-L/usr/local/opt/openssl/lib\n\nyarn\n```\n\n### Read messages from the topic `topic`\n\n```bash\nkafka-console-consumer --bootstrap-server localhost:9092 --from-beginning --topic topic\n```\n\n### Open a prompt for producing messages to the topic `chat`\n\n```bash\nkafka-console-producer --broker-list localhost:9092 --topic chat\n```\n\n### Create a topic with 2 partitions\n\n```bash\nkafka-topics --zookeeper localhost:2181 --create --topic topic2 --partitions 2 --replication-factor 1\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhanse%2Fkafka-life-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhanse%2Fkafka-life-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhanse%2Fkafka-life-stream/lists"}