FitLogic - Smart Gym Trainer System ποΈββοΈπͺ
FitLogic is an intelligent web-based fitness application that acts as your personal gym trainer. It uses an AI-driven decision engine to analyze performance, prevent overtraining, balance muscle groups, and generate adaptive workouts in real-time. Works 100% offline with browser SQLite persistence.
β¨ Key Features Smart Decision Engine (js/rule-engine.js): Detects overtraining, workout imbalances, plateaus, and suggests optimal adjustments. AI Chatbot (js/chatbot.js): 24/7 fitness assistant powered by DeepSeek API (api/deepseek-chat.php). Progressive Workouts (js/workout-generator.js): Personalized plans based on sleep, stress, recovery, and goals. Recovery Tracking: Monitors fatigue patterns and recommends deloads/active recovery. SQLite Database (js/sql-db.js): Offline-first storage for workouts, history, settings with localStorage migration. Performance Analytics (js/charts.js, js/fitness-score.js): Visual progress tracking and fitness scoring. PWA Support (sw.js): Full offline capability, installable app. Responsive Design: Mobile-first UI with dark theme, animations (css/animations.css). Indian Nutrition Integration (nutrition.html). Injury Mode (injury-mode.html): Safe progression post-injury (40% β 55% β 70% intensity). π οΈ Tech Stack Category Technologies Frontend HTML5, Vanilla JS (ES modules), Bootstrap 5, Chart.js, Font Awesome Database sql.js (SQLite in browser), localStorage fallback Build/Tools ESLint (linting), Service Worker (PWA) Backend PHP (chat API only), fully client-side otherwise Other Responsive CSS Grid/Flexbox, CSS animations No Node.js server required - Pure static site!
π File Structure fitlogic/ βββ index.html # Landing page & demo βββ login.html # Authentication βββ dashboard.html # Main app dashboard βββ workout.html # Workout generator βββ history.html # Workout history (SQLite) βββ nutrition.html # Nutrition tracker βββ settings.html # User settings βββ injury-mode.html # Injury recovery mode βββ api/ β βββ deepseek-chat.php # AI Chatbot API βββ css/ β βββ style.css β βββ auth.css β βββ responsive.css β βββ animations.css βββ js/ β βββ main.js # Core app logic β βββ rule-engine.js # Decision making core β βββ workout-generator.js β βββ sql-db.js # SQLite database β βββ sql-db-fixed.js β βββ charts.js β βββ chatbot.js β βββ fitness-score.js β βββ offline-sync.js β βββ functions.js βββ assets/images/ # Screenshots & icons βββ sw.js # Service Worker βββ package.json # ESLint config βββ TODO.md # Current tasks βββ TODO_SQLite.md # DB implementation notes π Quick Start Live Demo: Open index.html in any modern browser (Chrome/Firefox recommended). Development Server (optional): npx serve . Install as PWA: Click install icon in browser address bar. Offline Mode: Fully functional without internet (except chatbot). No installation required - Zero dependencies for runtime!
π§ͺ Development & Testing
npx eslint js/
npx eslint js/ --fix
npx lighthouse . --view Current Status See TODO.md for ongoing cleanup (ESLint fixes, console.log removal). SQLite implementation complete: TODO_SQLite.md.
π± Screenshots Dashboard Decision Engine Workout Generator Dashboard Decision Engine Workout π€ Smart Features Demo Real Workout Decision Logic (from js/rule-engine.js):
IF sleep < 5h β reduce intensity 30%, increase rest 20% IF chest > 3 sessions β lock chest 48h, suggest back/mobility IF performance drop β active recovery + deload week Try the live demo on index.html#demo.
π Database Schema (SQLite) Table Purpose users User profiles & goals workouts Completed sessions user_settings Equipment, preferences meal_logs Nutrition tracking fitness_scores Performance metrics Auto-migrates from localStorage on first load.
π Pages Overview dashboard.html: Main hub with charts & fitness score workout.html: Generate & log workouts history.html: Past workouts (paginated) nutrition.html: Meal planning settings.html: Customize app feedback.html: User feedback injury-mode.html: Post-injury protocols π€ Contributing Fork the repo Run npx eslint js/ --fix Create feature branch Test offline functionality Submit PR π License MIT License - Use freely for personal/commercial projects.
π Support Issues: Create GitHub issue Chatbot: Built-in AI assistant Demo: Live Preview Built with β€οΈ for fitness enthusiasts. Train smart, not hard! πͺ
Status: Production-ready β’ Offline-first β’ PWA-compliant