๐Ÿ‹๏ธ Fitness Coach Bot

Advanced AI-powered fitness coaching chatbot for personalized workout plans, exercise guidance, progress tracking, and health tips. Features workout plan generation, exercise instructions with proper form, progress tracking, nutrition advice, goal setting, interactive chat interface, and comprehensive analytics.
Try Interactive Demo

๐Ÿ“– Project Overview

Fitness Coach Bot is an advanced AI-powered fitness coaching chatbot that integrates Python, Flask, and SQLAlchemy to create an intelligent personal fitness trainer. This project offers personalized workout plan generation based on fitness goals and levels, detailed exercise instructions with proper form techniques, comprehensive progress tracking for workouts and fitness metrics, personalized nutrition advice for different fitness objectives, goal setting and achievement tracking, interactive chat interface with AI fitness coach, health tips across multiple categories, workout history and analytics, user profile management, and comprehensive fitness analytics dashboard. Perfect for fitness apps, health platforms, personal training applications, and individuals seeking AI-powered fitness guidance.

โšก Quick Facts

๐ŸŽฏ Type: AI Fitness Coaching Chatbot
๐Ÿค– AI Features: Workout Plan Generation, Exercise Guidance, Progress Tracking, Nutrition Advice, Goal Setting
โšก Setup Time: ~5 minutes
๐Ÿ“ฆ Backend: Python with Flask
๐ŸŽจ Frontend: HTML5, CSS3, JavaScript
๐Ÿ’พ Database: SQLite with SQLAlchemy ORM
๐Ÿ“ฑ Platform: Web Browser
๐Ÿ”ง Technologies: Python, Flask, SQLAlchemy, SQLite, Bootstrap 5
25+
Files
5000+
Lines of Code
20+
Advanced Features
100+
Exercises
Developer: Molla Samser | Website: rskworld.in | Email: help@rskworld.in
Difficulty Level: Intermediate - Perfect for developers learning Python, Flask, SQLAlchemy, database integration, fitness applications, and AI chatbot development.

โœจ Features

Core Features

๐Ÿ‹๏ธ Personalized Workout Plans

AI-generated workout routines tailored to your fitness level, goals, and preferences. Get custom plans for weight loss, muscle gain, endurance, and more.

๐Ÿ’ช Exercise Guidance

Detailed exercise instructions with proper form techniques, muscle groups targeted, equipment needed, and helpful tips for safe and effective workouts.

๐Ÿ“Š Progress Tracking

Monitor your fitness journey with comprehensive tracking of workouts completed, streaks, calories burned, goals met, and overall progress statistics.

๐Ÿฅ— Nutrition Advice

Personalized nutrition recommendations based on your fitness goals. Get advice for muscle gain, weight loss, endurance training, and general health.

Advanced Features

๐ŸŽฏ Goal Setting

Set and track fitness objectives including weight loss, muscle gain, endurance improvement, flexibility, and general health goals.

๐Ÿ’ก Health Tips

Randomized health and wellness advice across multiple categories including nutrition, exercise, recovery, motivation, and safety.

๐Ÿ‘ค User Profiles

Store personal information including age, weight, height, fitness goals, activity level, and preferences for personalized coaching.

๐Ÿ“ˆ Workout Analytics

Comprehensive analytics dashboard with visualizations showing workout frequency, progress trends, goal completion, and fitness metrics.

๐Ÿƒ Exercise Database

Extensive collection of exercises with categories (strength, cardio, flexibility), muscle groups, equipment needed, and difficulty levels.

๐Ÿค– AI Workout Generator

Intelligent workout plan creation based on user goals, fitness level, available equipment, and time constraints.

๐Ÿ“ฑ Responsive Design

Beautiful, modern UI that works seamlessly on desktop, tablet, and mobile devices for fitness coaching anywhere.

๐Ÿ’ฌ Interactive Chat

Natural conversation interface with AI fitness coach for asking questions, getting advice, and receiving personalized guidance.

