π±π° Sri Lanka's Premier AI-Powered Digital Fitness Management Platform
Features β’ Tech Stack β’ Installation β’ Usage β’ Architecture
ELITE Gym & Fitness is a cutting-edge, full-stack fitness management platform engineered specifically for the Sri Lankan fitness industry. Combining the power of modern web technologies with AI-driven personalization, this platform delivers an all-in-one solution for gym members, personal trainers, and facility administrators.
Built with Next.js 15, Convex real-time database, Stripe payment processing, Clerk authentication, and Vapi voice AI for conversational program generation, ELITE transforms how fitness businesses operate and how members achieve their health goals.
- Voice-Enabled Consultation - Interactive voice conversations with Vapi AI to create personalized plans
- Conversational Input - Natural dialogue to gather fitness goals, limitations, and preferences
- Smart Workout Plans - Customized training programs generated by Google Gemini AI
- Personalized Diet Plans - Nutrition recommendations tailored to individual goals
- Real-Time Transcripts - Live display of conversation during AI consultation
- Seamless Experience - Voice consultation automatically redirects to profile with generated plans
- Flexible Membership Tiers - Basic, Premium, and Elite packages
- Automated Renewals - Stripe-powered subscription management
- Member Dashboards - Track workouts, attendance, and progress
- QR Code Check-ins - Contactless gym access (planned)
- Membership History - Complete transaction and usage records
- Trainer Profiles - Detailed bios, specializations, and certifications
- Real-Time Availability - Live scheduling and booking calendar
- Session Management - Track past and upcoming training sessions
- Trainer Applications - Apply to become a trainer with admin approval
- Salary Management - Admin dashboard for trainer compensation
- Booking Payments - Stripe integration for session payments
- Product Catalog - Supplements, equipment, apparel, and accessories
- Shopping Cart - Add multiple items and manage quantities
- Secure Checkout - Stripe-integrated payment processing
- Inventory Management - Admin control of stock levels
- Order History - Complete purchase records in user profile
- Product Reviews - Community-driven ratings and feedback
- Local Currency Support - Optimized for Sri Lankan Rupees (LKR)
- Multiple Payment Gateways - Stripe for cards and digital wallets
- Subscription Billing - Automated recurring membership payments
- One-Time Payments - Trainer bookings and product purchases
- Webhook Integration - Real-time payment status updates
- Payment Slips - Track all transaction history
- Secure Login - Clerk-powered authentication
- Role-Based Access Control - Separate permissions for users, trainers, and admins
- Social Login - Google and email authentication
- Session Management - Secure token-based sessions
- Protected Routes - Middleware-based route protection
- User Management - CRUD operations for all user accounts
- Membership Analytics - Track active subscriptions and revenue
- Trainer Administration - Approve applications and manage trainers
- Inventory Control - Manage products, stock, and pricing
- Blog Management - Create and manage fitness content
- Recipe Database - Add and manage healthy recipes
- Salary Management - Track and manage trainer payments
- System Configuration - Platform settings and customization
- Responsive UI - Optimized for all screen sizes
- Dark/Light Mode - Theme toggle with next-themes
- Touch-Friendly Interface - Intuitive mobile interactions
- Fast Loading - Turbopack for rapid development
- Modern Components - shadcn/ui component library
- Sri Lankan Focus - Currency (LKR), language, and cultural considerations
- Time Zone Support - Accurate scheduling for local time (Asia/Colombo)
- Local Payment Methods - Stripe configured for Sri Lankan market
| Technology | Purpose |
|---|---|
| Real-time backend-as-a-service with TypeScript | |
| API routes and webhook handlers | |
| Convex Functions | Queries, mutations, and actions |
| Technology | Purpose |
|---|---|
| Complete user authentication and management | |
| Clerk Middleware | Route protection and session handling |
| Role-Based Access | Admin, Trainer, and User roles |
| Technology | Purpose |
|---|---|
| Next-gen bundler for faster development | |
| Code linting and quality control | |
| Version control |
| Technology | Purpose |
|---|---|
| Hosting and deployment | |
| Edge Functions | Global CDN and low latency |
| Serverless Architecture | Scalable infrastructure |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β NEXT.JS 15 FRONTEND β
β (App Router + React 19) β
β β
β βββββββββββββββ ββββββββββββββββ ββββββββββββββββββββββ β
β β User β β Trainer β β Admin β β
β β Portal β β Dashboard β β Dashboard β β
β β β β β β β β
β β - Profile β β - Sessions β β - User Mgmt β β
β β - Plans β β - Schedule β β - Memberships β β
β β - Orders β β - Earnings β β - Inventory β β
β β - Bookings β β β β - Blog/Recipes β β
β βββββββββββββββ ββββββββββββββββ ββββββββββββββββββββββ β
β β β β β
β ββββββββββββββββββ΄ββββββββββββββββββββββ β
β β β
β ββββββββββΌβββββββββ β
β β Clerk Auth β β
β β Middleware β β
β ββββββββββ¬βββββββββ β
ββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββ
β CONVEX BACKEND LAYER β
β β
β βββββββββββββββββ βββββββββββββββ ββββββββββββββββββββ β
β β Queries β β Mutations β β Actions β β
β β (Read Data) β β (Write Data)β β (External APIs) β β
β β β β β β β β
β β - Users β β - Create β β - Stripe β β
β β - Plans β β - Update β β - Webhooks β β
β β - Products β β - Delete β β - Email β β
β βββββββββββββββββ βββββββββββββββ ββββββββββββββββββββ β
β β β β β
β βββββββββββββββββββ΄βββββββββββββββββββββ β
β β β
β ββββββββββΌβββββββββ β
β β Convex RT DB β β
β β - users β β
β β - memberships β β
β β - bookings β β
β β - products β β
β β - trainers β β
β β - fitnessPlans β β
β β - dietPlans β β
β βββββββββββββββββββ β
βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββΌββββββββββββββββββββββββββ
β β β β
βββββββββΌβββββββ ββββββββΌβββββββββ ββββββΌβββββββ ββββββββΌβββββββ
β Stripe β β Google β β Clerk β β Vapi β
β Payment β β Gemini AI β β Auth β β Voice AI β
β Gateway β β (v2.5) β β Service β β Agent β
β β β β β β β β
β - Checkout β β - Workout Gen β β - Users β β - Voice Callβ
β - Webhooks β β - Diet Gen β β - Sessionsβ β - Workflow β
β - Subs β β β β - Roles β β - Variables β
ββββββββββββββββ βββββββββββββββββ βββββββββββββ βββββββββββββββ
- Node.js 18.x or higher
- npm or yarn or pnpm
- Git
- Convex Account (Sign up)
- Stripe Account (Sign up)
- Clerk Account (Sign up)
- Google Gemini API Key (Get key)
- Vapi Account (Sign up)
- Clone the repository
git clone https://github.com/PasinduSuraweera/ELITE-Gym-and-Fitness.git
cd ELITE-Gym-and-Fitness- Install dependencies
npm install
# or
yarn install
# or
pnpm install- Set up environment variables
Create a .env.local file in the root directory:
# Convex
CONVEX_DEPLOYMENT=your_convex_deployment_url
NEXT_PUBLIC_CONVEX_URL=your_convex_public_url
# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key
CLERK_SECRET_KEY=your_clerk_secret_key
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
# Stripe
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=your_stripe_publishable_key
STRIPE_SECRET_KEY=your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret
# Google Gemini AI
GEMINI_API_KEY=your_gemini_api_key
# Vapi Voice AI (for AI Program Generator)
NEXT_PUBLIC_VAPI_API_KEY=your_vapi_public_key
NEXT_PUBLIC_VAPI_WORKFLOW_ID=your_vapi_workflow_id
# Optional: Chatbase
NEXT_PUBLIC_CHATBASE_ID=your_chatbase_id- Set up Convex
npx convex devThis will:
- Initialize your Convex project
- Set up the database schema
- Deploy functions to development
- Configure Vapi Workflow
# In your Vapi dashboard:
1. Create a new workflow
2. Configure workflow to call your Convex HTTP endpoint
3. Set up function calling for fitness plan generation
4. Configure variables: full_name, user_id
5. Test voice interactions- Set up Stripe webhooks (for local development)
stripe listen --forward-to localhost:3000/api/webhooks/stripe- Run the development server
npm run dev
# or
yarn dev
# or
pnpm dev- Access the application
http://localhost:3000
ELITE-Gym-and-Fitness/
β
βββ convex/ # Convex backend
β βββ schema.ts # Database schema definitions
β βββ http.ts # HTTP routes & Vapi webhook handler
β βββ users.ts # User queries/mutations
β βββ memberships.ts # Membership management
β βββ bookings.ts # Trainer booking system
β βββ products.ts # Marketplace products
β βββ trainers.ts # Trainer management
β βββ fitnessPlans.ts # Workout plans
β βββ dietPlans.ts # Diet plans
β βββ payments.ts # Payment processing
β
βββ src/
β βββ app/ # Next.js 15 App Router
β β βββ (auth)/ # Authentication routes
β β β βββ sign-in/
β β β βββ sign-up/
β β β
β β βββ admin/ # Admin dashboard
β β β βββ page.tsx # Admin home
β β β βββ users/ # User management
β β β βββ memberships/ # Membership control
β β β βββ inventory/ # Product inventory
β β β βββ blog/ # Blog management
β β β βββ recipes/ # Recipe management
β β β βββ salary/ # Trainer salary
β β β βββ trainer-applications/
β β β
β β βββ api/ # API routes
β β β βββ create-checkout-session/
β β β βββ create-marketplace-checkout/
β β β βββ create-booking-checkout/
β β β βββ webhooks/
β β β βββ stripe/
β β β
β β βββ generate-program/ # ποΈ Voice AI program generator
β β β βββ page.tsx # Vapi voice consultation page
β β β
β β βββ profile/ # User dashboard
β β β βββ page.tsx # Profile overview
β β β βββ fitness-plans/ # View workout plans
β β β βββ diet-plans/ # View diet plans
β β β βββ training-sessions/
β β β βββ orders/
β β β βββ payment-slips/
β β β βββ settings/
β β β
β β βββ membership/ # Membership purchase
β β βββ trainer-booking/ # Book training sessions
β β βββ become-trainer/ # Trainer application
β β βββ marketplace/ # E-commerce
β β β βββ page.tsx
β β β βββ cart/
β β β βββ checkout/
β β βββ blog/ # Fitness blog
β β βββ recipes/ # Recipe database
β β βββ reviews/ # Product reviews
β β βββ about/
β β βββ contact/
β β βββ help/
β β βββ privacy/
β β βββ terms/
β β
β βββ components/ # React components
β β βββ ui/ # shadcn/ui components
β β βββ Navbar.tsx # Navigation
β β βββ Footer.tsx
β β βββ AdminLayout.tsx # Admin dashboard layout
β β βββ UserLayout.tsx # User dashboard layout
β β βββ RoleGuard.tsx # Authorization
β β βββ ThemeToggle.tsx # Dark/Light mode
β β βββ NoFitnessPlan.tsx # Empty state component
β β βββ UserPrograms.tsx # Display user programs
β β
β βββ lib/ # Utility functions
β β βββ utils.ts
β β βββ membership-utils.ts
β β βββ vapi.ts # ποΈ Vapi SDK initialization
β β
β βββ providers/ # Context providers
β β βββ ConvexClerkProvider.tsx
β β
β βββ middleware.ts # Clerk auth middleware
β
βββ public/ # Static assets
β βββ logo.png
β βββ logo2.png
β βββ hero-ai.png
β
βββ .env.local # Environment variables
βββ next.config.js
βββ tailwind.config.ts
βββ tsconfig.json
βββ package.json
-
Sign Up & Profile Setup
- Create account via Clerk authentication
- Complete profile information
- Choose membership tier
-
Generate AI Fitness Plan ποΈ
- Navigate to "AI Plan Generator" page
- Click "Start Voice Consultation"
- Have a natural conversation with Vapi AI:
- State your age, height, weight
- Mention any injuries or limitations
- Specify available workout days
- Describe your fitness goals
- Indicate fitness level
- Share dietary restrictions
- View real-time transcript of conversation
- AI generates personalized workout and diet plans
- Automatically redirected to profile with saved plans
-
View Your Plans
- Access Workout Plans in profile sidebar
- Access Diet Plans in profile sidebar
- Download plans for offline reference
- Track your progress
-
Book Training Sessions
- Browse available trainers
- Check schedules and specializations
- Book sessions via Stripe checkout
- View bookings in profile
-
Shop Products
- Browse marketplace
- Add to cart
- Secure Stripe checkout
- Track orders in profile
-
Apply to Become Trainer
- Submit application via "Become Trainer" page
- Wait for admin approval
- Set up trainer profile
-
Manage Schedule
- View upcoming sessions
- Track earnings in dashboard
- Manage availability
-
Track Clients
- View assigned clients
- Access session history
-
Dashboard Overview
- Monitor platform metrics
- View user statistics
- Track revenue
-
User Management
- View all users
- Manage memberships
- Handle support requests
-
Trainer Administration
- Review trainer applications
- Approve or reject applications
- Manage trainer salaries
-
Content Management
- Create blog posts
- Add recipes
- Manage product inventory
-
System Configuration
- Configure membership tiers
- Set pricing
- Manage platform settings
The /generate-program page uses Vapi for voice-based fitness plan generation:
-
Voice Call Initiation
- User clicks "Start Consultation" button
- Vapi initializes voice call with workflow
- Custom variables passed:
full_name,user_id
-
Conversational Data Collection
- Vapi AI asks questions naturally
- User responds via voice
- Real-time transcript displayed on screen
- Visual indicators show AI speaking state
-
Backend Processing
- Vapi workflow calls Convex HTTP endpoint
/vapi/generate-program - Payload includes user responses
- Google Gemini AI generates workout and diet plans
- Plans saved to Convex database
- Vapi workflow calls Convex HTTP endpoint
-
Completion & Redirect
- Voice call ends
- Success message displayed
- Auto-redirect to profile page (1.5s delay)
- Plans immediately available in profile
// Vapi Event Listeners
- call-start: Voice call begins
- call-end: Voice call completed
- speech-start: AI starts speaking
- speech-end: AI stops speaking
- message: Real-time transcripts
- error: Error handlingBasic - Entry-level access Premium - Enhanced features Elite - Complete access with all benefits
(Configure pricing via Stripe products and Convex database)
- Real-time availability checking
- Stripe integration for payments
- Automated booking confirmations
- Calendar management
- Full shopping cart functionality
- Secure Stripe checkout
- Order tracking
- Admin inventory control
- Clerk Authentication - Enterprise-grade security
- Role-Based Access Control - Admin, Trainer, User roles
- Stripe PCI Compliance - Secure payment handling
- Protected Routes - Middleware-based authorization
- HTTPS Encryption - All data encrypted in transit
- Environment Variables - Sensitive data protection
- Webhook Verification - Stripe signature validation
- Turbopack - Ultra-fast development builds
- Convex Real-time - Instant data updates
- Image Optimization - Next.js Image component
- Code Splitting - Automatic route-based splitting
- Server Components - React 19 Server Components
- Edge Runtime - Global low-latency responses
- Native Mobile Apps - iOS and Android
- Video Workouts - On-demand fitness classes
- Gamification - Achievements and leaderboards
- Progress Analytics - Body composition tracking
- Push Notifications - Real-time alerts
- Multi-Language - Sinhala and Tamil support
- Virtual Training - Live video sessions
- Multi-Location - Support for gym chains
Contributions are welcome! Help make ELITE even better.
- Fork the Project
- Create your Feature Branch
git checkout -b feature/AmazingFeature
- Commit your Changes
git commit -m 'Add some AmazingFeature' - Push to the Branch
git push origin feature/AmazingFeature
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Pasindu Suraweera
- GitHub: @PasinduSuraweera
- Live Demo: ELITE Gym & Fitness
- LinkedIn: Connect with me
- Next.js - The React framework for production
- Convex - Real-time backend platform
- Stripe - Payment infrastructure
- Clerk - Authentication and user management
- Vapi - Voice AI platform for conversational interfaces
- Google Gemini - AI-powered plan generation
- shadcn/ui - Beautiful component library
- Tailwind CSS - Utility-first CSS framework
- π±π° The Sri Lankan fitness community
Need help or have questions?