Skip to content

TangRmdhn/TrainHub

Repository files navigation

TrainHub - AI-Powered Workout Planner

Personalized Workout Plans Powered by Google Gemini AI

PHP Python MySQL Tailwind CSS Bootstrap Google Gemini

Live DemoReport BugRequest Feature


About The Project

TrainHub is a web application designed to help users create personalized weekly workout plans using the power of AI (Google Gemini). It features a comprehensive dashboard for managing plans, an interactive calendar for tracking workouts, detailed statistics, and an AI-powered plan generator.

Key Features

  • AI Workout Generator: Create personalized 7-day workout templates based on your profile (goals, level, equipment).
  • AI Coach Chatbot: Interactive chat with an AI personal trainer for advice on workouts, nutrition, and motivation.
  • Weekly Template Model: Save a weekly template and apply it for a user-defined duration (e.g., 4, 8, 12 weeks).
  • Interactive Calendar: View daily workouts, mark them as complete, and see details in a modal.
  • Workout Tracking: Track your progress by marking workouts as done.
  • Stats Dashboard: Monitor your current streak, total workouts, and 30-day activity graph.
  • Mobile Responsive: Fully responsive design for seamless use on all devices.
  • Secure Authentication: Robust login and registration system.

Tech Stack

Frontend

  • HTML5 & JavaScript
  • Tailwind CSS (Dashboard & App Pages)
  • Bootstrap 5.3.2 (Landing Page)
  • Chart.js (Statistics Visualization)

Backend

  • PHP (Native)
  • Python (FastAPI for AI Services)

Database

  • MySQL

AI Model

  • Google Gemini 2.5 Flash & Google Gemini 2.0 Flash

Getting Started

1. Clone Repository

git clone https://github.com/TangRmdhn/TrainHub.git
cd trainhub

2. Database Setup

  • Import the database schema:
    mysql -u root -p < trainhub_db.sql
  • Update koneksi.php with your credentials:
    $host = "localhost";
    $user = "root";
    $password = "your_password";
    $database = "trainhub_db";

3. Python AI Service Setup

Navigate to AI directory

cd AI

Create Virtual Environment (Recommended)

python -m venv .venv

Activate Virtual Environment

  • Windows (PowerShell):
    .\.venv\Scripts\activate
  • Windows (CMD):
    .venv\Scripts\activate.bat
  • macOS/Linux:
    source .venv/bin/activate

Install Dependencies

pip install -r requirements.txt

Configure API Key

Create a .env file in the AI directory:

GOOGLE_API_KEY=your_api_key_here

Run FastAPI Server

uvicorn main:app --reload

The AI service will run at http://localhost:8000.

4. Web Server Setup

  • Host PHP files on a local server (XAMPP, Apache, Nginx).
  • Ensure the server runs on http://localhost.

5. Tailwind CSS Setup

Build the CSS before running the app.

Option A: Standalone CLI

# Windows
.\tailwindcss.exe -i .\src\input.css -o .\views\css\tailwind.css --minify

Option B: npm

npm install -D tailwindcss
npx tailwindcss -i ./src/input.css -o ./views/css/tailwind.css --minify

6. Access the App

Open http://localhost/trainhub in your browser.

Project Structure

trainhub/
├── AI/                         # Python FastAPI Service
├── views/                      # Frontend Views
│   ├── css/                    # Stylesheets
│   ├── app.php                 # Dashboard
│   └── ...
├── controllers/                # Backend Logic
├── index.php                   # Landing Page
├── config.php                  # Configuration
├── koneksi.php                 # Database Connection
├── trainhub_db.sql             # Database Schema
└── README.md                   # Documentation

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

License

Distributed under the GNU General Public License v3.0. See LICENSE for more information.

About

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors