Train Mate
An AI-assisted product built with Vercel AI SDK: programme changes validated and reviewed as diffs, never auto-applied. Used by two athletes.
Why
I built Train Mate for two of us training together with different schedules and constraints. We needed one place for programmes, shared workouts, and individual progress, without a spreadsheet or repeated copy-and-paste.
AI can draft programme changes from athlete feedback, but each one stays a proposal until someone reviews and approves it.
How it’s built
I integrated Vercel AI SDK on the server with OpenCode model providers. Feedback becomes a structured JSON proposal: the model can request clarification or draft a patch, Zod validates the result, and malformed output gets one repair attempt. Proposed changes are shown as a diff for explicit approval or rejection. The model has no file, shell, or web tools; application checks protect plan ownership, versions, and 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. Passwords are scrypt-hashed and sessions use opaque HttpOnly cookies. Unsafe cross-origin requests are rejected and repeated failed logins are throttled. Feedback and programme jobs are stored in Turso before idempotent, retryable delivery to Vercel Queues, so no production behaviour depends on an in-memory promise.
- AI-drafted programme patches are schema-validated, repaired once if needed, and shown as a diff for approval. They are 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
Demo
Screenshots
Links
Live on Vercel for two athletes, verified September 2026. A personal household product with reviewed AI changes and durable workout history; broader adoption is not claimed. Source is private.