๐Ÿ“ Workout History

Track completed workouts with timestamps, exercises performed, sets, reps, and progress notes for comprehensive history.

๐Ÿ† Achievement System

Gamification features with achievements, badges, and rewards for maintaining workout streaks and reaching fitness milestones.

๐Ÿ”’ Data Security

Secure user data storage with proper database management, input validation, and privacy protection for fitness information.

โšก Fast Performance

Optimized database queries and efficient processing for fast responses and smooth fitness coaching interactions.

๐Ÿ› ๏ธ Technologies

Python

Core programming language for educational platform

Language

Flask

Python web framework for backend API

Framework

SQLAlchemy

SQL toolkit and ORM for database operations

Database

SQLite

Lightweight database for development and production

Database

Flask-SQLAlchemy

Flask extension for SQLAlchemy integration

ORM

python-dotenv

Environment variable management for configuration

Config

Speech Recognition

Voice input/output processing for multilingual interactions

Voice

Modular Architecture

Clean, modular code structure for easy extension

Architecture

๐Ÿ“ฆ Installation Guide - Step by Step

โฑ๏ธ Installation Time: ~5 minutes

Follow these simple steps to set up the Fitness Coach Bot on your system.

๐Ÿ“‹ Prerequisites

๐Ÿ Python 3.8+

Python 3.8 or higher required for the educational platform

Download: Python

๐ŸŒ Web Browser

Modern web browser (Chrome, Firefox, Safari, Edge) for accessing the educational platform

Recommended: Latest version of Chrome or Firefox

๐Ÿ’พ Database Setup

SQLite database will be created automatically on first run (no external database required)

Note: For production, PostgreSQL or MySQL can be configured

๐ŸŒ Internet Connection

Required for Flask server and downloading dependencies

๐Ÿš€ Step-by-Step Installation

๐Ÿ“Œ Step 1: Download or Clone the Project

Option A: Download ZIP

  1. Download the project ZIP file from the repository
  2. Extract it to your desired location (e.g., C:\Projects\fitness-coach-bot or ~/Projects/fitness-coach-bot)
  3. Navigate to the extracted folder

Option B: Clone with Git

git clone https://github.com/rskworld/fitness-coach-bot.git
cd fitness-coach-bot
โœ… Step 2: Install Python Dependencies

Install required Python packages using pip.

# Install dependencies
pip install -r requirements.txt
๐Ÿ’พ Step 3: Initialize Database

Initialize the SQLite database with sample data including exercises, workout plans, and health tips.

# Initialize database with sample data
python init_db.py

This will create the SQLite database file (fitness_coach.db) and populate it with:

  • Sample exercises with categories and muscle groups
  • Pre-built workout plans for different fitness levels
  • Health tips across multiple categories
  • Database schema for users, progress, and workouts
๐Ÿš€ Step 4: Start the Flask Server

Start the Flask backend server by running app.py.

# Start Flask server
python app.py

# The server will start on http://localhost:5000
๐ŸŒ Step 5: Open Frontend

Open the HTML file in your browser or use a local web server.

Method 1: Direct File Opening

  1. Open index.html in your browser

Method 2: Using Local Web Server (Recommended)

# In a new terminal, start HTTP server
python -m http.server 8000

# Then open: http://localhost:8000

โœ… Installation Complete!

Congratulations! You've successfully set up the Fitness Coach Bot. The chatbot is ready to use with all features including:

  • AI-powered fitness coaching with personalized workout plans
  • Exercise database with detailed instructions and form tips
  • Progress tracking for workouts, streaks, and fitness goals
  • Nutrition advice tailored to your fitness objectives
  • Goal setting and achievement tracking
  • Health tips across multiple categories
  • User profile management with fitness information
  • Workout history and comprehensive analytics
  • Interactive chat interface with AI fitness coach

