Five Pillars Integration Guide
Last Updated: November 21, 2025
Purpose: Guide for integrating the 5 pillars (Mindset, Nutrition, Posture, Exercise, Energy Mastery) into Train5D platform
ποΈ The Five Pillars Framework
Train5D is built on 5 interconnected pillars that work together for holistic health transformation:
- π Mindset - Mental framework and goal alignment
- π₯ Nutrition - Fuel and nourishment β Implemented
- π§ Posture - Body alignment and movement quality
- πͺ Exercise - Physical training and conditioning β Implemented
- β‘ Energy Mastery - Sleep, recovery, and vitality optimization
Core Philosophy
Integration is the key. Each pillar influences and enhances the others. True transformation happens when all five work in harmony.
π Current Implementation Status
β Implemented Pillars (Backend Complete)
π₯ Nutrition (25 tables)
Database Structure: - Foods catalog with macros/micros - Food-health condition relationships - Herbs, spices, vitamins, minerals - Special diets and healing foods - Nutrient tracking
Content Management: - β Admin dashboard for food management - β Nutrition data CRUD operations - β Food search and filtering - π§ User-facing nutrition tracking (in progress)
πͺ Exercise (16 tables)
Database Structure: - Exercise catalog with taxonomy - Muscle groups and anatomical regions - Equipment and space requirements - Movement patterns and fiber types - Difficulty levels and progressions
Content Management: - β Admin dashboard for exercise management - β Exercise CRUD operations - β Media upload (images/videos) - π§ User-facing workout builder (planned)
π§ To Be Implemented
π Mindset (0 tables - needs design)
Proposed Features: - Goal setting and tracking - Journaling and reflection - Habit tracking - Mood and mental state logging - Mindset assessments - Affirmations and prompts
π§ Posture (0 tables - needs design)
Proposed Features: - Posture assessments - Alignment tracking - Corrective exercises - Ergonomics guidance - Movement quality scoring - Pain/discomfort tracking
β‘ Energy Mastery (0 tables - needs design)
Proposed Features: - Sleep tracking and analysis - Energy level monitoring (throughout day) - Recovery protocols - Stress management - Circadian rhythm optimization - Fatigue and vitality metrics
π― Integration Strategy
The Integration Model
π MINDSET (Goals, Beliefs, Habits)
β
βββββββββββ΄ββββββββββ
β β
π₯ NUTRITION π§ POSTURE πͺ EXERCISE
β β
βββββββββββ¬ββββββββββ
β
β‘ ENERGY MASTERY (Sleep, Recovery, Vitality)
β
[Integration Layer]
β
π User Dashboard & AI Insights
How They Connect
Mindset β All Pillars
- Goals influence exercise selection
- Beliefs affect nutrition choices
- Habits structure daily routines
- Mental state impacts energy and recovery
Nutrition βοΈ Exercise
- Macros support training goals
- Timing affects performance
- Recovery nutrition post-workout
- Energy availability for workouts
Posture βοΈ Exercise
- Movement quality in exercises
- Corrective exercises for alignment
- Form feedback based on posture assessment
- Exercise selection based on postural issues
Energy Mastery β All Pillars
- Exercise affects sleep quality
- Nutrition impacts energy levels
- Posture influences recovery
- Mindset affects stress and rest
Integration Layer (The Key!)
- Cross-pillar insights: βYour low energy might be due to insufficient protein (Nutrition) and late-night workouts (Exercise)β
- Holistic recommendations: AI considers all 5 pillars when making suggestions
- Progress tracking: Shows how pillars influence each other
- Personalization: Adjusts all pillars based on userβs complete profile
ποΈ Database Design for New Pillars
Mindset Tables
-- Core mindset tracking
CREATE TABLE mindset_entries (
id SERIAL PRIMARY KEY,
user_id UUID REFERENCES users(id) NOT NULL,
entry_date DATE NOT NULL,
entry_type VARCHAR(50) NOT NULL, -- 'journal', 'goal', 'reflection', 'mood'
content TEXT,
mood_score INTEGER CHECK (mood_score BETWEEN 1 AND 10),
energy_level INTEGER CHECK (energy_level BETWEEN 1 AND 10),
stress_level INTEGER CHECK (stress_level BETWEEN 1 AND 10),
tags JSONB, -- ['gratitude', 'challenge', 'breakthrough']
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Goals and intentions
CREATE TABLE mindset_goals (
id SERIAL PRIMARY KEY,
user_id UUID REFERENCES users(id) NOT NULL,
goal_text TEXT NOT NULL,
goal_type VARCHAR(50), -- 'nutrition', 'exercise', 'posture', 'energy', 'general'
target_date DATE,
status VARCHAR(20) DEFAULT 'active', -- 'active', 'completed', 'abandoned'
progress_percentage INTEGER DEFAULT 0,
milestones JSONB,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
completed_at TIMESTAMP
);
-- Habit tracking
CREATE TABLE mindset_habits (
id SERIAL PRIMARY KEY,
user_id UUID REFERENCES users(id) NOT NULL,
habit_name VARCHAR(200) NOT NULL,
habit_description TEXT,
frequency VARCHAR(50), -- 'daily', 'weekly', 'custom'
target_days JSONB, -- [1,2,3,4,5] for weekdays
related_pillar VARCHAR(50), -- 'nutrition', 'exercise', 'posture', 'energy'
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Daily habit check-ins
CREATE TABLE mindset_habit_logs (
id SERIAL PRIMARY KEY,
habit_id INTEGER REFERENCES mindset_habits(id) ON DELETE CASCADE,
log_date DATE NOT NULL,
completed BOOLEAN DEFAULT false,
notes TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UNIQUE(habit_id, log_date)
);
-- Affirmations and prompts
CREATE TABLE mindset_prompts (
id SERIAL PRIMARY KEY,
prompt_text TEXT NOT NULL,
prompt_category VARCHAR(50), -- 'morning', 'evening', 'motivation', 'reflection'
related_pillar VARCHAR(50),
is_active BOOLEAN DEFAULT true,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- User responses to prompts
CREATE TABLE mindset_prompt_responses (
id SERIAL PRIMARY KEY,
user_id UUID REFERENCES users(id) NOT NULL,
prompt_id INTEGER REFERENCES mindset_prompts(id),
response_text TEXT,
response_date DATE NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX idx_mindset_entries_user_date ON mindset_entries(user_id, entry_date);
CREATE INDEX idx_mindset_goals_user_status ON mindset_goals(user_id, status);
CREATE INDEX idx_mindset_habits_user ON mindset_habits(user_id);Posture Tables
-- Posture assessments
CREATE TABLE posture_assessments (
id SERIAL PRIMARY KEY,
user_id UUID REFERENCES users(id) NOT NULL,
assessment_date DATE NOT NULL,
assessment_type VARCHAR(50), -- 'full_body', 'upper_body', 'lower_body', 'specific_area'
overall_score INTEGER CHECK (overall_score BETWEEN 0 AND 100),
notes TEXT,
assessor VARCHAR(50) DEFAULT 'self', -- 'self', 'professional', 'ai'
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Specific posture findings
CREATE TABLE posture_findings (
id SERIAL PRIMARY KEY,
assessment_id INTEGER REFERENCES posture_assessments(id) ON DELETE CASCADE,
body_area VARCHAR(100) NOT NULL, -- 'head', 'shoulders', 'spine', 'hips', 'knees', 'feet'
finding_type VARCHAR(50), -- 'alignment', 'mobility', 'stability', 'pain'
severity VARCHAR(20), -- 'mild', 'moderate', 'severe'
description TEXT,
measurement_value NUMERIC, -- degrees, cm, etc.
measurement_unit VARCHAR(20),
requires_attention BOOLEAN DEFAULT false
);
-- Posture exercises (links to exercise_name table)
CREATE TABLE posture_exercise_prescriptions (
id SERIAL PRIMARY KEY,
assessment_id INTEGER REFERENCES posture_assessments(id),
exercise_id INTEGER REFERENCES exercise_name(id),
target_body_area VARCHAR(100),
priority INTEGER, -- 1 = highest
frequency VARCHAR(50), -- 'daily', '3x per week', etc.
sets INTEGER,
reps INTEGER,
duration_seconds INTEGER,
notes TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Daily posture check-ins
CREATE TABLE posture_daily_logs (
id SERIAL PRIMARY KEY,
user_id UUID REFERENCES users(id) NOT NULL,
log_date DATE NOT NULL,
overall_feeling INTEGER CHECK (overall_feeling BETWEEN 1 AND 10),
pain_areas JSONB, -- [{'area': 'lower_back', 'intensity': 7}]
exercises_completed JSONB, -- [exercise_id, exercise_id]
notes TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UNIQUE(user_id, log_date)
);
-- Ergonomics tracking
CREATE TABLE posture_ergonomics (
id SERIAL PRIMARY KEY,
user_id UUID REFERENCES users(id) NOT NULL,
workspace_type VARCHAR(50), -- 'desk', 'standing_desk', 'mobile', 'mixed'
desk_height_cm NUMERIC,
monitor_height_cm NUMERIC,
chair_type VARCHAR(100),
setup_photos JSONB, -- [{'url': 's3://...', 'description': 'desk setup'}]
issues_identified JSONB,
recommendations JSONB,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX idx_posture_assessments_user_date ON posture_assessments(user_id, assessment_date);
CREATE INDEX idx_posture_daily_logs_user_date ON posture_daily_logs(user_id, log_date);Energy Mastery Tables
-- Sleep tracking
CREATE TABLE energy_sleep_logs (
id SERIAL PRIMARY KEY,
user_id UUID REFERENCES users(id) NOT NULL,
sleep_date DATE NOT NULL, -- date user went to bed
bedtime TIME,
wake_time TIME,
total_hours NUMERIC,
quality_score INTEGER CHECK (quality_score BETWEEN 1 AND 10),
interruptions INTEGER DEFAULT 0,
sleep_environment JSONB, -- {'temperature': 68, 'darkness': 'good', 'noise': 'quiet'}
pre_sleep_routine JSONB, -- ['meditation', 'reading', 'no_screens']
wake_feeling VARCHAR(50), -- 'refreshed', 'groggy', 'tired', 'energized'
notes TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UNIQUE(user_id, sleep_date)
);
-- Energy levels throughout day
CREATE TABLE energy_daily_levels (
id SERIAL PRIMARY KEY,
user_id UUID REFERENCES users(id) NOT NULL,
log_date DATE NOT NULL,
time_of_day TIME NOT NULL,
energy_level INTEGER CHECK (energy_level BETWEEN 1 AND 10),
context VARCHAR(100), -- 'morning', 'post_workout', 'afternoon_slump', 'evening'
influencing_factors JSONB, -- ['coffee', 'workout', 'meal', 'stress']
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Recovery protocols
CREATE TABLE energy_recovery_activities (
id SERIAL PRIMARY KEY,
activity_name VARCHAR(200) NOT NULL,
activity_type VARCHAR(50), -- 'active_recovery', 'passive_rest', 'sleep', 'meditation'
description TEXT,
recommended_duration INTEGER, -- minutes
benefits JSONB,
is_active BOOLEAN DEFAULT true,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- User recovery logs
CREATE TABLE energy_recovery_logs (
id SERIAL PRIMARY KEY,
user_id UUID REFERENCES users(id) NOT NULL,
log_date DATE NOT NULL,
activity_id INTEGER REFERENCES energy_recovery_activities(id),
duration_minutes INTEGER,
effectiveness_score INTEGER CHECK (effectiveness_score BETWEEN 1 AND 10),
notes TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Stress and fatigue tracking
CREATE TABLE energy_stress_logs (
id SERIAL PRIMARY KEY,
user_id UUID REFERENCES users(id) NOT NULL,
log_date DATE NOT NULL,
stress_level INTEGER CHECK (stress_level BETWEEN 1 AND 10),
fatigue_level INTEGER CHECK (fatigue_level BETWEEN 1 AND 10),
mental_clarity INTEGER CHECK (mental_clarity BETWEEN 1 AND 10),
stressors JSONB, -- ['work', 'family', 'finances', 'health']
coping_strategies JSONB, -- ['exercise', 'meditation', 'talk_to_friend']
notes TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UNIQUE(user_id, log_date)
);
-- Circadian rhythm optimization
CREATE TABLE energy_circadian_profile (
id SERIAL PRIMARY KEY,
user_id UUID REFERENCES users(id) NOT NULL,
chronotype VARCHAR(50), -- 'lion', 'bear', 'wolf', 'dolphin'
peak_energy_time TIME,
ideal_bedtime TIME,
ideal_wake_time TIME,
light_exposure_schedule JSONB,
meal_timing_preferences JSONB,
exercise_timing_preferences JSONB,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UNIQUE(user_id)
);
CREATE INDEX idx_energy_sleep_logs_user_date ON energy_sleep_logs(user_id, sleep_date);
CREATE INDEX idx_energy_daily_levels_user_date ON energy_daily_levels(user_id, log_date);
CREATE INDEX idx_energy_stress_logs_user_date ON energy_stress_logs(user_id, log_date);π¨ User Dashboard Design
Dashboard Layout Structure
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Header: Welcome back, [Name]! π β
β Today's Focus: [Primary goal or challenge] β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββ¬ββββββββββββββββββββ¬ββββββββββββββββββ
β π MINDSET β π₯ NUTRITION β π§ POSTURE β
β β β β
β Today's Mood: π β Calories: 1,200/ β Check-in: β
β
β Goals on track: 3 β 2,000 β Pain: Low back β
β Habit streak: 7π₯ β Protein: 80/150g β Exercises: 2/5 β
β β Water: 6/8 cups β β
β [View Details] β [Log Meal] β [Log Session] β
βββββββββββββββββββββ΄ββββββββββββββββββββ΄ββββββββββββββββββ
βββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ
β πͺ EXERCISE β β‘ ENERGY MASTERY β
β β β
β Today's Workout: β Last Night Sleep: 7.5 hrs β
β β
Completed β Quality: 8/10 β
β β β
β Weekly Progress: β Energy Level: ββββββββββ 8/10 β
β 3/5 workouts β β
β β Recovery Status: Good π β
β [Start Workout] β [Log Sleep] β
βββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π€ AI INSIGHTS & RECOMMENDATIONS β
β β
β π Your low energy (6/10) may be related to: β
β β’ Insufficient protein (Nutrition) β
β β’ Late workout yesterday (Exercise) β
β β’ Poor sleep quality (Energy Mastery) β
β β
β π‘ Recommendations: β
β 1. Add 30g protein to lunch (Nutrition) β
β 2. Move workout to morning (Exercise) β
β 3. Bedtime routine at 10 PM (Energy Mastery) β
β β
β [Get Detailed Analysis] β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π QUICK ACTIONS β
β β
β [Log Today's Mood] [Add Meal] [Start Workout] β
β [Take Assessment] [View Progress] [Chat with AI Coach] β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Dashboard Components to Build
1. Overview Cards (5 Pillar Widgets)
// components/dashboard/PillarCard.tsx
interface PillarCardProps {
pillar: 'mindset' | 'nutrition' | 'posture' | 'exercise' | 'energy';
todayData: any;
quickActions: Action[];
}
// Each card shows:
// - Today's key metric
// - Status indicator (good/warning/attention)
// - Quick action button
// - Link to detailed view2. AI Insights Panel
// components/dashboard/AIInsightsPanel.tsx
// - Cross-pillar correlations
// - Personalized recommendations
// - Pattern detection
// - Actionable next steps3. Quick Action Bar
// components/dashboard/QuickActions.tsx
// - Most common user actions
// - Context-aware suggestions
// - One-tap logging4. Progress Overview
// components/dashboard/ProgressSummary.tsx
// - Weekly trends across all pillars
// - Goal completion status
// - Streak trackingπ Integration Implementation
Cross-Pillar Data Queries
// lib/integration/cross-pillar-insights.ts
/**
* Get holistic user profile with all 5 pillars
*/
export async function getUserHolisticProfile(userId: string, date: Date) {
const [mindset, nutrition, posture, exercise, energy] = await Promise.all([
getMindsetData(userId, date),
getNutritionData(userId, date),
getPostureData(userId, date),
getExerciseData(userId, date),
getEnergyData(userId, date)
]);
return {
mindset,
nutrition,
posture,
exercise,
energy,
integration: analyzeIntegration({
mindset,
nutrition,
posture,
exercise,
energy
})
};
}
/**
* Analyze how pillars influence each other
*/
function analyzeIntegration(data: AllPillarsData): Integration {
const insights: Insight[] = [];
// Example: Low energy + insufficient nutrition
if (data.energy.energyLevel < 5 && data.nutrition.proteinPercent < 70) {
insights.push({
type: 'correlation',
pillars: ['energy', 'nutrition'],
severity: 'medium',
message: 'Low energy may be related to insufficient protein intake',
recommendation: 'Increase protein by 30g today'
});
}
// Example: Poor sleep + late exercise
if (data.energy.sleepQuality < 6 && data.exercise.lastWorkoutTime > '19:00') {
insights.push({
type: 'correlation',
pillars: ['energy', 'exercise'],
severity: 'medium',
message: 'Late workouts may be affecting sleep quality',
recommendation: 'Try moving workouts to morning or early afternoon'
});
}
// Example: Posture pain + exercise form
if (data.posture.painAreas.includes('lower_back') &&
data.exercise.recentExercises.some(e => e.targets_lower_back)) {
insights.push({
type: 'correlation',
pillars: ['posture', 'exercise'],
severity: 'high',
message: 'Lower back pain may be related to exercise form',
recommendation: 'Review form for: ' + data.exercise.recentExercises.join(', ')
});
}
return {
insights,
overallScore: calculateIntegrationScore(data),
recommendations: generateHolisticRecommendations(data)
};
}AI Agent Integration
// lib/ai/agents/integration-agent.ts
export class IntegrationAgent extends BaseAgent {
/**
* Analyzes all 5 pillars and provides holistic insights
*/
async analyzeHolistic(userId: string): Promise<HolisticAnalysis> {
// Fetch last 7 days of data across all pillars
const profile = await getUserHolisticProfile(userId, new Date());
const prompt = `
Analyze this user's complete health profile across 5 pillars:
MINDSET:
- Mood average: ${profile.mindset.avgMood}/10
- Goals progress: ${profile.mindset.goalsCompleted}/${profile.mindset.totalGoals}
- Habit streak: ${profile.mindset.longestStreak} days
NUTRITION:
- Calories: ${profile.nutrition.avgCalories}
- Protein: ${profile.nutrition.avgProtein}g
- Meal timing consistency: ${profile.nutrition.consistency}%
POSTURE:
- Pain areas: ${profile.posture.painAreas.join(', ')}
- Corrective exercises completed: ${profile.posture.exercisesCompleted}%
- Overall alignment score: ${profile.posture.alignmentScore}/100
EXERCISE:
- Workouts completed: ${profile.exercise.workoutsCompleted}/week
- Total volume: ${profile.exercise.totalVolume}
- Recovery days: ${profile.exercise.recoveryDays}
ENERGY MASTERY:
- Avg sleep: ${profile.energy.avgSleep} hours
- Sleep quality: ${profile.energy.sleepQuality}/10
- Energy level: ${profile.energy.avgEnergy}/10
- Stress level: ${profile.energy.avgStress}/10
Provide:
1. Cross-pillar insights (how pillars affect each other)
2. Root cause analysis for any issues
3. Prioritized recommendations
4. Integration score (0-100)
`;
const result = await this.callAPI(prompt);
return this.parseResponse(result);
}
}π Implementation Roadmap Updates
Updated Phase 2: Content & User Experience (Weeks 5-12)
Weeks 5-6: Core Dashboard & Mindset (NEW)
Weeks 7-8: Posture System (NEW)
Weeks 9-10: Energy Mastery (NEW)
Weeks 11-12: Integration Layer (NEW - CRITICAL)
π― Priority Order
Phase 1: User Dashboard Foundation (Weeks 5-6)
Goal: User sees integrated view on login
- Dashboard Shell
- 5 pillar card layout
- Navigation structure
- Responsive design
- Mindset Pillar
- Database tables
- Basic goal setting
- Daily mood logging
- Habit tracking
- Data Integration Layer
- Connect existing nutrition data
- Connect existing exercise data
- Display in dashboard cards
Phase 2: Complete Remaining Pillars (Weeks 7-10)
Goal: All 5 pillars have data capture
- Posture (Weeks 7-8)
- Database + UI
- Link to exercise database
- Energy Mastery (Weeks 9-10)
- Database + UI
- Sleep tracking as priority
Phase 3: Integration Intelligence (Weeks 11-12)
Goal: AI insights across all pillars
- Cross-Pillar Analysis
- Correlation detection
- Pattern recognition
- Root cause analysis
- AI Integration Agent
- Holistic profile analysis
- Personalized recommendations
- Action prioritization
π Next Immediate Actions
This Week (Week 1)
Week 2
Week 3
Week 4
π Technical Notes
API Endpoints Needed
// Dashboard data aggregation
GET /api/dashboard/overview // All 5 pillars summary
GET /api/dashboard/insights // AI-generated insights
// Mindset endpoints
POST /api/mindset/goals // Create goal
GET /api/mindset/goals // List goals
POST /api/mindset/mood // Log mood
POST /api/mindset/habits // Create habit
POST /api/mindset/habits/:id/log // Log habit completion
POST /api/mindset/journal // Create journal entry
// Posture endpoints
POST /api/posture/assessment // Create assessment
GET /api/posture/assessments // List assessments
POST /api/posture/daily-log // Daily check-in
GET /api/posture/exercises // Get prescribed exercises
// Energy endpoints
POST /api/energy/sleep // Log sleep
POST /api/energy/energy-level // Log energy level
POST /api/energy/stress // Log stress/fatigue
GET /api/energy/circadian-profile // Get profile
POST /api/energy/recovery // Log recovery activity
// Integration endpoints
GET /api/integration/holistic-profile // Complete user profile
GET /api/integration/correlations // Cross-pillar insights
POST /api/integration/ai-analysis // Request AI analysisDatabase Migrations
# Run these in order
node scripts/database/migrate-mindset-tables.js
node scripts/database/migrate-posture-tables.js
node scripts/database/migrate-energy-tables.js
node scripts/database/migrate-integration-views.jsβ Definition of Done
Dashboard is βCompleteβ when:
Integration is βCompleteβ when:
Document Version: 1.0
Last Updated: November 21, 2025
Next Review: December 1, 2025
Owner: Train5D Development Team
π― Remember
Integration is the key. The power of Train5D is not in individual pillars, but in how they work together. Every feature should consider cross-pillar impact. Every AI recommendation should be holistic. Every user action should update the integrated view.
Build for integration from day one. π