AI-Driven Fitness Platform with ZTL DSL and Bidirectional AI Workflow
Status: π‘ In Progress (65-70% MVP Ready) Current Stage: 4.2.1 Complete Version: 4.2.1
Zenith Trainer is a modern web-based fitness tracking platform that combines comprehensive workout management with AI-powered insights. Built with Next.js 15, React 18, and Firebase, it features an industry-first ZTL DSL (Zenith Training Language) for programmatic workout program description and a bidirectional AI workflow for professional training analysis.
-
ZTL DSL (Zenith Training Language) - YAML-based domain-specific language for training programs
- Export programs as structured YAML
- Import/parse programs from YAML
- AI-ready format with embedded analysis prompts
-
Bidirectional AI Workflow
- Export program + performance data β Claude/Gemini analyzes β Import AI recommendations
- One-click apply AI-suggested modifications (Stage 4.2.2 - in progress)
-
Comprehensive Analytics
- Volume tracking, RPE analytics, progress visualizations (Recharts)
- Advanced visualizations: heatmaps, radar charts (Stage 4.3 - 60% complete)
-
Habit Tracker 2.0 (in progress)
- Multi-dimensional life tracking (8 life contexts)
- Daily reflection system, Wheel of Life visualization
- AI insights for habit formation (Stages 3-6 - 40% complete)
ποΈ Workout Builder
- Drag & drop exercise ordering with @dnd-kit
- Set/rep/weight configuration with validation
- Superset, circuit, and triset support
- Workout templates for quick creation
- RPE (Rate of Perceived Exertion) tracking (1-10 scale)
π Program Management
- Multi-week program creation (4-52 weeks)
- Periodization cycles (accumulation, intensification, deload)
- Program templates and cloning
- Auto-scheduling to weekly calendar
- Real-time set-by-set tracking
- Automatic rest timer with notifications
- RPE slider for intensity tracking
- Exercise notes and post-workout feedback tags
- Workout completion flow with summary
π Analytics & Progress
- Volume tracking (weekly, monthly aggregates)
- Exercise-specific performance history
- Progress charts (Recharts line/bar/area charts)
- Calendar view of workout history
- RPE trend analysis
π€ ZTL DSL (Zenith Training Language)
Industry-first YAML-based DSL for training programs. Example:
program:
name: "Beginner Strength 12-Week"
weeks: 12
cycles:
- name: "Accumulation"
weeks: 4
focus: "Volume building"
workouts:
- day: "Monday"
name: "Upper Body Push"
exercises:
- name: "Bench Press"
sets: 4
reps: 8-10
rpe_target: 7-8Export β Analyze β Import workflow:
- Export program as ZTL YAML (includes performance data + embedded prompts)
- Send to Claude/Gemini for professional analysis
- AI returns structured recommendations
- Import back with one click (Stage 4.2.2)
π§ AI Integration (Genkit + Gemini)
- 5 AI flows: Insights, Progression, Recommendations, Recovery, Nutrition
- Automatic analysis triggers (planned)
- Context-aware suggestions based on performance data
π― Habit Tracker 2.0 (40% complete)
- Core habit tracking (daily, weekly, count, duration types)
- Streak tracking with swipeable mobile interface
- Daily Reflection (Stage 3 - planned)
- Wheel of Life visualization (Stage 4 - planned)
- AI habit insights (Stage 5-6 - planned)
π± Exercise Library
- 500+ pre-defined exercises
- Custom exercise creation
- Category filtering (strength, cardio, flexibility, sports)
- Muscle group filtering
- Equipment filtering
- Search functionality
Before you begin, ensure you have:
- Node.js 18+ (recommended: 20+)
# Check version node --version # Should be v18.x or higher
- npm or yarn
- Firebase project with Firestore + Authentication enabled
- Google Gemini API key (for AI features) - Get one here
# Clone repository
git clone https://github.com/AlgizPure/studio.git
cd studio
# Install dependencies
npm install
# Setup environment variables
cp .env.example .env.local
# Edit .env.local with your Firebase config and Gemini API key
# Run development server
npm run devCreate .env.local with the following:
# Firebase Configuration
# Get these from Firebase Console > Project Settings > General
NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_auth_domain
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_storage_bucket
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id
# Gemini AI (for AI features)
# Get API key from https://ai.google.dev/
GEMINI_API_KEY=your_gemini_api_key-
Create Firebase Project:
- Go to Firebase Console
- Create new project or use existing
- Enable Google Analytics (optional)
-
Enable Firestore Database:
- Firebase Console > Build > Firestore Database
- Create database (start in test mode for development)
- Location: choose closest region
-
Enable Authentication:
- Firebase Console > Build > Authentication
- Enable Email/Password provider
- (Optional) Enable Google provider for OAuth
-
Get Configuration:
- Project Settings > General > Your apps > Web app
- Copy config values to
.env.local
-
Security Rules:
- Firestore rules are in
firestore.rules(user-scoped access) - Deploy:
firebase deploy --only firestore:rules(requires Firebase CLI)
- Firestore rules are in
-
Start development server:
npm run dev
-
Sign up with email/password or Google OAuth
-
Explore:
- Browse Exercise Library
- Create your first workout
- Build a training program
- Execute a workout and track progress
- Check Analytics for insights
zenith-trainer/
βββ src/
β βββ app/ # Next.js App Router (routes)
β β βββ (auth)/ # Authentication routes (sign-in, sign-up)
β β βββ dashboard/ # Main dashboard
β β βββ library/ # Exercise library
β β βββ workouts/ # Workout management
β β βββ programs/ # Program management
β β βββ execute/ # Workout execution mode
β β βββ history/ # Workout history & logs
β β βββ analytics/ # Analytics & charts
β β βββ schedule/ # Weekly schedule planning
β β βββ habits/ # Habit Tracker 2.0
β β βββ api/ # API routes (AI endpoints)
β β
β βββ components/ # React components
β β βββ ui/ # Radix UI wrapper components (17 components)
β β βββ workout-*/ # Workout-specific components
β β βββ program-*/ # Program-specific components
β β βββ habit-*/ # Habit-specific components
β β βββ analytics-*.tsx # Chart components
β β βββ main-nav.tsx # Navigation
β β
β βββ lib/ # Utilities & helpers
β β βββ types/ # TypeScript types & Zod schemas
β β βββ ztl/ # ZTL DSL parser/converter
β β βββ calculations/ # Volume, 1RM, RPE calculations
β β βββ utils.ts # General utilities
β β
β βββ firebase/ # Firebase configuration
β β βββ auth.ts # Authentication setup
β β βββ firestore.ts # Firestore setup
β β βββ storage.ts # Storage setup (future)
β β
β βββ ai/ # AI integration (Genkit)
β βββ genkit.config.ts # Genkit setup
β βββ flows/ # 5 AI flows
β βββ insights.ts
β βββ progression.ts
β βββ recommendations.ts
β βββ recovery.ts
β βββ nutrition.ts
β
βββ docs/ # Project documentation
β βββ core/ # Core documentation (6 files)
β β βββ 00_PROJECT_ESSENCE.md
β β βββ 01_PRD.md
β β βββ 02_ROADMAP.md
β β βββ 03_TECH_STACK.md
β β βββ 04_ARCHITECTURE.md
β β βββ 99_SYSTEM_GUIDE.md
β β
β βββ requirements/ # Module requirements (15 files)
β β βββ 01_authentication_requirements.md
β β βββ 02_exercise_library_requirements.md
β β βββ ... (13 more modules)
β β
β βββ progress/ # Progress tracking (3 files)
β βββ modules_status.md
β βββ sprint_current.md
β βββ backlog.md
β
βββ UPMT/ # Universal Project Management Template
β βββ ClaudeCode_web_dev/ # Development system for Claude Code
β βββ structure-templates/ # Templates for docs
β βββ bootstrap/ # Bootstrap configuration
β
βββ firestore.rules # Firestore security rules
βββ .cursorrules # Cursor AI rules
βββ .env.local # Environment variables (create from .env.example)
βββ package.json # Dependencies
- Framework: Next.js 15.5.6 (App Router, Turbopack)
- UI Library: React 18.3.1 (Server Components)
- Language: TypeScript 5.x (strict mode)
- Styling: Tailwind CSS 3.x
- Components: Radix UI (17 components: Dialog, Select, Toast, Dropdown, etc.)
- Theme: next-themes (dark/light/system mode)
- Icons: lucide-react
- Charts: Recharts 2.15.1
- Drag & Drop: @dnd-kit/core + @dnd-kit/sortable
- Platform: Firebase 11.9.1
- Database: Firestore (7 collections: users, exercises, workouts, programs, workoutLogs, habits, habitLogs)
- Authentication: Firebase Auth (email/password, Google OAuth)
- Storage: Firebase Storage (for future user uploads)
- API: Next.js API Routes
- Framework: Genkit AI 1.20.0 (Google's official AI framework)
- Provider: Google Gemini API
- Flows: 5 AI flows (Insights, Progression, Recommendations, Recovery, Nutrition)
- Validation: Zod (schemas for ZTL DSL + Firestore documents)
- Date Handling: date-fns
- DSL: Custom ZTL (YAML + Zod validation)
- Testing: Playwright 1.56.1 (E2E - setup complete, tests pending)
- Linting: ESLint (Next.js config + TypeScript)
- Type Checking: TypeScript strict mode (100% typed, no
any) - Formatting: Prettier (auto-format on save)
See Tech Stack Documentation for details and version verification.
Overall Progress: 65-70% MVP Ready
| Module | Status | Priority | Completion |
|---|---|---|---|
| Authentication | β Complete | Critical | 100% |
| Exercise Library | β Complete | Critical | 100% |
| Workout Builder | β Complete | Critical | 100% |
| Program Management | β Complete | Critical | 100% |
| Workout Execution | β Complete | Critical | 100% |
| Workout History | β Complete | Critical | 100% |
| Schedule & Planning | β Complete | Critical | 100% |
| ZTL (DSL) | β Complete | High | 100% |
| Data Management | β Complete | Critical | 100% |
| Analytics | π‘ In Progress | High | 95% |
| AI Integration | π‘ In Progress | High | 60% |
| User Interface | π‘ In Progress | Critical | 95% |
| Habit Tracker 2.0 | π‘ In Progress | High | 40% |
| Performance | π‘ In Progress | Medium | 60% |
| Testing & Quality | π‘ In Progress | Medium | 20% |
MVP Status: 8/9 critical modules complete (89%) - MVP Ready
See Module Status for detailed breakdown.
- Project Essence - Vision and key innovations
- PRD - Product requirements (all 15 modules)
- Roadmap - Development timeline and milestones
- Tech Stack - Complete technology stack
- Architecture - System architecture and patterns
- System Guide - Comprehensive system guide
Each of the 15 modules has detailed requirements documentation in docs/requirements/:
01_authentication_requirements.mdthrough15_testing_quality_requirements.md
See Requirements Index for overview.
- Module Status - Current implementation status
- Current Sprint - Sprint planning and goals
- Product Backlog - Prioritized backlog (118 story points)
- β README Update (this file) - Complete project documentation
- UI Error Boundaries (5 story points) - Improve error handling
- AI Integration Stage 4.2.2 (8 SP) - One-click apply recommendations
- Analytics Stage 4.3 (6 SP) - Advanced visualizations (heatmaps, radar charts)
- Performance Monitoring (5 SP) - Firebase Performance SDK
- Habit Tracker 2.0 Stages 3-6 (34 SP) - Daily Reflection, Context Systems, AI
- Comprehensive Testing (36 SP) - E2E, unit, integration tests
- Tech Stack Migration (React 19, Next.js 16, Firebase 12, Zod 4)
See Current Sprint and Backlog for details.
Current Status: Tooling setup complete, tests pending (20%)
- TypeScript: Strict mode enabled (100% coverage, no
anytypes) - ESLint: Configured (Next.js + TypeScript rules)
- Playwright: Installed (E2E tests not written yet)
- Vitest: To be added (unit/integration tests)
Next Steps:
- Write E2E tests for critical flows (auth, workout execution, program management)
- Add unit tests for utilities and business logic (ZTL parser, calculations)
- Integration tests for API routes and components
Test Coverage Targets:
- E2E: 5 critical flows (auth, workout, program, library, habit)
- Unit: 80%+ for utilities and business logic
- Integration: API routes + critical components
See Testing Requirements for strategy.
We welcome contributions! Here's how to get started:
-
Bug Reports: Use GitHub Issues with the "bug" label
- Include: steps to reproduce, expected vs. actual behavior, screenshots
- Environment: browser, OS, Node.js version
-
Feature Requests: Use GitHub Issues with the "enhancement" label
- Describe the problem it solves
- Propose a solution (optional)
-
Fork & Clone:
git clone https://github.com/YOUR_USERNAME/studio.git cd studio -
Create Branch:
git checkout -b feature/your-feature-name # or git checkout -b fix/bug-description -
Make Changes:
- Follow code style (see below)
- Write tests for new features
- Update documentation if needed
- Ensure all tests pass
-
Commit:
git commit -m "type(scope): description - Detail 1 - Detail 2 Closes #123"
Commit types:
feat,fix,docs,refactor,test,chore -
Push & Create PR:
git push origin feature/your-feature-name
- Open PR on GitHub
- Fill out PR template
- Link related issues
TypeScript:
- β
Strict mode (no
anytypes - useunknownif needed) - β Explicit return types for functions
- β Interface over type for objects
ESLint:
- β
Fix all linter errors before commit (
npm run lint) - β No warnings in production code
Formatting:
- β
Prettier auto-format (
npm run format) - β Consistent import ordering
Testing:
- β
Tests pass (
npm test) - β Add tests for new features
- β Coverage doesn't decrease
Documentation:
- β Update docs if API/behavior changes
- β Add comments for complex logic
- β Follow Project Rules
See Dev Rules and Code Quality Checklist for detailed guidelines.
1. Firebase Connection Errors
Error: Firebase: Error (auth/invalid-api-key)Solution:
- Check
.env.localhas correct Firebase config - Ensure API key is valid (Firebase Console > Project Settings)
- Verify Firebase project exists and isn't deleted
2. Gemini API Errors
Error: API key not valid. Please pass a valid API key.Solution:
- Get API key from https://ai.google.dev/
- Add to
.env.local:GEMINI_API_KEY=your_key - Restart dev server after adding env var
3. Port Already in Use
Error: Port 3000 is already in useSolution:
# Find and kill process on port 3000
lsof -ti:3000 | xargs kill -9
# Or use different port
npm run dev -- -p 30014. TypeScript Errors After Install
Error: Cannot find module '@/components/ui/button'Solution:
# Clear Next.js cache
rm -rf .next
# Reinstall dependencies
rm -rf node_modules package-lock.json
npm install
# Restart dev server
npm run dev5. Firestore Permission Denied
Error: Missing or insufficient permissionsSolution:
- Ensure user is authenticated (sign in first)
- Check Firestore rules allow user access
- Verify Firebase Auth is enabled
- For development: set Firestore to test mode (allows all authenticated users)
6. Build Errors
# If build fails, try:
npm run build
# Check for:
# - TypeScript errors (fix with `npm run type-check`)
# - ESLint errors (fix with `npm run lint`)
# - Missing environment variablesIf you encounter issues not listed here:
- Check GitHub Issues for similar problems
- Search Next.js Docs and Firebase Docs
- Open a new issue with:
- Error message (full stack trace)
- Steps to reproduce
- Environment (Node version, OS, browser)
- What you've already tried
Q: What is ZTL DSL?
A: ZTL (Zenith Training Language) is a YAML-based domain-specific language we created for describing workout programs in a structured, AI-readable format. It allows you to export your training program as code, analyze it with AI (Claude/Gemini), and import recommendations back into the app.
Q: How does the AI integration work?
A: We use Google's Genkit framework with Gemini API. The app has 5 AI flows:
- Insights - Analyze workout performance patterns
- Progression - Suggest weight/volume increases
- Recommendations - Program optimization suggestions
- Recovery - Deload and rest recommendations
- Nutrition - Macro and calorie guidance
You can also export programs as ZTL YAML and analyze them with Claude for professional coaching insights.
Q: Is this free to use?
A: Yes, the app is open source (MIT License). You'll need your own Firebase project (free tier available) and Gemini API key (free tier: 60 requests/minute).
Q: Can I use this offline?
A: Not yet. The app requires internet connection for Firebase (database, auth) and AI features. Offline mode is planned for future releases.
Q: What browsers are supported?
A: Modern browsers with ES6+ support:
- β Chrome/Edge 90+
- β Firefox 88+
- β Safari 14+
- β Internet Explorer (not supported)
Q: Can I self-host this?
A: Yes! You can deploy to:
- Vercel (recommended - Next.js creator)
- Netlify
- Railway
- Any platform supporting Next.js
Firebase backend is cloud-hosted (Firebase free tier).
Q: How do I migrate my data?
A: Currently, data export is available via ZTL (programs only). Full data export (workouts, history, habits) is planned. For now, data is stored in your Firebase project - you own it.
Q: What about privacy/security?
A: - All data stored in your Firebase project (you own it)
- Firestore security rules enforce user-scoped access
- Passwords hashed via Firebase Auth (bcrypt)
- HTTPS enforced
- No third-party analytics (yet)
Q: Can I contribute to ZTL DSL?
A: Absolutely! ZTL is defined in src/lib/ztl/ with Zod schemas. We welcome:
- New fields/metadata
- Performance optimizations
- Validation improvements
- Documentation
See Contributing section.
Note: Screenshots and demo video coming soon after UI finalization.
Planned sections:
- Dashboard overview
- Workout Builder (drag & drop)
- Workout Execution mode (RPE tracking)
- Analytics charts (progress visualization)
- ZTL DSL export/import flow
- Habit Tracker interface
Live Demo: Coming soon (after MVP completion)
- β Core training features (100% complete)
- β ZTL DSL (100% complete)
- π‘ AI Integration Stage 4.2.2 (60% complete)
- π‘ Advanced Analytics (95% complete)
- π‘ Habit Tracker 2.0 (40% complete)
- π² Comprehensive testing (20% complete)
- Additional AI features (auto-analysis triggers)
- Mobile responsiveness improvements
- Performance optimizations
- E2E testing suite
- User feedback integration
- Mobile app (React Native or PWA)
- Social features (share workouts, community programs)
- Template marketplace
- Advanced AI (program generation, injury prediction)
- Nutrition tracking module
- Integration APIs (Strava, Fitbit, etc.)
See Roadmap Documentation for detailed timeline.
Current Team: Solo developer Development Approach: Stage-based incremental development with AI-first mindset Tech Stack: Modern (Next.js 15, React 18, Firebase 11, Genkit 1.20)
Built with:
- Universal Project Management Template (UPMT)
- Claude Code for development assistance
- GitHub for version control
This project is licensed under the MIT License - see the LICENSE file for details.
In short:
- β Use commercially
- β Modify
- β Distribute
- β Private use
β οΈ License and copyright notice required
Technologies:
- Built with Next.js, React, and Firebase
- UI components by Radix UI
- Charts by Recharts
- AI powered by Google Gemini via Genkit
- Drag & drop by @dnd-kit
- Icons by Lucide
Inspiration:
- Strong App (workout tracking)
- Renaissance Periodization (training science)
- Linear (product design and UX)
Special Thanks:
- Claude (Anthropic) for development assistance
- Cursor for AI-powered IDE
- Open source community
Questions or Feedback:
- Open an issue: GitHub Issues
- Discussions: GitHub Discussions (coming soon)
Found a bug? Please report it with:
- Steps to reproduce
- Expected vs. actual behavior
- Screenshots (if applicable)
- Environment details
Want a feature? Open a feature request issue with:
- Problem description
- Proposed solution
- Use cases
If you find Zenith Trainer useful:
- β Star the repo on GitHub
- π Report bugs and suggest features
- π§ Contribute code (see Contributing)
- π’ Share with others who might find it useful
- π Write about your experience using it
Built with β€οΈ using Universal Project Management Template (UPMT)