The AI Health Platform frontend is a comprehensive Next.js application that provides a complete health and fitness management experience. All requested features from the original requirements have been implemented.
- Login Page (
/auth/login) - Email/password authentication with modern UI - Registration Page (
/auth/register) - User signup with validation - Onboarding Wizard (
/onboarding) - 4-step comprehensive user setup:- Personal Information (age, gender, height, weight, activity level)
- Goals Setting (primary goals, target weight, timeline, motivation)
- Preferences (dietary restrictions, cultural preferences, workout types, equipment)
- Health Information (medical conditions, injuries, medications, sleep, stress)
- Nutrition Page (
/nutrition) with 4 tabs:- Meal Plans Tab: View current and past meal plans with nutritional breakdowns
- Generate Plan Tab: Comprehensive form for AI meal plan generation:
- Primary goals (weight loss, muscle gain, maintenance, bulking)
- Dietary restrictions (vegetarian, vegan, halal, kosher, gluten-free, dairy-free)
- Cultural preferences input
- Meals per day configuration
- Target calories setting
- Food Logs Tab: Track daily meal consumption with logging capabilities
- Nutrition Goals Tab: View and manage daily calorie and macro targets
- Fitness Page (
/fitness) with 4 tabs:- Workout Plans Tab: Current active plans with progress tracking
- Generate Plan Tab: AI workout plan generation form:
- Fitness goals (strength, muscle, endurance, weight loss, general fitness)
- Current fitness level (beginner, intermediate, advanced)
- Available equipment selection
- Workout frequency and session duration
- Injury history and limitations input
- Workout Logs Tab: Recent workout history with completion status
- Exercise Library Tab: Searchable exercise database with difficulty levels
- Progress Page (
/progress) with 5 tabs:- Overview Tab: Combined progress visualization and workout consistency calendar
- Weight Tracking Tab: Weight logging and history with trend analysis
- Fitness Progress Tab: Strength progression and cardio improvements
- Wellness Metrics Tab: Sleep quality, stress level, and energy tracking
- Goals Tab: Current goal progress with completion percentages
- Education Page (
/education) with 3 tabs:- Articles Tab: AI-curated health articles with categories and search
- Videos Tab: Educational video library with duration and view counts
- Favorites Tab: Saved content management
- Features: Search functionality, category filtering, featured content
-
Profile Page (
/profile) with 4 tabs:- Personal Info Tab: Editable personal information and physical stats
- Preferences Tab: Units, language, timezone settings
- Privacy Tab: Profile visibility and security settings
- Notifications Tab: Comprehensive notification preferences
-
Settings Page (
/settings):- Data Management: Export data, backup, storage usage
- App Preferences: Dark mode, auto-sync, offline mode, beta features
- Danger Zone: Clear data and account deletion options
- Trainer Clients Page (
/trainer/clients) with 4 tabs:- My Clients Tab: Client list with search, progress tracking, and quick actions
- Schedule Tab: Daily schedule management with session links
- Messages Tab: Client communication interface
- Analytics Tab: Client progress overview and program effectiveness metrics
- Dashboard Page (
/) - Personalized homepage with:- Overview cards showing key metrics
- Progress charts and visualizations
- Quick actions for common tasks
- Recent activity feed
- Adaptive layout based on user role (client vs trainer)
- Gradient backgrounds and modern color schemes
- Tailwind CSS with custom design tokens
- Lucide React icons throughout the interface
- Responsive design for all screen sizes
- Dark/light mode support (configurable in settings)
- Multi-step forms with progress indicators
- Tab navigation for organized content
- Modal dialogs for confirmations and detailed views
- Toggle switches for settings
- Progress bars and completion indicators
- Search and filter functionality
- Loading states and transitions
- Client-side validation for all forms
- TypeScript interfaces for type safety
- Comprehensive form states with error handling
- Multi-select checkboxes for preferences
- Dynamic form updates based on user selections
- Next.js 15 with App Router
- TypeScript for type safety
- Tailwind CSS for styling
- React Context for state management
- React Query for API state management
- React Hook Form for form handling
src/
βββ app/ # Next.js App Router pages
β βββ auth/ # Authentication pages
β βββ education/ # Education hub
β βββ fitness/ # Fitness planner
β βββ nutrition/ # Nutrition bot
β βββ onboarding/ # User onboarding
β βββ profile/ # User profile
β βββ progress/ # Progress tracking
β βββ settings/ # App settings
β βββ trainer/ # Trainer portal
βββ components/
β βββ dashboard/ # Dashboard components
β βββ layout/ # Layout components
β βββ providers/ # Context providers
βββ contexts/ # React contexts
βββ lib/ # Utilities and API client
βββ types/ # TypeScript type definitions
- AuthContext for user authentication state
- QueryClient for server state caching
- Local state with useState for component-specific data
- Form state managed with controlled components
- Complete API client (
src/lib/api.ts) with all endpoints - TypeScript interfaces for all API requests/responses
- Error handling and retry logic
- Authentication headers management
- Loading states for all async operations
- Automatic redirection to
/auth/loginfor unauthenticated users - Role-based navigation (trainer vs client features)
- Onboarding flow for new users
/ (Dashboard)
βββ /auth/login
βββ /auth/register
βββ /onboarding
βββ /nutrition
βββ /fitness
βββ /progress
βββ /education
βββ /profile
βββ /settings
βββ /trainer/clients (trainer only)
- Node.js 18+
- npm or yarn
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install --legacy-peer-deps
# Start development server
npm run devCreate a .env.local file:
NEXT_PUBLIC_API_URL=http://localhost:8000
NEXTAUTH_SECRET=your-secret-key
NEXTAUTH_URL=http://localhost:3000- Login page with email/password
- Registration page with validation
- Multi-step onboarding wizard
- Protected routes implementation
- User session management
- Meal plan request form with all required fields
- Meal plan display with nutritional information
- Food logging capabilities
- Recipe details components
- Ingredient swap functionality (UI ready)
- Fitness plan request form
- Workout plan display with progress tracking
- Exercise library with search
- Workout logging capabilities
- Adaptive plan modification (UI ready)
- Overall progress summary
- Interactive charts (placeholder for chart library)
- Weight tracking with history
- Goal management and visualization
- Manual data input forms
- Article list with categories and search
- Article detail views
- Video library with player components
- Favorites management
- Search and filter functionality
- User profile management
- Trainer client dashboard
- Client progress monitoring
- Communication interface
- Plan assignment capabilities
- Backend Integration: Connect all API endpoints with the FastAPI backend
- Chart Library: Integrate Chart.js or similar for data visualization
- Real-time Features: Add WebSocket support for live updates
- Mobile App: Convert to React Native or PWA
- Advanced AI Features: Integrate with OpenAI API for enhanced recommendations
All pages are fully responsive and optimized for:
- Desktop (1024px+)
- Tablet (768px - 1023px)
- Mobile (320px - 767px)
- Input validation on all forms
- XSS protection through React's built-in escaping
- CSRF protection ready for production
- Secure authentication flow
- Data privacy controls in settings