A comprehensive full-stack health tracking application built with React and Node.js that helps users monitor and manage their health metrics, set goals, and visualize their progress.
- Weight Monitoring: Track your weight over time with historical records
- Nutrition Logging: Record meals with detailed macronutrient information (calories, protein, carbs, fat)
- Exercise Tracking: Log workouts with duration, calories burned, and distance
- Sleep Monitoring: Track sleep duration and quality
- Vital Signs: Record blood pressure, heart rate, and body temperature
- Interactive charts showing weight trends, nutrition patterns, and exercise activity
- Dashboard with real-time health metrics overview
- BMI calculation and categorization
- Progress tracking with visual indicators
- Create custom health goals (weight loss, exercise targets, etc.)
- Track progress towards goals with visual progress bars
- Mark goals as completed or manage multiple active goals
- Secure user registration and authentication
- Personal profile management
- Customizable user settings (age, height, gender)
- React 18: Modern component-based UI framework
- React Router: Client-side routing
- Chart.js: Data visualization
- Axios: HTTP client for API calls
- CSS3: Responsive styling
- Node.js: JavaScript runtime
- Express.js: Web application framework
- SQLite3: Lightweight database
- JWT: Secure authentication
- bcryptjs: Password hashing
- express-validator: Input validation
- Node.js (v14 or higher)
- npm or yarn
-
Clone the repository
git clone <repository-url> cd health_tracker
-
Install backend dependencies
npm install
-
Install frontend dependencies
cd src/frontend npm install cd ../..
-
Set up environment variables
cp .env.example .env
Edit
.envand set your configuration:PORT=3001 NODE_ENV=development JWT_SECRET=your-secret-key-here -
Start the application
Development mode (runs both frontend and backend):
npm run dev
Or run separately:
Backend:
npm run server
Frontend (in a new terminal):
npm run client
-
Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:3001
health_tracker/
βββ src/
β βββ backend/
β β βββ api/ # API route handlers
β β β βββ auth.js # Authentication endpoints
β β β βββ users.js # User management
β β β βββ health.js # Health data endpoints
β β β βββ goals.js # Goal management
β β β βββ analytics.js # Analytics endpoints
β β βββ database/
β β β βββ db.js # Database initialization and queries
β β βββ middleware/
β β β βββ auth.js # JWT authentication middleware
β β βββ server.js # Express server setup
β βββ frontend/
β βββ public/
β β βββ index.html # HTML template
β βββ src/
β βββ components/ # Reusable React components
β β βββ Navbar.js
β β βββ Navbar.css
β βββ pages/ # Page components
β β βββ Login.js
β β βββ Register.js
β β βββ Dashboard.js
β β βββ Profile.js
β β βββ HealthData.js
β β βββ Goals.js
β β βββ Analytics.js
β βββ services/
β β βββ api.js # API service layer
β βββ App.js # Main application component
β βββ index.js # Application entry point
β βββ index.css # Global styles
βββ package.json # Backend dependencies
βββ .env.example # Environment variables template
βββ .gitignore
βββ README.md
POST /api/auth/register- Register new userPOST /api/auth/login- User login
GET /api/users/profile- Get user profilePUT /api/users/profile- Update user profile
GET /api/health/weight- Get weight recordsPOST /api/health/weight- Add weight recordGET /api/health/nutrition- Get nutrition recordsPOST /api/health/nutrition- Add nutrition recordGET /api/health/exercise- Get exercise recordsPOST /api/health/exercise- Add exercise recordGET /api/health/sleep- Get sleep recordsPOST /api/health/sleep- Add sleep recordGET /api/health/vitals- Get vital recordsPOST /api/health/vitals- Add vital record
GET /api/goals- Get all goalsPOST /api/goals- Create new goalPUT /api/goals/:id- Update goalDELETE /api/goals/:id- Delete goal
GET /api/analytics/dashboard- Get dashboard summaryGET /api/analytics/weight-trend- Get weight trend dataGET /api/analytics/nutrition-trend- Get nutrition trend dataGET /api/analytics/exercise-summary- Get exercise summary
- id, email, password, name, age, gender, height, created_at, updated_at
- id, user_id, weight, date, notes, created_at
- id, user_id, meal_type, description, calories, protein, carbs, fat, date, created_at
- id, user_id, exercise_type, duration, calories_burned, distance, notes, date, created_at
- id, user_id, sleep_duration, quality, date, created_at
- id, user_id, blood_pressure_systolic, blood_pressure_diastolic, heart_rate, temperature, date, created_at
- id, user_id, goal_type, target_value, current_value, start_date, target_date, status, created_at, updated_at
- Password hashing with bcrypt
- JWT-based authentication
- Input validation on both frontend and backend
- Protected API routes
- SQL injection prevention through parameterized queries
- Register/Login: Create an account or login with existing credentials
- Set up Profile: Add your personal information (height, age, gender) for accurate BMI calculations
- Track Health Data: Use the Health Data page to log weight, meals, exercise, sleep, and vitals
- Set Goals: Create health goals and track your progress
- View Analytics: Check the Analytics page to see your progress with interactive charts
- Monitor Dashboard: Get a quick overview of your health metrics on the dashboard
npm testnpm run buildContributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the ISC License - see the LICENSE file for details.