FitConnect is a Next.js-based community fitness platform that connects users, trainers, and admins in a comprehensive fitness ecosystem.
- Multi-Role Authentication: Secure JWT-based login/registration for Users, Trainers, and Admins
- Personalized Dashboards: Role-specific dashboards with calendar views, streak tracking, and quick feature access
- Event Management: Create, edit, approve, and view fitness events; public event discovery
- Messaging System: Direct messaging and threaded conversations between users and trainers
- Trainer-Client Relationships: Send/receive trainer invitations and requests; manage client portfolios
- Workout Routines & Plans: Create and assign 7-day workout routines; track exercise completion
- Progress Tracking: Monitor workout streaks, performance metrics, and routine history
- Community Feed: Share posts, comments, and fitness content with the community
- Notifications: Real-time alerts for messages, events, and platform updates
- File Uploads: Upload profile avatars and images for posts/messages
- Admin Moderation: Approve pending events; access analytics, reports, and platform metrics
- Trainer Earnings: Track and manage session-based earnings and client payments
- Profile Management: Update personal profiles, settings, certifications, and preferences
- Calendar Integration: Visual workout and event scheduling with interactive calendars
- Streak System: Track and display workout consistency with detailed streak history
- Node.js (v18 or higher)
- npm
- PostgreSQL database (configured via Supabase)
-
Clone the repository:
git clone <repository-url> cd community-fitness-platform
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.envfile in the root directory with the following variables:DATABASE_URL=postgresql://postgres.ozfltmyavyqqtjvynifv:Dinho.210380@aws-1-ap-northeast-2.pooler.supabase.com:5432/postgres JWT_SECRET=change-this-to-a-long-random-secret SUPABASE_URL=https://ozfltmyavyqqtjvynifv.supabase.co SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im96Zmx0bXlhdnlxcXRqdnluaWZ2Iiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTc3MzQxOTc3OSwiZXhwIjoyMDg4OTk1Nzc5fQ.GYK3blFM9seWTYgsoIBXerfCUUTz-6DWYkS3DXE3EyQ -
Generate Prisma client:
npm run prisma:generate
-
Run database migrations (optional, will not be needed as migrations will already be cloned, just run generate command):
npm run prisma:migrate
Start the development server:
npm run devThe application will be available at:
- Local: http://localhost:3000
- Network: http://0.0.0.0:3000 (accessible from other devices on the same network)
-
Authentication:
- Register new accounts at
/auth/register(test User, Trainer, Admin roles) - Login at
/auth/login - Verify role-based access and JWT token handling
- Register new accounts at
-
User Dashboard (
/user/dashboard):- View personalized dashboard with calendar, active routines, and streaks
- Track workout progress and completion status
- Access community feed, events, messages, and trainer connections
-
Trainer Features (
/trainer/dashboard):- Manage client lists and view their progress/routines
- Create and assign 7-day workout plans (
/trainer/clients/[clientId]/plan) - Monitor client streaks and earnings
- Handle trainer requests and invitations
-
Admin Features (
/admin/dashboard):- Approve pending events (
/admin/events) - Access analytics and reports (
/admin/analytics,/admin/reports) - Moderate platform content and user management
- Approve pending events (
-
Event Management:
- Create events via modal or
/eventspage - Edit existing events
- View public upcoming events (
/events) - Admin approval workflow for new events
- Create events via modal or
-
Messaging System:
- Send direct messages (
/messages) - Create threaded conversations (
/messages/threads) - Message specific users (
/messages/with/[userId])
- Send direct messages (
-
Workout Routines:
- View active 7-day routines with exercise details
- Track completion and progress (
/progress) - Request new routines (
/routines/request) - Continue existing routines (
/routines/[id]/continue)
-
Community Features:
- Post and comment on community feed (
/community) - Share fitness content and interact with posts
- Post and comment on community feed (
-
Notifications:
- Receive real-time notifications (
/notifications) - Mark notifications as read
- Receive real-time notifications (
-
File Uploads:
- Upload profile avatars (
/profile-settings) - Attach images to posts and messages (
/upload)
- Upload profile avatars (
-
API Testing:
- Test all endpoints with Postman or curl:
/api/auth/*(login, register, me)/api/events/*(CRUD operations, public events)/api/messages/*(threads, direct messaging)/api/notifications/*(mark read)/api/posts/*(community feed)/api/progress/*(workout tracking)/api/routines/*(create, continue, request)/api/trainer-invitations/*(invitations)/api/trainer-requests/*(requests)/api/trainers/*(trainer management)/api/upload/*(file uploads)/api/users/*(user profiles)/api/workout-plans/*(plans)
- Test all endpoints with Postman or curl:
-
Database:
- Check Prisma Studio:
npx prisma studio - Verify data integrity in Supabase dashboard
- Test migrations and schema relationships
- Check Prisma Studio:
npm run build
npm run start- Linting:
npm run lint - Prisma Generate:
npm run prisma:generate - Prisma Migrate:
npm run prisma:migrate
- Frontend: Next.js, React, TypeScript, Tailwind CSS
- Backend: Next.js API Routes
- Database: PostgreSQL with Prisma ORM
- Authentication: JWT with bcryptjs
- Storage: Supabase
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
This project is private and proprietary.