SmartFlex — AI Fitness Trainer
AI-powered fitness training app that generates personalized workout and diet plans in real-time through voice interaction.

Features
- Authentication via Clerk — Secure and scalable auth system
- Vapi AI Agent — Real-time voice interaction with an AI fitness coach
- Diet & Workout Plans — Custom plans generated by Gemini AI
- Fitness Duration Estimator — Predicts how many days you need based on your goals
- Plan History — View and revisit your generated fitness plans
- Convex as Database — Fast, reactive, serverless backend
Tech Stack
| Tech | Purpose |
|---|---|
| Next.js | Frontend & App Framework |
| Clerk | Authentication & User Management |
| Vapi AI | AI Voice Agent for Coaching |
| Gemini | Fitness & Diet Plan Generation |
| Convex | Backend, Data Storage & Queries |
How It Works
- User logs in via Clerk
- Speaks to the Vapi AI agent
- Gemini generates a personalized plan
- Convex stores your plan for easy access later
Getting Started
Clone the Repository
git clone https://github.com/Kashan-2912/smartflex.git
cd smartflex-aiInstall Dependencies
$ pnpm add
Configure Environment Variables
Create a .env.local file in the root directory:
# Clerk (Auth)
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key
CLERK_SECRET_KEY=your_clerk_secret_key
# Vapi AI
NEXT_PUBLIC_VAPI_WORKFLOW_ID=your_vapi_workflow_id
NEXT_PUBLIC_VAPI_API_KEY=your_vapi_api_key
# Convex
CONVEX_DEPLOYMENT=your_convex_deployment
NEXT_PUBLIC_CONVEX_URL=your_public_convex_url
# Gemini
GEMINI_API_KEY=your_gemini_api_keyStart the Development Server
$ pnpm dev
Folder Structure
smartflex/
├── public/
├── convex/
├── src/
├── app/
├── components/
├── constants/
├── lib/
├── providers/
├── middleware.ts