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!
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:
npm install
- Install webpack:
npm install -g webpack
- Compile the front-end JS for production:
webpack -p
- 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
npm start
- Visit
YOUR_DOMAIN_NAME/admin
, log in with the username and password you chose incustom.yml
, and connect some accounts. - Visit
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.
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:
- GET
/api/v1/name
- fetches the user's name - GET
/api/v1/activity
- fetches the last month of activity - GET
/api/v1/activity?from=2015-01-01&to=2015-02-01
- fetches a range of activity - GET
/api/v1/activity/2015-01-01
- fetches activity for a specific day
Specify 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 public/jsx/app.jsx
and public/less/app.less
.
loadName
loadMoreDays
- Fired when you load the page for the first time, or when you hit the Load More buttonloadSingleDay
- Fired when you load a detail page
DayStore
Toolbar
DayCellList
DayCell
LoadMore
DayDetail
ActivityNugget
- These are the Strava boxes
Footer
MIT license.