Skip to content

rkubapl/strava-api

Repository files navigation

Strava Goal Setter

This application was created by me to track my summer biking and walking goals.

Deployment Instructions

To deploy the Strava Goal Setter, please ensure you have the following prerequisites set up:

  • Node.js installed on your local machine.
  • Wrangler installed. If you haven't installed it yet, you can do so globally using npm with the following command:
npm install -g @cloudflare/wrangler

Deployment Steps

  1. Clone the Project:

Clone this project to your local machine using Git.

  1. Configure Environment Variables:
  • Rename _wrangler.toml to wrangler.toml and open it in a text editor.
  • Set the following environment variables in the wrangler.toml file:
    • CLIENT_ID: Your application ID from Strava. Obtain it at https://www.strava.com/settings/api.
    • GOALS: Your goals in JSON format, where each key represents an activity type and the value is the target number of kilometers. For example: {"Walk": 250, "Ride": 500, "Swim": 200}.
    • CALLBACK_URL: Set it to the domain of your API and add /callback at the end. For example: https://strava-api.yourdomain.com/callback.
    • PASSWORD: Password to access the /stats endpoint.
  1. Create a KV database

Access your Cloudflare dashboard, then navigate to Workers & Pages > KV and proceed to create a new namespace. Provide a name for the namespace and click Add. Upon creation, locate the namespace in the list below, and copy its unique ID.

In the wrangler.toml configuration file, ensure you paste the copied KV namespace ID into the appropriate section:

kv_namespaces = [
    { binding = "STRAVA_DATA",  id = "PASTE_YOUR_COPIED_KV_NAMESPACE_ID_HERE }
]
  1. Deploy the Worker:

Deploy the Strava Goal Setter to Cloudflare Workers by running the following command in your project's root directory:

wrangler deploy
  1. Configure Environmental Secrets:

Go to your Cloudflare dashboard, navigate to Workers & Pages, select strava-api, and go to Settings > Variables > Edit Variables > Add Variable (check Encrypt). Configure the following environmental secrets:

Congratulations! API for your Strava Goal Setter app is now deployed and ready to help you achieve your goals this summer. Now you can set up website app to display your goals online.

License

The Strava Goal Setter app is licensed under the Apache License 2.0. Feel free to modify and use it according to your needs.

About

API to track my summer biking and walking goals

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published