← back to projects
train-mate

Train Mate

Private full-stack training app for Craig and Melissa: AI-drafted programme changes reviewed and approved as diffs, never auto-applied.

Private repo
next.jstypescriptaitursovercelsqliteauthfullstack
Home: active programme, next session up
01 · Why

Paper programme builders - or pasting into Liftosaur - don’t adapt well to two athletes training toward the same event with different injury histories and constraints. Craig and Melissa needed one programme builder that could hold both schedules, safety rules, and history without becoming a spreadsheet.

AI is genuinely useful for drafting programme changes from athlete feedback, but a training plan isn’t something to let a model quietly edit. The brief was AI-assisted, human-approved: propose, never apply.

02 · What

A Next.js app on Turso, with OpenCode Go called directly from server-only AI SDK code. Athlete feedback becomes a structured JSON patch validated against a schema, repaired once automatically if malformed, then shown as a diff the athlete explicitly applies or rejects. The model has no file, shell, or web tools, and can’t touch the seeded race date or profile safety rules.

Each participant has an independent schedule and prescription, with shared sessions stored once and referenced per profile so history and completion state never collide. Scrypt-hashed auth, opaque HttpOnly sessions, throttled logins, and idempotent Vercel Queue delivery so no production behaviour depends on an in-memory promise.

03 · Stack
Next.jsTypeScriptTursoVercel QueuesOpenCode AI SDKZodPWA
04 · Features
  • AI-drafted programme patches validated against a Zod schema, repaired once, shown as an explicit diff - never auto-applied
  • Independent per-athlete schedules sharing canonical workout records, so history never collides between profiles
  • Scrypt-hashed auth, opaque HttpOnly sessions, throttled logins, cross-origin request rejection
  • Idempotent, retryable Vercel Queue delivery for AI jobs and programme writes
  • Mobile-first month calendar with scheduled/in-progress/complete/skipped/overdue states
  • Per-set logging (reps, load, distance, time, RPE) with automatic PR detection against session history
06 · Status

Live for two real users (Craig + Melissa) via Vercel, with a private Tailscale-hosted fallback on Craig’s Mac. Source is private - this is a household app, not a product - but the AI patch-review workflow and queue-backed persistence are real production patterns.