A full-stack fitness tracking and e-commerce application built with the MERN stack (MongoDB replaced with PostgreSQL/Supabase).
FitFusion connects fitness enthusiasts with workout tracking tools, progress monitoring, and a marketplace for fitness products.
FitFusion is a comprehensive fitness platform that combines:
- Workout Tracking: Log exercises, sets, reps, and track progress over time
- Gamification: XP points and streak system to keep users motivated
- E-commerce: Browse and purchase fitness products (supplements, equipment, apparel)
- Progress Analytics: Track body metrics (weight, body fat percentage)
- Gym Attendance: Check-in/check-out system with duration tracking
The platform uses JWT-based authentication with Google OAuth integration and Supabase (PostgreSQL) for cloud database storage.
- JWT-based authentication with secure password hashing (bcrypt)
- Google OAuth 2.0 integration for seamless login
- Protected routes with middleware
- Session management with token expiration
- Custom Exercise Library: Create and manage personal exercises
- Workout Logging: Track sets, reps, weight, and RPE (Rate of Perceived Exertion)
- Progress Tracking: Monitor weight and body fat percentage over time
- Workout History: View past workouts with detailed set information
- Gamification: Earn XP points and maintain workout streaks
- Check-in/Check-out system
- Automatic duration calculation
- Attendance history tracking
- Real-time status updates
- Product catalog with categories (Supplements, Equipment, Apparel)
- Shopping cart management
- Order processing and history
- Inventory tracking
- Product search and filtering
- Progress visualization
- Workout frequency tracking
- Body metrics trends
- Purchase history
| Role | Description | Permissions |
|---|---|---|
| User (Fitness Enthusiast) | Tracks workouts, monitors progress, shops for products | Create account, log workouts, track progress, purchase products, manage cart |
| Admin (Future) | Manages platform, products, and users | Manage products, categories, view analytics, moderate content |
- Login / Register Page (Email/Password)
- Google OAuth Login/Signup
- Password Reset Page (Future)
- Session Management & JWT Tokens
- Dashboard: Overview of recent workouts, streak, XP, and recommendations
- Workout Logger: Create and log new workouts
- Exercise Library: Browse and create custom exercises
- Progress Tracker: View body metrics over time
- Attendance History: Check-in/check-out records
- Profile Page: Edit user information and preferences
- Product Catalog: Browse all products with filters
- Product Details: Detailed product information
- Shopping Cart: Manage cart items
- Checkout: Place orders with shipping details
- Order History: View past purchases
- Home Page: Landing page with features overview
- About / Contact Page
- Navigation: Responsive navbar with user menu
erDiagram
User ||--o{ Workout : creates
User ||--o{ Exercise : creates
User ||--o{ Attendance : has
User ||--o{ ProgressLog : tracks
User ||--o{ CartItem : has
User ||--o{ Order : places
Workout ||--o{ WorkoutSet : contains
Exercise ||--o{ WorkoutSet : "used in"
Category ||--o{ Product : contains
Product ||--o{ CartItem : "added to"
Product ||--o{ OrderItem : "ordered as"
Order ||--o{ OrderItem : contains
User {
int user_id PK
string user_name
string user_email UK
string user_password
int xp
int streak
}
Exercise {
int id PK
string name
string muscleGroup
int userId FK
}
Workout {
int id PK
int userId FK
string title
datetime date
}
Product {
int id PK
string name
float price
int stock
int categoryId FK
}
- React 19.1.1 - UI library
- React Router - Client-side routing
- Vite - Build tool and dev server
- TailwindCSS - Utility-first CSS framework
- Google OAuth (@react-oauth/google) - OAuth integration
- Node.js with Express 5.1.0 - Server framework
- Prisma ORM 6.18.0 - Database ORM
- Supabase - PostgreSQL cloud database
- JWT (jsonwebtoken) - Authentication tokens
- bcrypt - Password hashing
- Zod - Schema validation
- PostgreSQL (via Supabase)
- Prisma for migrations and queries
- JWT-based authentication
- Google OAuth 2.0
- bcrypt password hashing
- Node.js v18+
- Supabase account (free tier)
-
Clone the repository
git clone https://github.com/Dhruv-2403/FitFusion.git cd FitFusion -
Backend Setup
cd backend npm install -
Configure Environment
Copy
.env.supabaseto.envand add your Supabase credentials:DATABASE_URL="postgresql://..." # Transaction pooler (port 6543) DIRECT_URL="postgresql://..." # Direct connection (port 5432) JWT_SECRET_KEY="your-secret-key" GOOGLE_CLIENT_ID="your-google-client-id" # Optional
-
Initialize Database
npx prisma db push npx prisma db seed
This creates all tables and populates them with sample data!
-
Start Backend
npm run dev
Server runs on
http://localhost:3000 -
Frontend Setup
cd ../frontend npm install npm run devFrontend runs on
http://localhost:5173
[User] β registers β logs workouts β tracks progress β earns XP & streaks
β³ browses products β adds to cart β places order
β³ checks in to gym β works out β checks out
[System] β calculates workout duration β updates streak β awards XP
β³ processes orders β updates inventory β sends confirmations
After running npx prisma db seed, you can login with:
Email: [email protected]
Password: password123
Import and test all endpoints. See API_TESTING_GUIDE.md for detailed documentation.
Visual database browser:
cd backend
npx prisma studioOpens at http://localhost:5555
POST /api/users/signup- Register new userPOST /api/users/login- Login and get JWT tokenGET /api/users/profile- Get user profile (protected)POST /api/auth/google- Google OAuth login
POST /api/exercises- Create custom exercise (protected)GET /api/exercises- Get user exercises (protected)POST /api/workouts- Log workout with sets (protected)GET /api/workouts- Get workout history (protected)POST /api/attendance/checkin- Check in to gym (protected)POST /api/attendance/checkout- Check out from gym (protected)GET /api/attendance- Get attendance history (protected)
GET /api/products- Get all productsGET /api/products/:id- Get product detailsPOST /api/cart- Add to cart (protected)GET /api/cart- Get cart items (protected)PUT /api/cart/:id- Update cart item (protected)DELETE /api/cart/:id- Remove from cart (protected)POST /api/orders- Create order (protected)GET /api/orders- Get order history (protected)
Full API documentation: API_TESTING_GUIDE.md
FitFusion/
βββ frontend/ # React + Vite
β βββ src/
β β βββ components/ # Reusable UI components
β β βββ pages/ # Page components
β β βββ context/ # React Context for state
β β βββ App.jsx # Main app component
β βββ package.json
β βββ vite.config.js
β
βββ backend/ # Express + Prisma
β βββ src/
β β βββ controllers/ # Business logic
β β β βββ userController.js
β β β βββ exerciseController.js
β β β βββ workoutController.js
β β β βββ attendanceController.js
β β β βββ productController.js
β β β βββ cartController.js
β β β βββ orderController.js
β β βββ routes/ # API routes
β β βββ middleware/ # Auth middleware
β β βββ validation/ # Zod schemas
β β βββ index.js # Server entry
β βββ prisma/
β β βββ seed.js # Sample data
β βββ schema.prisma # Database schema
β βββ package.json
β
βββ API_TESTING_GUIDE.md # Detailed API docs
βββ README.md # This file
- β A fully functional MERN-based Fitness & E-commerce Platform
- β Multi-module application (Fitness + Shopping)
- β Live demo showcasing full-stack CRUD operations
- β Gamification system with XP and streaks
- β Responsive design with TailwindCSS
- β Secure authentication (JWT + OAuth)
- β Cloud database with Supabase
- β Real-world workflow demonstration
- β Portfolio-grade project for full-stack developer roles
# Supabase Database
DATABASE_URL="postgresql://..." # Pooler connection
DIRECT_URL="postgresql://..." # Direct connection
# Authentication
JWT_SECRET_KEY="your-secret-key"
JWT_EXPIRES_IN="7d"
# Google OAuth (optional)
GOOGLE_CLIENT_ID="your-google-client-id"The seed file (backend/prisma/seed.js) consists of sample data.
For any sample testing , take data from there and test it locally (Postman/ThunderClient) for API Testing.
Run npx prisma db seed anytime to reset with fresh sample data!
- Social Features: Follow friends, share workouts
- AI Workout Recommendations: Personalized workout plans based on history
- Nutrition Tracking: Calorie and macro tracking
- Workout Templates: Pre-built workout programs
- Progress Photos: Upload and track transformation photos
- Leaderboards: Compete with other users
- Mobile App: React Native version
- Wearable Integration: Sync with Fitbit, Apple Watch
- Video Tutorials: Exercise demonstration videos
- Community Forum: Discussion boards for fitness topics
- Premium Subscription: Advanced features and analytics
- Admin Dashboard: Manage users, products, and analytics
- Real-time Notifications: Push notifications for achievements
- Payment Gateway: Stripe/PayPal integration for e-commerce
- Go to supabase.com
- Open your project
- Click Table Editor
- Browse all tables
npx prisma studioOpens at http://localhost:5555
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- API Testing Guide:
API_TESTING_GUIDE.md - E-commerce API Details:
backend/ECOMMERCE_API.md - OAuth Testing:
backend/TEST_OAUTH.md