Next Steps:

  1. Ensure the Flask server is running (Step 4)
  2. Open the frontend in your browser (Step 5)
  3. Start chatting with the fitness coach to get workout plans and advice
  4. Explore all the features, exercises, workout plans, and fitness tracking!

๐Ÿ”ง Troubleshooting Installation

โŒ Database Issues

Solution: Ensure you've run python init_db.py to create the database. Check that the instance/fitness_coach.db file exists.

โŒ Flask Server Not Starting

Solution: Check Python version (3.8+), verify dependencies installed with pip install -r requirements.txt, ensure port 5000 is available.

โŒ Connection Errors

Solution: Verify Flask server is running on port 5000, check script.js has correct API_BASE_URL, ensure CORS is enabled in Flask.

โŒ Import Errors

Solution: Reinstall dependencies, check virtual environment is activated, verify all packages in requirements.txt are installed.

๐Ÿ“š Usage Guide - Step by Step

๐ŸŽฏ Getting Started with Fitness Coach Bot

Step-by-Step Usage Instructions

๐Ÿ“ Step 1: Start Backend Server

  1. Ensure Flask server is running: python run.py
  2. Check server status at http://localhost:5000
  3. You should see the Fitness Coach Bot interface

๐ŸŒ Step 2: Open Frontend

  1. Open http://localhost:5000 in your web browser
  2. You should see the Fitness Coach Bot interface with:
    • Chat messages area with markdown support
    • Text input field
    • Workout plan selection
    • Quick action buttons for common fitness questions
    • Features panel with chatbot capabilities
    • Statistics cards showing conversation stats
    • Send button

๐Ÿ’ฌ Step 3: Start Chatting

  1. Text Input: Type your fitness question or request and press Enter or click Send
  2. Workout Plans: Ask for personalized workout plans based on your goals
  3. Exercise Guidance: Get detailed instructions for specific exercises
  4. Try These:
    • "Hello! How are you?" (English)
    • "เคจเคฎเคธเฅเคคเฅ‡! เค†เคช เค•เฅˆเคธเฅ‡ เคนเฅˆเค‚?" (Hindi)
    • "Hola! ยฟCรณmo estรกs?" (Spanish)
    • "Translate: Hello world to Spanish"
    • "Create a beginner workout plan"
    • "What exercises target the chest?"
  5. View Responses: The fitness coach will provide personalized workout plans, exercise guidance, and fitness advice

โš™๏ธ Step 4: Explore Features

Try out the chatbot features:

  • Language Selection: Manually select your preferred language
  • Workout Plans: Request workout plans for different fitness levels
  • Progress Tracking: Track your workouts and fitness progress
  • Exercise Guidance: Get detailed instructions for specific exercises
  • Nutrition Advice: Ask for nutrition recommendations for your goals
  • Progress Tracking: Monitor your fitness progress and achievements

๐Ÿ’ป Using the Fitness Coach Bot

You can interact with the Fitness Coach Bot through the web interface:

# Example Interactions User: "Create a beginner workout plan" Bot: "Great decision to start your fitness journey! Here's a beginner-friendly workout plan..." User: "What exercises target the chest?" Bot: [List of chest exercises with detailed instructions] User: "What should I eat for muscle gain?" Bot: [Personalized nutrition recommendations for muscle gain] User: "How do I track my fitness progress?" Bot: [Comprehensive guide on tracking workouts, progress, and achievements] User: "Show me a full body workout" Bot: [Complete full body workout routine with exercises and sets]
# Quick Action Buttons - Beginner Plan: Get a beginner-friendly workout routine - Chest Exercises: View exercises targeting the chest - Nutrition: Get nutrition advice for your goals - Progress: Learn how to track fitness progress - Full Body: Get a complete full body workout - Health Tips: Receive health and wellness tips

๐Ÿ“Š Features Usage

๐Ÿ‹๏ธ Workout Plans

Get personalized workout routines tailored to your fitness level and goals - beginner, intermediate, or advanced

๐Ÿ’ช Exercise Guidance

Receive detailed exercise instructions with proper form techniques, muscle groups, and safety tips

