What is Segment Challenge?
Segment Challenge allows any Strava athlete to host their own Strava-based challenge. Strava is a social network for athletes.
A challenge comprises one or more stages. You can create a challenge based around different Strava segments, or an activity challenge where you decide what type of activity to record (distance, duration, or elevation) and can set an optional goal.
Why is this being made public?
In March 2019 Strava decided to revoke access to the Strava API for Segment Challenge as "... the purpose of this app is competitive with Strava". Without API access the site cannot function. I am making the source code public to demonstrate one approach to building event sourced Elixir applications using Commanded.
Can I run this locally?
Yes, first you need to create a Strava account and create your own Strava API Application and then follow the steps below to clone the Git repo, prepare, and run the application.
Can I deploy this publicly?
No, Strava will not allow Segment Challenge access to their API in public.
Install Elixir v1.8 and a Postgres database.
Install Elixir dependencies:
Configure your Strava API Application settings:
cp config/dev.secret.example config/dev.secret.exs
config/dev.secret.exsconfig file and enter the Client ID, Client Secret, and Access Token values from you Strava API Application settings.
You will need to do the same for
test.secret.exsto run tests and
prod.secret.exsto run in production.
Create the event store and read store databases:
This command will create and initialise two databases (
segmentchallenge_readstore_dev) using the default Postgres connection settings configured in
npm install npm run compile
You can use the
npm run watchtask to watch the assets and recompile on change.
Run the Phoenix web server:
iex -S mix phx.server
Import active challenge stage efforts
Attempts at active stages are fetched from Strava every four hours. To import them immediately you can run the following from an
iex -S mix console: