# Fitness Planner Implementation Roadmap

## Current Status: ~30% Complete (Infrastructure Only)

### Critical Priority (Blocking MVP)
- [ ] Replace hardcoded dashboard data with real personalized plans from questionnaire responses
- [ ] Build Workout Engine - NASM OPT model progression algorithm with 5 phases (Stabilization Endurance → Strength Endurance → Hypertrophy → Max Strength → Power)
- [ ] Create Exercise Library with demo videos/images and muscle group tagging
- [ ] Implement Smart Progression Logic - RiR tracking, auto-adjust reps/sets/load based on performance
- [ ] Implement BMR/TDEE Calculator with goal-based macros
- [ ] Create Nutrition Engine - culturally adaptive meal suggestions (African, Western, Asian, Mediterranean)
- [ ] Integrate Food Database APIs (USDA, Open Food Facts) with Redis caching for <10ms search
- [ ] Build AI Recommendation Engine for plateau detection and smart adjustments

### High Priority (Core Features)
- [ ] Build Cardio Engine - Cooper Test, VO2 Max estimation, personalized endurance benchmarks
- [ ] Build Meal Plan Generator with daily plans and weekly grocery list export
- [ ] Implement Barcode Scanner & OCR ingredient scanning readiness (API integration points)
- [ ] Add Water Tracker functionality
- [ ] Build Streak System and Achievement Badges
- [ ] Create Weekly Goals and Group Challenges features
- [ ] Integrate Apple Health and Google Fit APIs for steps, HR, sleep, calories
- [ ] Complete Admin Dashboard - user management, workout template editor, meal database editor, analytics, SEO controls
- [ ] Add Subscription Tier Logic (Free/Premium) with NextAuth and Stripe-ready structure

### Medium Priority (Enhancement)
- [ ] Implement Social Sharing and Community Leaderboard
- [ ] Add Progress Tracking with photo uploads
- [ ] Implement Dark/Light mode toggle
- [ ] Build Rest Timer functionality
- [ ] Add Favorite Meals saving
- [ ] Create Habit Builder module
- [ ] Add Recovery day plans
- [ ] Implement Smart reminders (Hook Model triggers)

### Low Priority (Nice to Have)
- [ ] Voice guidance for exercises
- [ ] High contrast accessibility mode
- [ ] Scalable fonts WCAG compliance
- [ ] Animated progress bars (partially done)
- [ ] Mobile app expansion readiness

## Known Gaps

### Backend
- No actual AI/ML service - just fake loading animation
- No Redis cache layer
- No real-time sync for wearable data
- No email service (nodemailer in devDependencies but unused)
- No payment processing (Stripe ready-structure needed)

### Frontend
- Dashboard shows hardcoded mock data, not user-specific
- No real-time updates
- No offline capability
- No PWA features

### Database
- Need user_profiles table for questionnaire data
- Need workout_logs table for tracking
- Need meal_logs table for nutrition tracking
- Need user_actions table for analytics (exists but unused)
- Need badges/achievements tables

## Next Immediate Steps
1. Update database schema to support questionnaire responses and workout/meal logs
2. Create backend API endpoints to generate personalized workout/meal plans from form data
3. Update dashboard page to fetch and display real data from API
4. Build exercise library data structure and seed data
5. Implement BMR/TDEE calculation utility
6. Create meal planning algorithm with cultural adaptation

## Files to Modify/Create
- `src/lib/db.ts` - Already exists, dual-mode support
- `src/app/api/workout/route.ts` - NEW: Generate workout plan
- `src/app/api/nutrition/route.ts` - NEW: Generate meal plan
- `src/app/api/user/profile/route.ts` - Update to save questionnaire responses
- `src/app/fitness-planner/dashboard/page.tsx` - Replace static data with API calls
- `src/lib/exercises.ts` - NEW: Exercise library data
- `src/lib/nutrition.ts` - NEW: BMR/TDEE and meal planning logic
- `database/schema.sql` & `schema_sqlite.sql` - Add new tables
- `setup_db.js` - Update to include new schema and seed data

## Tech Stack Decisions
- Keep Next.js 15 App Router
- Use existing dual-mode DB (MySQL primary, SQLite fallback)
- Redis recommended but can be added later (priority: medium)
- Food API: USDA FoodData Central (free) + Open Food Facts (open source)
- AI: Start with rule-based engine, upgrade to OpenAI/Claude API later

## Deployment Notes
- Already Docker-ready (docker-compose.yml present in EcommerceTemplate but need to adapt)
- Vercel-ready structure
- Environment variables: Already have DB config, need to add food API keys

Last Updated: 2026-05-10
Session Notes: Created comprehensive todo list from FITNESS PLANNER PRD. Identified 20 missing features. Critical path: dashboard data personalization, workout engine, nutrition engine, food API integration.