๐Ÿ“Š Progress Tracking

Monitor your fitness journey with comprehensive tracking of workouts, streaks, and achievements

๐Ÿฅ— Nutrition Advice

Get personalized nutrition recommendations based on your fitness goals and activity level

๐ŸŽฏ Goal Setting

Set and track fitness objectives including weight loss, muscle gain, endurance, and flexibility

๐Ÿ’ก Health Tips

Receive randomized health and wellness advice across nutrition, exercise, recovery, and motivation

๐Ÿ“ˆ Analytics

View comprehensive fitness analytics including workout frequency, progress trends, and goal completion

๐Ÿ‘ค User Profiles

Store and manage your personal fitness information, goals, and preferences for personalized coaching

๐Ÿš€ Advanced Features & Capabilities

The Fitness Coach Bot includes advanced AI capabilities, workout generation, exercise database, and comprehensive fitness tracking. Here's what you can do:

๐Ÿค– AI Workout Generation

The bot excels at creating personalized workout plans based on your fitness level, goals, available equipment, and time constraints. Get custom routines tailored to your needs.

๐Ÿ’ช Exercise Database

Access an extensive collection of exercises with detailed instructions, proper form techniques, muscle groups targeted, equipment needed, and difficulty levels.

๐Ÿ“Š Comprehensive Tracking

Track your fitness journey with detailed analytics including workouts completed, streaks maintained, calories burned, goals achieved, and overall progress statistics.

๐Ÿฅ— Smart Nutrition

Receive personalized nutrition advice based on your fitness goals. Get recommendations for muscle gain, weight loss, endurance training, and general health.

๐Ÿ’ป Code Examples

Basic Fitness Coach Bot Integration

// Python Flask backend - app.py from flask import Flask, request, jsonify from models.fitness_models import db, User, Exercise, WorkoutPlan from utils.fitness_coach import FitnessCoach app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///fitness_coach.db' db.init_app(app) fitness_coach = FitnessCoach() @app.route('/api/chat', methods=['POST']) def chat(): data = request.json message = data.get('message', '') user_id = session.get('user_id', 'anonymous') # Get AI fitness coach response response = fitness_coach.get_response(message, user_id) return jsonify({ 'success': True, 'response': response, 'timestamp': datetime.now().isoformat() }) else: response = response_en return jsonify({ 'response': response, 'detected_language': detected_lang, 'confidence': language_detector.get_confidence() }) if __name__ == '__main__': app.run(debug=True, port=5000)

JavaScript Frontend Integration

// Frontend JavaScript - chatbot.js async function sendMessage(message, userLanguage = null) { const response = await fetch('http://localhost:5000/chat', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ message: message, language: userLanguage // Optional: let chatbot detect automatically }) }); const data = await response.json(); return { response: data.response, detectedLanguage: data.detected_language, languageName: data.language_name, confidence: data.confidence }; } // Usage sendMessage('Hello! How are you?').then(result => { console.log('Chatbot:', result.response); console.log('Detected Language:', result.detectedLanguage); console.log('Confidence:', result.confidence); });

Complete Fitness Coach Bot Example

// Fitness Coach Bot Class class FitnessCoachBot { constructor(apiUrl) { this.apiUrl = apiUrl || 'http://localhost:5000/api'; this.conversationHistory = []; this.userId = 'anonymous'; } async sendMessage(message) { const response = await fetch(`${this.apiUrl}/chat`, { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ message: message }) }); const data = await response.json(); // Update conversation history if (data.success) { this.conversationHistory.push( {role: 'user', content: message}, {role: 'assistant', content: data.response} ); } return { response: data.response, timestamp: data.timestamp }; } async getWorkoutPlans() { const response = await fetch(`${this.apiUrl}/workout-plans`); const data = await response.json(); return data.plans || []; } async getExercises(category = null, muscleGroup = null) { const params = new URLSearchParams(); if (category) params.append('category', category); if (muscleGroup) params.append('muscle_group', muscleGroup); const response = await fetch(`${this.apiUrl}/exercises?${params}`); const data = await response.json(); return data.exercises || []; } clearHistory() { this.conversationHistory = []; } } // Usage const fitnessBot = new FitnessCoachBot(); fitnessBot.sendMessage('Create a beginner workout plan').then(result => { console.log('Fitness Coach:', result.response); }); // Get exercises fitnessBot.getExercises('strength', 'chest').then(exercises => { console.log('Chest Exercises:', exercises); });

