A modern, full-stack fitness tracking application built with the MERN stack (MongoDB, Express.js, React, Node.js) that helps users monitor their workouts, nutrition, and overall fitness progress in one centralized platform.
- Exercise Library: Comprehensive database of exercises with detailed instructions and muscle group targeting
- Workout Creation: Create custom workout routines or choose from pre-built templates
- Workout Logging: Track completed workouts with sets, reps, weights, and duration
- Progress Tracking: Monitor workout frequency, intensity, and improvements over time
- Smart Recommendations: workout suggestions based on fitness level and preferences
- Meal Logging: Track daily meals with detailed nutritional information
- Calorie Counting: Monitor daily caloric intake and macronutrient distribution
- Water Intake: Keep track of daily hydration levels
- Nutrition Statistics: Comprehensive reports on eating habits and nutritional goals
- Food Database: Extensive nutrition database with common foods and custom entries
- SMART Goals: Set specific, measurable fitness and nutrition goals
- Progress Monitoring: Real-time tracking of goal completion
- Achievement Notifications: Automated alerts when goals are reached
- Goal Analytics: Detailed insights into goal performance and trends
- Interactive Charts: Visual representation of fitness progress over time
- Progress Photos: Before/after photo comparisons with timeline view
- Body Measurements: Track weight, body fat percentage, and body measurements
- Performance Analytics: Detailed statistics on workout performance and nutrition
- Workout Reminders: Automated daily workout notifications
- Nutrition Alerts: Reminders to log meals and stay hydrated
- Goal Milestones: Celebrations when fitness goals are achieved
- System Announcements: Important updates and tips from administrators
- Secure Registration: Multi-step user registration with email verification
- JWT Authentication: Token-based authentication with refresh tokens
- Password Reset: Secure password reset via email with time-limited tokens
- Email Notifications: Professional HTML email templates for password reset and confirmations
- Account Security: Password strength validation and secure password hashing
- Profile Customization: Personalized user profiles with preferences
- Dark/Light Mode: Theme switching for optimal user experience
- Measurement Units: Support for both metric and imperial units
- Privacy Controls: Granular notification and privacy settings
- Password Management: Change password functionality with current password verification
- User Management: Monitor and manage user accounts
- Content Management: Add/edit exercises, workouts, and nutrition items
- Analytics Dashboard: Platform-wide statistics and user engagement metrics
- System Announcements: Send targeted notifications to user groups
- React 19.1.0: Modern UI library with hooks and context
- Tailwind CSS: Utility-first CSS framework for responsive design
- React Router: Client-side routing and navigation
- React Hook Form: Performant forms with easy validation
- Chart.js: Interactive data visualization
- Axios: HTTP client for API requests
- Vite: Fast build tool and development server
- Lucide React: Modern icon library
- Node.js: JavaScript runtime environment
- Express.js: Web application framework
- MongoDB: NoSQL database for flexible data storage
- Mongoose: MongoDB object modeling for Node.js
- JWT: JSON Web Tokens for secure authentication
- bcrypt: Password hashing and security
- Nodemailer: Email sending for password reset functionality
- Multer: File upload handling
- node-cron: Scheduled task automation
- crypto: Secure token generation for password reset
- Docker: Containerization for consistent deployments
- ESLint: Code linting and quality assurance
- Prettier: Code formatting standardization
- Husky: Git hooks for pre-commit checks
- Morgan: HTTP request logging
fittrack/
โโโ client/ # React frontend application
โ โโโ src/
โ โ โโโ components/ # Reusable UI components
โ โ โ โโโ admin/ # Admin-specific components
โ โ โ โโโ auth/ # Authentication components
โ โ โ โโโ dashboard/ # Dashboard widgets
โ โ โ โโโ goals/ # Goal management
โ โ โ โโโ nutrition/ # Nutrition tracking
โ โ โ โโโ profile/ # User profile management
โ โ โ โโโ progress/ # Progress visualization
โ โ โ โโโ ui/ # Shared UI components
โ โ โ โโโ workout/ # Workout management
โ โ โโโ contexts/ # React Context providers
โ โ โโโ services/ # API service functions
โ โ โโโ utils/ # Utility functions
โ โโโ public/ # Static assets
โ โโโ package.json # Frontend dependencies
โ
โโโ server/ # Node.js backend application
โ โโโ controllers/ # Request handlers and business logic
โ โโโ models/ # Mongoose database models
โ โโโ routes/ # API route definitions
โ โโโ middleware/ # Custom middleware functions
โ โโโ services/ # Background services and schedulers
โ โโโ utils/ # Server utility functions
โ โโโ seeder/ # Database seeding scripts
โ โโโ uploads/ # File upload storage
โ โโโ documentation/ # API and technical documentation
โ
โโโ docker-compose.yml # Docker container orchestration
โโโ .env.example # Environment variables template
โโโ README.md # Project documentation
- Node.js (v16 or higher)
- npm or yarn
- MongoDB (local installation or MongoDB Atlas)
- Git
- Gmail Account (for email functionality, optional for development)
-
Clone the Repository
git clone https://github.com/yourusername/fittrack.git cd fittrack -
Install Root Dependencies
# Install root dependencies (Husky, lint-staged, etc.) npm install -
Backend Setup
cd server npm install -
Environment Configuration
# Copy the example environment file cp .env.example .envEdit the
.envfile with your configuration:# Server Configuration PORT=8001 NODE_ENV=development # Database MONGODB_URI=mongodb://localhost:27017/fittrack # JWT Secrets (Generate secure random strings for production) JWT_SECRET=your_super_secure_jwt_secret_key_here REFRESH_TOKEN_SECRET=your_refresh_token_secret_key_here # Email Configuration (Optional for development) EMAIL_SERVICE=gmail EMAIL_FROM=your-email@gmail.com EMAIL_PASSWORD=your-gmail-app-password FROM_NAME=FitTrack Pro # Client URL for password reset links CLIENT_URL=http://localhost:5173
-
Email Setup (Optional)
For password reset functionality with real emails:
- Enable 2-Factor Authentication on your Gmail account
- Generate an App Password in Google Account settings
- Use the App Password (not your regular password) in
EMAIL_PASSWORD
For development without real emails, the system will use Ethereal Email for testing.
-
Database Seeding (Optional)
# Seed database with sample data npm run seed # Reset all seed data npm run seed:destroy
-
Start Backend Server
# Development mode with auto-reload npm run dev # Production mode npm start
-
Frontend Setup
cd ../client npm install -
Frontend Environment Configuration
Create a
.envfile in the client directory:VITE_API_URL=http://localhost:8001/
-
Start Frontend Development Server
npm run dev
-
Access the Application
- Frontend: http://localhost:5173
- Backend API: http://localhost:8001/api
For a containerized setup using Docker:
# Build and start all services
docker-compose up --build
# Run in detached mode
docker-compose up -d
# Stop all services
docker-compose downThe application will be available at http://localhost:80
After seeding the database, you can use these credentials:
Admin Account:
- Email:
admin@fittrack.com - Password:
password123
Test User Accounts:
- Email:
john@example.com| Password:password123 - Email:
jane@example.com| Password:password123
POST /api/auth/register- User registrationPOST /api/auth/login- User loginPOST /api/auth/refresh-token- Token refreshGET /api/auth/me- Get current userPUT /api/auth/password- Change password (authenticated users)POST /api/auth/forgot-password- Request password resetPOST /api/auth/verify-reset-token- Verify reset tokenPOST /api/auth/reset-password- Reset password with token
- Workouts:
/api/workouts- CRUD operations for workouts - Exercises:
/api/exercises- Exercise library management - Nutrition:
/api/nutrition- Nutrition logging and tracking - Goals:
/api/goals- Goal setting and progress tracking - Profile:
/api/profiles- User profile and measurements - Notifications:
/api/notifications- Notification management
- User Management:
/api/admin/users- User administration - Analytics:
/api/admin/analytics- Platform statistics - Content Management: Various admin endpoints for content
For detailed API documentation, see the API Documentation.
- Request Reset: User enters email on forgot password page
- Email Sent: System sends professional HTML email with reset link
- Token Verification: Frontend verifies token before showing reset form
- Password Reset: User sets new password with validation
- Confirmation: Confirmation email sent after successful reset
- Professional Templates: Beautiful HTML email templates
- Development Testing: Ethereal Email for development testing
- Production Ready: Gmail SMTP for production use
- Security: Time-limited tokens (10 minutes expiry)
- Error Handling: Graceful fallbacks and detailed logging
- Password Hashing: bcrypt with salt rounds
- JWT Tokens: Access and refresh token system
- Token Validation: Comprehensive token verification
- Password Strength: Client and server-side validation
- Secure Reset: Cryptographically secure reset tokens
# Run backend tests
cd server
npm test
# Run frontend tests
cd client
npm test
# Run linting
npm run lint
# Format code
npm run format
# Test password reset flow
# 1. Register a new user
# 2. Use forgot password feature
# 3. Check email (or console logs for Ethereal)
# 4. Complete password reset
# 5. Login with new passwordBackend:
cd server
npm run build
npm startFrontend:
cd client
npm run build
npm run previewEnsure the following environment variables are set in production:
NODE_ENV=production
MONGODB_URI=your_production_mongodb_uri
JWT_SECRET=your_production_jwt_secret
REFRESH_TOKEN_SECRET=your_production_refresh_secret
EMAIL_SERVICE=sendgrid
SENDGRID_USERNAME=apikey
SENDGRID_PASSWORD=your_sendgrid_api_key
CLIENT_URL=https://your-production-domain.comFor production, consider using:
- SendGrid: Reliable email delivery service
- AWS SES: Amazon's email service
- Mailgun: Developer-friendly email API
- Postmark: Transactional email service
We welcome contributions! Please follow these steps:
- Fork the Repository
- Create a Feature Branch
git checkout -b feature/amazing-feature
- Make Your Changes
- Commit Your Changes
git commit -m 'Add some amazing feature' - Push to the Branch
git push origin feature/amazing-feature
- Open a Pull Request
- Follow the existing code style and linting rules
- Write comprehensive tests for new features
- Update documentation for API changes
- Use meaningful commit messages
- Ensure all tests pass before submitting
- Test email functionality with both Ethereal and real email services
- React - Frontend framework
- Express.js - Backend framework
- MongoDB - Database
- Tailwind CSS - CSS framework
- Chart.js - Data visualization
- Nodemailer - Email sending
- React Hook Form - Form handling
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Join our community discussions
- Password reset functionality with email
- Professional email templates
- Multi-step user registration
- Mobile application (React Native)
- Social features and community
- Integration with fitness wearables
- Advanced AI-powered recommendations
- Meal planning and recipe suggestions
- Workout video integration
- Multi-language support
- Two-factor authentication
- Social login (Google, Facebook)
Built with โค๏ธ by the FitTrack Team
Start your fitness journey today with FitTrack - where every workout counts and every goal is achievable!