Skip to content

Examples

Getting started

First, clone the project:
git clone https://github.com/TheNewThinkTank/fitness-tracker.git

Upload your workouts

  • Add your workout log to the data folder under the correct workout date
  • Run ./bin/fitcli.sh, optionally specify the WORKOUT_DATE and TRAINING_PROGRAM values
  • The bin/fitcli.sh script will then insert your log(s) into the TinyDB database

Running locally

Copy the environment template and fill in your values:

cp .env.example .env
docker compose up
  • Backend API: http://localhost:8000
  • API docs: http://localhost:8000/docs
  • Frontend: http://localhost:3000

Single container

docker build -t fitness-tracker:latest .
docker run --rm \
  -p 8000:8000 \
  --env-file .env \
  -v "$(pwd)/local_assets/credentials.json:/code/local_assets/credentials.json:ro" \
  fitness-tracker:latest

Without containers

# Start the backend
uvicorn src.main:app --reload

# Start the frontend (separate terminal)
cd frontend
npm run dev

Debugging: from the URL, open the browser's developer tools (F12 or Cmd+Shift+C)

Testing endpoints locally

Overview of endpoints:

Example: insert breath holding data in TinyDB

python3 src/utils/get_breath_holding.py

./bin/fitcli.sh
./bin/fitcli.sh -d 2024-03-03 -f json