Configuration Example

// Frontend config - app.js const FitnessCoachConfig = { api: { baseUrl: 'http://localhost:5000/api', endpoints: { chat: '/chat', workoutPlans: '/workout-plans', exercises: '/exercises', userProfile: '/user/profile', progress: '/progress' } }, fitness: { categories: ['strength', 'cardio', 'flexibility', 'endurance'], goals: ['weight_loss', 'muscle_gain', 'endurance', 'general_health'], difficultyLevels: ['beginner', 'intermediate', 'advanced'] }, ui: { animationDuration: 300, messageDelay: 500, autoScroll: true } }; // Access configuration console.log(FitnessCoachConfig.fitness.categories);
# Backend config - config.py import os from dotenv import load_dotenv load_dotenv() class Config: SECRET_KEY = os.getenv('SECRET_KEY', 'fitness-coach-bot-2026-rskworld') SQLALCHEMY_DATABASE_URI = os.getenv('DATABASE_URL', 'sqlite:///fitness_coach.db') SQLALCHEMY_TRACK_MODIFICATIONS = False # Fitness categories EXERCISE_CATEGORIES = ['strength', 'cardio', 'flexibility', 'endurance'] MUSCLE_GROUPS = ['chest', 'back', 'shoulders', 'arms', 'legs', 'core'] FITNESS_GOALS = ['weight_loss', 'muscle_gain', 'endurance', 'general_health'] DIFFICULTY_LEVELS = ['beginner', 'intermediate', 'advanced']

๐Ÿ”— API Integration

Fitness Coach Bot API

The application uses Python Flask with SQLAlchemy for database operations and AI-powered fitness coaching. The backend handles workout plan generation, exercise database queries, progress tracking, and nutrition advice, while the frontend uses JavaScript for user interactions and real-time chat interface.

Available APIs & Technologies

API/Technology Type Description
Flask REST API Backend Python Flask server for fitness coaching endpoints
SQLAlchemy ORM Database Database operations for exercises, workouts, and user data
SQLite Database Database Lightweight database for storing fitness data
Fitness Coach Engine AI Module AI-powered workout plan generation and coaching
LocalStorage Browser API Store user settings and chat history
Exercise Database Data Comprehensive collection of exercises with instructions

Backend API Endpoints

# Flask Backend - app.py @app.route('/api/chat', methods=['POST']) def chat(): data = request.get_json() message = data.get('message', '') user_id = session.get('user_id', 'anonymous') # Get AI fitness coach response response = fitness_coach.get_response(message, user_id) return jsonify({ 'success': True, 'response': response, 'timestamp': datetime.now().isoformat() }) @app.route('/api/workout-plans', methods=['GET']) def get_workout_plans(): plans = WorkoutPlan.query.all() return jsonify({ 'success': True, 'plans': [plan.to_dict() for plan in plans] }) @app.route('/api/exercises', methods=['GET']) def get_exercises(): category = request.args.get('category') muscle_group = request.args.get('muscle_group') query = Exercise.query if category: query = query.filter_by(category=category) if muscle_group: query = query.filter_by(muscle_group=muscle_group) exercises = query.all() return jsonify({ 'success': True, 'exercises': [exercise.to_dict() for exercise in exercises] }) @app.route('/api/user/profile', methods=['GET', 'POST']) def user_profile(): if request.method == 'POST': # Save user profile data = request.get_json() # Update user profile logic return jsonify({'success': True}) else: # Get user profile user_id = session.get('user_id') # Retrieve user profile logic return jsonify({'success': True, 'profile': {}}) @app.route('/api/health', methods=['GET']) def health(): return jsonify({ 'status': 'healthy', 'database_configured': True })
// Frontend JavaScript - API Integration async function sendMessage(message, userLanguage = null) { try { const response = await fetch('http://localhost:5000/chat', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ message: message, language: userLanguage // null for auto-detection }) }); if (!response.ok) { throw new Error('API request failed'); } const data = await response.json(); return { response: data.response, detectedLanguage: data.detected_language, languageName: data.language_name, confidence: data.confidence }; } catch (error) { console.error('Error:', error); return {error: error.message}; } } // Detect language async function detectLanguage(text) { const response = await fetch('http://localhost:5000/detect_language', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({text: text}) }); return await response.json(); } // Translate text async function translateText(text, targetLanguage) { const response = await fetch('http://localhost:5000/translate', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ text: text, target_language: targetLanguage }) }); return await response.json(); }

