Skip to content

srddevj/codeflex-ai

Β 
Β 

Repository files navigation

πŸ’ͺ AI Fitness Assistant πŸ€–

Demo App

Highlights:

  • πŸš€ Tech stack: Next.js, React, Tailwind & Shadcn UI
  • πŸŽ™οΈ Voice AI Assistant (Vapi)
  • 🧠 LLM Integration (Gemini AI)
  • πŸ‹οΈ Personalized Workout Plans
  • πŸ₯— Custom Diet Programs
  • πŸ”’ Authentication & Authorization (Clerk)
  • πŸ’Ύ Database (Convex)
  • 🎬 Real-time Program Generation
  • πŸ’» Layouts
  • 🎭 Client & Server Components

Features

  • Smart AI Assistant: Engage in conversation with an AI that asks about your fitness goals, physical condition, and preferences
  • Personalized Workout Plans: Get custom exercise routines based on your fitness level, injuries, and goals
  • Diet Recommendations: Receive personalized meal plans accounting for your allergies and dietary preferences
  • User Authentication: Sign in with GitHub, Google, or email/password
  • Program Management: Create and view multiple fitness programs with only the latest one active
  • Responsive Design: Beautiful UI that works across all devices

Available Scripts

  • npm run dev - Start Next.js development server
  • npm run build - Build the application for production
  • npm run start - Start production server
  • npm run lint - Run ESLint
  • npm run convex:dev - Start Convex development mode (watches for changes)
  • npm run convex:deploy - Deploy Convex functions to development
  • npm run convex:deploy:prod - Deploy Convex functions to production

Getting Started

Quick Setup

  1. Clone the repository

    git clone <repository-url>
    cd ai-fitness-trainer
  2. Install dependencies

    npm install
  3. Set up Convex (Database)

    Important: Convex setup is required before running the app!

    # Install Convex CLI (if not already installed)
    npm install -g convex
    
    # Login to Convex
    npx convex login
    
    # Initialize and deploy Convex backend
    npx convex dev

    This will:

    • Create a new Convex project
    • Generate your deployment URL
    • Create a .env.local file with NEXT_PUBLIC_CONVEX_URL

    For detailed Convex setup instructions, see SETUP.md

  4. Set up your environment variables

    Create a .env.local file in the root directory with the following variables:

    # Convex Database (auto-generated by `npx convex dev`)
    CONVEX_DEPLOYMENT=your-deployment-name
    NEXT_PUBLIC_CONVEX_URL=https://your-deployment.convex.cloud
    
    # Clerk Authentication
    NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
    CLERK_SECRET_KEY=sk_test_...
    
    # Clerk Redirect URLs
    NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
    NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
    
    # Clerk Webhook Secret (for Convex HTTP endpoint)
    CLERK_WEBHOOK_SECRET=whsec_...
    
    # Gemini AI (for Convex HTTP endpoint)
    # Also set in Convex: npx convex env set GEMINI_API_KEY your-key
    GEMINI_API_KEY=your-gemini-api-key
    
    # Vapi Voice AI
    NEXT_PUBLIC_VAPI_WORKFLOW_ID=your-workflow-id
    NEXT_PUBLIC_VAPI_API_KEY=your-vapi-api-key
  5. Update Convex configuration

    • Create JWT Template in Clerk (REQUIRED):
      • Go to Clerk Dashboard β†’ Configure β†’ JWT Templates
      • Create a new template with name exactly convex (lowercase)
      • This fixes the "No JWT template exists with name: convex" error
    • Update convex/auth.config.ts with your Clerk domain (see SETUP.md for details)
    • Set Convex environment variables:
      npx convex env set GEMINI_API_KEY your-gemini-api-key
      npx convex env set CLERK_WEBHOOK_SECRET your-clerk-webhook-secret
  6. Run the development server

    npm run dev
  7. Open http://localhost:3000 in your browser

Need Help with Setup?

For detailed setup instructions, especially for Convex configuration, see SETUP.md.

Deployment

This application can be easily deployed to Vercel:

npm run build
npm run start

Or connect your GitHub repository to Vercel for automatic deployments.

Technologies Used

  • Next.js: React framework for building the frontend and API routes
  • Tailwind CSS & Shadcn UI: For styling and UI components
  • Clerk: Authentication and user management
  • Vapi: Voice agent platform for conversational AI
  • Convex: Real-time database
  • Gemini AI: Large Language Model for generating personalized fitness programs

Learn More

To learn more about the technologies used in this project:

About

Build Your Own AI Fitness Trainer for FREE πŸ’€

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 88.2%
  • CSS 7.0%
  • JavaScript 4.8%