Giter Club home page Giter Club logo

strava-personal-leaderboard's Introduction

Strava personal leaderboard

Strava hidden the personal leaderboards behind the paywall in July 2020. I was mainly interesting in comparing my segment performances, hence the idea to create my own Strava leaderboard by fetching the data using Strava API and dumping it in a Postgres DB. The project tries to recreate some of the Strava UI around activity details and segment leaderboards, but this this also one of my personal playgrounds and some things might not be polished at all.

Architecture

Local development

Netlify Dev is used for local development of the frontend because it wraps create-react-app and spawns locally all the serverless functions required for the backend.

Docker compose is used to spin up the backend, making it very easy to create both a postgres db and Hasura graphql server.

In order to have the schema structure created make sure you first run the init migration and then apply the hasura metadata

psql -h localhost -p 5432 -d postgres -U postgres < ./hasura/migrations/init/up.sql

hasura metadata apply --admin-secret myadminsecretkey

WSL development

Requires Python Netlify functions that are passed as ENV variable having the url as docker host do not work in WSL because Microsoft is mangling with the ip interfaces. in order to enable hasura event functions to be mapped to netlify local functions, run yarn dev-wsl. The script is remapping docker-compose env variables to eth0 ip.

Ansible scripts

There are some ansible scripts in order to backup the data from Docker, copy data from VPS Postgres DB, or to import it into a new Postgres database running remotely. Due to the volume of records that would be created by the weather data, Heroku DB quickly runs out of records (there is a hard limit of 10k rows for free version). I would personally advice getting a managed DB or a small server and install Postgres there. Also the scripts provide a way to upload the data to a Heroku Postgres DB linked to a Hasura cloud instance. Psql is required in most cases, but the scripts could be easily modified to be run from within docker if psql is not available locally.

The ansible scripts require some variables defined in the ansible-scripts/vars.yml. The file should contain:

  • app_name -> Heroku application name
  • hasura_endpoint -> Hasura cloud instance url
  • docker_image_name -> name of the postgress docker container
  • db_user - if running on in a vps get the role
  • db_password - if running in a vps/managed db
  • db_name - if running in a vps/managed db
  • vps_address - ip of the vps or managed db
  • port - if running in a vps/managed db
  • hasura_admin_secret - if security is set in hasura

strava-personal-leaderboard's People

Contributors

danutzcodrescu avatar dependabot[bot] avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.