Browser Compatibility

// Check Fitness Coach Bot API Connection async function checkHealth() { try { const response = await fetch('http://localhost:5000/api/health'); const data = await response.json(); console.log('Server Status:', data.status); console.log('Database Configured:', data.database_configured); return data.database_configured; } catch (error) { console.error('Health check failed:', error); return false; } } // Get workout plans async function getWorkoutPlans() { const response = await fetch('http://localhost:5000/api/workout-plans'); const data = await response.json(); return data.plans || []; } // Get exercises by category async function getExercisesByCategory(category) { const response = await fetch(`http://localhost:5000/api/exercises?category=${category}`); const data = await response.json(); return data.exercises || []; } // Recommended setup: // - Backend: Python 3.8+ with Flask, SQLAlchemy, SQLite // - Frontend: Modern browsers (Chrome, Edge, Safari, Firefox) // - Database: SQLite for development, PostgreSQL for production // - Dependencies: flask, flask-sqlalchemy, sqlalchemy

โš™๏ธ Configuration

Configuration in this application is handled through environment variables and settings files:

Database Configuration

The Fitness Coach Bot uses SQLite database by default. No external API keys required!

# Database will be created automatically # Just run: python init_db.py # For production, you can configure PostgreSQL/MySQL in config.py: # SQLALCHEMY_DATABASE_URI = 'postgresql://user:pass@localhost/fitness_db' # Optional environment variables: FLASK_ENV=development SECRET_KEY=your-secret-key-here PORT=5000

Note: The database is initialized automatically when you run python init_db.py. No external API keys needed!

Python Configuration (config.py)

The config.py file contains configuration settings:

# config.py import os class Config: SECRET_KEY = os.getenv('SECRET_KEY', 'fitness-coach-bot-2026-rskworld') SQLALCHEMY_DATABASE_URI = os.getenv('DATABASE_URL', 'sqlite:///fitness_coach.db') SQLALCHEMY_TRACK_MODIFICATIONS = False # Fitness categories EXERCISE_CATEGORIES = ['strength', 'cardio', 'flexibility', 'endurance'] MUSCLE_GROUPS = ['chest', 'back', 'shoulders', 'arms', 'legs', 'core'] FITNESS_GOALS = ['weight_loss', 'muscle_gain', 'endurance', 'general_health'] DIFFICULTY_LEVELS = ['beginner', 'intermediate', 'advanced']

Frontend Configuration

Edit app.js to configure API endpoint:

// app.js const API_BASE_URL = 'http://localhost:5000/api'; // Fitness categories const EXERCISE_CATEGORIES = ['strength', 'cardio', 'flexibility', 'endurance']; const MUSCLE_GROUPS = ['chest', 'back', 'shoulders', 'arms', 'legs', 'core']; const FITNESS_GOALS = ['weight_loss', 'muscle_gain', 'endurance', 'general_health']; const DIFFICULTY_LEVELS = ['beginner', 'intermediate', 'advanced'];

