Skip to content

CyrilBaah/fitnesstracker

Repository files navigation

🏋️‍♂️ Fitness Tracker API 🏋️‍♀️

The Fitness Tracker API is designed to keep you on top of your fitness goals by tracking exercises, nutrition, and workouts! This robust API leverages Python with Django and Postgres for a smooth experience.

🌟 Technology Stack

Backend : Python🐍

Database: Postgres 🐘

Framework:Postgres🦄

🛠️ Code Formatters & Linters

Flake8: Enforcing code standards Flake8⚙️

Black: Code formatting Black 🖤

Isort: Sorting imports Isort 📑

🚀 How to Set Up Locally

Pre-requisite Ensure Postgres is installed. Check the installation guide here. Steps

1.Clone the Project:

git clone https://github.com/CyrilBaah/fitnesstracker.git
cd fitnesstracker

2.Set Up Virtual Environment:

virtualenv env
source env/bin/activate

3.Install Dependencies:

pip install -r requirements.txt

4.Update Environment Variables: Rename the env.example file to .env and update it as needed.

5.Run Migrations:

python manage.py migrate

6.Start the Server:

python manage.py runserver

7.Access the API: Visit: Fitness Tracker API 🌐

🐳 Docker Setup

Pre-requisite

Install Docker: Installation Guide

Install Postgres: Installation Guide

Steps:

1.Clone the repository

git clone https://github.com/CyrilBaah/fitnesstracker.git
cd fitnesstracker

2.Update Environment Variables: Rename the env.example file to .env and update it as needed.

3.Run

docker-compose build --no-cache

4.Run

docker-compose up

🛡️ Running Linters

 cd scripts
 ./run-linters.sh

📊 Generate Seeders

  • Exercise
 ./manage seed_exercises
  • Nutritions
 ./manage seed_nutritions
  • Workout
 ./manage seed_workouts

📜 Generate API Documentation

 ./manage.py spectacular --color --file schema.yml

Documentation API

http://127.0.0.1:8000/api/schema/docs

🔐 Generate Secret Key

 ./scripts/run-secretkey.sh 

🏗️ Kubernetes Setup

Prerequisites

Steps:

1.Apply Kubernetes manifests:

$ kubectl apply -f ops/

2.Port-forward the service:

$ kubectl port-forward service/fitnesstracker 8000:8000

3.Access Minikube dashboard:

$ minikube dashboard --url

4.Get Node Address:

$ kubectl get service fitnesstracker -o jsonpath='{.spec.clusterIP}'
$ kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}'

5.Configure Ingress:

Get ClusterIP

$ kubectl get service fitnesstracker

Modify /etc/hosts

$ sudo nano /etc/hosts

Add cluster IP to /etc/hosts

123.456.7.8 fitnesstracker.com

##🚀 Use KinD

  1. Run
make create-cluster
  1. Install Nginx Ingress Controller
make install-nginxingresscontroller 

🤝 Contributing

We 💙 contributions! Here's how you can contribute to the project:

1.Steps to Contribute Fork the Repository: Click on the "Fork" button on the repository page to create your own copy.

2.Clone Your Fork

Once you’ve forked the project, clone your copy to your local machine:

git clone https://github.com/YOUR-USERNAME/fitnesstracker.git
cd fitnesstracker

3.Create a New Branch:

git checkout -b feature-branch-name

4.Make Your Changes: Add features, fix bugs, or enhance documentation.

5.Commit Your Changes:

Write clear and descriptive commit messages. Your commit messages should be short and concise, summarizing the changes.

git commit -m "Add feature or fix description"

6.Push to Your Fork:

git push origin feature-branch-name

7.Submit a Pull Request: Open a pull request from your fork to the original repository with a clear description.

We look forward to your awesome contributions! 🎉