How sanych44474/trix works
trix is an AI strength-and-nutrition coach delivered through Telegram and a Telegram Mini App. The main journey is onboarding and plan creation, workout delivery and logging, then progression, nutrition/recovery tracking and coaching follow-up. Human trainers can manage clients alongside the solo-athlete flow; motivation, reminders and owner tools are additional capabilities. The README documents the high-level runtime wiring, while sampled source confirms selected bot, AI and D1 relationships; unsampled feature links are omitted where their callers are not evidenced.
Main entry points: router.ts Bot routing · index.ts Worker runtime · v2Users.ts User records · App.tsx Mini App
Components 22
User surfaces
- Telegram chat
- Mini App
apps/mini-app/src/App.tsx - Bot routing
src/bot/router.ts
Coaching workflows
- Onboarding
src/bot/onboarding.ts - Training plans
src/bot/plan.ts - Nutrition coaching
src/features/nutrition/nutritionLog.ts - Trainer tools
src/features/trainer/trainer.ts
Training and wellbeing
- Workout logger
apps/mini-app/src/train/useSession.ts - Progression logic
src/domain/progression.ts - Body and recovery
src/adapters/d1/v2Tracking.ts - Gamification
src/features/gamification/challenges.ts
Runtime services
- Worker runtime
src/index.ts - AI provider chain
src/ai/index.ts - Scheduled coaching
src/scheduler.ts
Persistence
- D1 database
- User records
src/adapters/d1/v2Users.ts - Plan records
src/adapters/d1/v2Plans.ts - Workout records
src/adapters/d1/v2Workouts.ts - Nutrition records
src/adapters/d1/v2Nutrition.ts - Trainer records
src/adapters/d1/v2Trainer.ts
Other components
- Athlete
- Human trainer
Connections 28
- Athlete → Telegram chat: messages
- Athlete → Mini App: uses
- Human trainer → Telegram chat: manages clients
- Telegram chat → Worker runtime: webhook
- Mini App → Worker runtime: API requests
- Worker runtime → Bot routing: routes chat
- Bot routing → Onboarding: starts interview
src/bot.ts - Bot routing → Training plans: handles plans
src/bot/router.ts - Bot routing → AI provider chain: requests coaching
src/bot.ts - Bot routing → User records: loads user
src/bot/router.ts - Onboarding → User records: updates profile
- Training plans → Plan records: saves plan
src/bot.ts - Mini App → Workout logger: renders logger
apps/mini-app/src/App.tsx - Workout logger → Workout records: saves sessions
- Workout logger → Progression logic: supports progression
- Nutrition coaching → AI provider chain: parses meals
src/features/nutrition/nutritionLog.ts - Nutrition coaching → Nutrition records: stores food logs
src/features/nutrition/nutritionLog.ts - Body and recovery → D1 database: reads and writes
- Trainer tools → Trainer records: manages relationships
src/features/trainer/trainer.ts - Trainer tools → User records: updates clients
src/features/trainer/trainer.ts - Gamification → D1 database: records activity
- Worker runtime → Scheduled coaching: runs cron
src/index.ts - Scheduled coaching → D1 database: reads and writes
- User records → D1 database: persists accounts
src/adapters/d1/v2Users.ts - Plan records → D1 database: persists plans
src/adapters/d1/v2Plans.ts - Workout records → D1 database: persists workouts
- Nutrition records → D1 database: persists nutrition
src/adapters/d1/v2Nutrition.ts - Trainer records → D1 database: persists trainer data