Browser LocalStorage Settings

User settings are automatically saved to browser's local storage:

// Settings are saved automatically localStorage.setItem('chatbotSettings', JSON.stringify({ model: 'gpt-3.5-turbo', maxTokens: 1024, temperature: 0.7, language: 'en', autoDetectLanguage: true, culturalAdaptation: true, voiceEnabled: false })); // Load settings const settings = JSON.parse(localStorage.getItem('chatbotSettings'));

Runtime Configuration

Configure settings through the web interface:

  • Language: Select preferred language (12+ languages supported)
  • Auto-detect Language: Enable/disable automatic language detection
  • Cultural Adaptation: Enable/disable cultural adaptation of responses
  • Voice Input/Output: Enable/disable voice functionality
  • Exercise Guidance: Get detailed instructions for exercises
  • Progress Tracking: Monitor your fitness progress and achievements

All settings are saved automatically and persist across browser sessions.

๐Ÿ“ Project Structure

The Fitness Coach Bot follows a clean, organized structure for easy navigation and maintenance.

fitness-coach-bot/
โ”œโ”€โ”€ fitness-coach-bot/
โ”‚   โ”œโ”€โ”€ templates/
โ”‚   โ”‚   โ””โ”€โ”€ index.html      # Main HTML interface
โ”‚   โ”œโ”€โ”€ static/
โ”‚   โ”‚   โ”œโ”€โ”€ css/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ style.css   # Modern styling
โ”‚   โ”‚   โ””โ”€โ”€ js/
โ”‚   โ”‚       โ””โ”€โ”€ app.js      # Frontend logic
โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”‚   โ””โ”€โ”€ fitness_models.py  # Database models
โ”‚   โ”œโ”€โ”€ utils/
โ”‚   โ”‚   โ”œโ”€โ”€ fitness_coach.py   # Core AI coaching engine
โ”‚   โ”‚   โ”œโ”€โ”€ ai_workout_generator.py  # Workout generation
โ”‚   โ”‚   โ”œโ”€โ”€ nutrition_ai.py   # Nutrition advice
โ”‚   โ”‚   โ”œโ”€โ”€ analytics_engine.py  # Progress analytics
โ”‚   โ”‚   โ””โ”€โ”€ ...              # Other utilities
โ”‚   โ”œโ”€โ”€ app.py              # Flask backend server
โ”‚   โ”œโ”€โ”€ config.py           # Configuration settings
โ”‚   โ”œโ”€โ”€ init_db.py          # Database initialization
โ”‚   โ””โ”€โ”€ requirements.txt    # Python dependencies
โ”œโ”€โ”€ demo/
โ”‚   โ”œโ”€โ”€ index.html          # Documentation page
โ”‚   โ”œโ”€โ”€ demo.html           # Interactive demo
โ”‚   โ”œโ”€โ”€ style.css           # Demo styling
โ”‚   โ””โ”€โ”€ script.js           # Demo scripts
โ”œโ”€โ”€ instance/
โ”‚   โ””โ”€โ”€ fitness_coach.db    # SQLite database
โ””โ”€โ”€ README.md               # Project documentation

๐Ÿ“„ Frontend Files

Location: fitness-coach-bot/templates/ and fitness-coach-bot/static/

  • templates/index.html - Main UI interface with chat
  • static/css/style.css - Modern gradient styling
  • static/js/app.js - JavaScript functionality

๐Ÿ Backend Files

Location: fitness-coach-bot/

  • app.py - Flask server & API endpoints
  • config.py - Configuration settings
  • init_db.py - Database initialization script
  • models/fitness_models.py - Database models
  • utils/fitness_coach.py - Core AI coaching engine
  • utils/ai_workout_generator.py - Workout generation
  • utils/nutrition_ai.py - Nutrition advice module

โš™๏ธ Configuration

