Elevate is a personal fitness web dashboard that pulls in data from Fitbit, Jawbone, and Strava.
Elevate is self-hosted and open-source (see the License section), so you can get your own Elevate, or help improve it!
Get your own Elevate
If you want to run your own instance of Elevate, you'll need a few things:
- A server that can run Node.js
- A MongoDB database
- Fitness data that you want to display from Fitbit, Jawbone, or Strava
You can satisfy the first two requirements by launching a Node.js droplet on DigitalOcean. If you don't have a DigitalOcean account, you can sign up here.
Assuming you have a server with Node and Mongo installed, here's what you have to do:
- Clone this repo:
git clone https://github.com/daylen/elevate.git && cd elevate
- Install the dependencies:
- Install webpack:
npm install -g webpack
- Compile the front-end JS for production:
- Get some Fitbit, Jawbone, and Strava API keys:
- Register a Fitbit app here. Set OAuth 1.0 type to Browser and OAuth 2.0 type to Server. Include your domain name in the callback URL field. Elevate only neads read access.
- Register a Jawbone app here. Include your domain name in the OAuth Redirect URI field.
- Register a Strava app here. Include your domain in the Authorization Callback Domain field.
- Edit the config file:
cp config/config.yml config/custom.yml && nano config/custom.yml
- Your name is displayed in the header of the dashboard.
- Here is a map of valid timezone strings.
- Pick a strong password; this is how you'll log in to the settings area.
- Replace all the relevant OAuth fields.
- Install naught:
npm install -g naught
YOUR_DOMAIN_NAME/admin, log in with the username and password you chose in
custom.yml, and connect some accounts.
YOUR_DOMAIN_NAME. You should see your health data! If not, please let me know and I'll do my best to help.
Note: It is strongly recommended that you serve your site over HTTPS because the settings area uses HTTP Basic Auth. Remember that CloudFlare offers free SSL.
Hack on Elevate
Want to contribute to Elevate? This "how it works" will get you oriented.
The back end is a Node app that polls for health data from Fitbit, Jawbone, and Strava every 2 minutes and stores that data in MongoDB. It then exposes that data through an internal API. Additionally, there is a settings area (
/admin) that lets you connect and disconnect accounts. The first time an account is connected, Elevate will attempt to backfill as much data as possible. From then on, the polling will only update recent entries.
The code that crawls the various services can be found in
connectors/. The API code can be found in
routes/api.js. Or, you can just look at this cheat sheet:
/api/v1/name- fetches the user's name
/api/v1/activity- fetches the last month of activity
/api/v1/activity?from=2015-01-01&to=2015-02-01- fetches a range of activity
/api/v1/activity/2015-01-01- fetches activity for a specific day
NODE_ENV=dev to disable background crawling.
The front end is a React app (with routing by React Router), following the Flux app architecture. Since I hacked this together over a couple of days, everything's in
loadMoreDays- Fired when you load the page for the first time, or when you hit the Load More button
loadSingleDay- Fired when you load a detail page
ActivityNugget- These are the Strava boxes