Setup: Configure these files for your environment

  • config.py - Application configuration
  • requirements.txt - Python dependencies
  • init_db.py - Database setup script

๐Ÿ”ง Troubleshooting

Database Issues

  • Ensure you've run python init_db.py to create the database
  • Check that the instance/fitness_coach.db file exists
  • Verify SQLAlchemy is properly installed: pip install flask-sqlalchemy
  • Check database permissions if using SQLite
  • For production, configure PostgreSQL or MySQL in config.py
  • Restart the Flask server after database changes

Flask Server Issues

  • Server not starting: Check Python version (3.8+), verify dependencies installed with pip install -r requirements.txt
  • Port 5000 in use: Change port in .env file or stop other applications using port 5000
  • Import errors: Ensure virtual environment is activated, reinstall dependencies
  • CORS errors: Verify Flask-CORS is installed and enabled in app.py
  • Connection refused: Check firewall settings, ensure server is running on correct port

Frontend Connection Issues

  • Failed to fetch: Ensure Flask server is running, check API_BASE_URL in chatbot.js
  • CORS errors: Make sure Flask-CORS is installed and configured in backend
  • Server offline indicator: Check server status at http://localhost:5000
  • Port mismatch: Verify frontend API_BASE_URL matches backend port
  • Database not found: Run python init_db.py to create the database
  • Exercise data missing: Ensure init_db.py ran successfully and populated sample data

Common Issues

  • Database not found: Run python init_db.py to create and populate the database
  • Module not found: Install dependencies with pip install -r requirements.txt
  • SQLAlchemy errors: Ensure flask-sqlalchemy is installed: pip install flask-sqlalchemy
  • Database connection errors: Check database file permissions and path in config.py
  • No exercises showing: Verify init_db.py ran successfully and populated sample data
  • Workout plans not loading: Check database has workout plan data, re-run init_db.py if needed
  • Import errors: Ensure all Python modules are in correct directories (models/, utils/)

๐Ÿ“‹ Requirements

Backend Requirements: - Python 3.8 or higher - Flask web framework - SQLAlchemy ORM - Flask-SQLAlchemy extension - SQLite database (included with Python) Frontend Requirements: - Modern Web Browser (Chrome, Edge, Safari, Firefox) - JavaScript ES6+ support - LocalStorage API - Bootstrap 5 (via CDN) Database Requirements: - SQLite (included, no setup needed) - For production: PostgreSQL or MySQL (optional) Python Dependencies (see requirements.txt): - flask - flask-sqlalchemy - sqlalchemy - werkzeug - jinja2 Optional Dependencies: - PostgreSQL/MySQL drivers for production databases - Additional Python packages as needed

Browser Compatibility: Chrome, Edge, Safari, or Firefox - all modern browsers supported.

Python Version: Python 3.8 or higher required for backend server.

Database: SQLite included with Python - no external database setup required!

๐ŸŽฏ Use Cases

๐Ÿ‹๏ธ Personal Training

AI-powered personal fitness trainer available 24/7 for workout plans and exercise guidance

๐Ÿ’ช Fitness Apps

Integrate fitness coaching capabilities into mobile and web fitness applications

๐Ÿฅ Health Platforms

Fitness coaching chatbot for health platforms and wellness applications

๐Ÿ“ฑ Mobile Fitness

On-the-go fitness coaching with workout plans and progress tracking for mobile users

๐ŸŒ Website Integration

Add fitness coaching chat support to websites and health platforms

๐Ÿ“Š Analytics & Insights

Track workout statistics, progress trends, and fitness metrics for comprehensive analytics

๐ŸŽฏ Goal Achievement

Help users set and achieve fitness goals with personalized coaching and progress tracking

๐Ÿ‘ฅ Collaboration

Multi-user chat rooms with multilingual support for team collaboration

๐Ÿ’ฌ Support

For support, questions, or more projects:

๐Ÿ“„ License

This project is provided as-is for educational and development purposes.

MIT License - See LICENSE file for details.