← All projects

Personal training platform

Anonymized client

The website and day-to-day tool of an online personal trainer: prospects book a call, clients follow their plan from a portal and the trainer runs everything from a dashboard.


My role
Technical lead: architecture, development with AI agents, code review and deployment.
Status
In production, with real clients.
Stack

Next.js 14 · Fastify 4 · PostgreSQL 17 · Prisma · Socket.IO · Anthropic API · n8n · Cloudflare R2 · Docker · Caddy

Putting together a custom meal plan for every client takes a lot of time, and weekly follow-up gets scattered when there's no single place to keep it all.

Caddy splits traffic between the web app (Next.js) and the API (Fastify), both deployed blue-green. The API is the only piece that talks to the database, email, video storage and the AI.

CaddyCaddyCaddy → WebCaddy → APIWeb blue-greenWebblue-greenAPI blue-greenAPIblue-greenAPIAPI → PostgreSQLPostgreSQLPostgreSQLAPI → n8n (email)n8n (email)n8n (email)API → R2 (videos)R2 (videos)R2 (videos)API → Anthropic APIAnthropic APIAnthropic API
CaddyCaddyCaddy → WebCaddy → APIWeb blue-greenWebblue-greenAPI blue-greenAPIblue-greenAPIAPI → PostgreSQLPostgreSQLPostgreSQLAPI → n8n (email)n8n (email)n8n (email)API → R2 (videos)R2 (videos)R2 (videos)API → Anthropic APIAnthropic APIAnthropic API
  • The AI suggests, but it doesn't do the math. The model picks real foods from the catalog and their quantities, but calories and macros are calculated by the backend. Then everything is validated again, and if a meal falls out of range it goes back to the model to fix. What comes out is a draft the trainer reviews before publishing it.

  • From $1.37 to $0.44 per plan. At first, every turn resent the whole conversation. With caching and iteration limits, the cost dropped to a third. For local development I use an open model, so testing costs nothing.

  • Handling health data with care. Staff and clients sign in through separate entry points, and explicit rules keep health information out of the logs and away from the AI.

  • Deploying without downtime. Every change to main goes through CI and is deployed blue-green, with automatic rollback if anything fails.

  • Visitors: public website, contact form and call booking.

  • Clients: health profile, weight and meal check-ins, PDF plans and Google sign-in.

  • Trainer: prospects and calendar, client profiles, plan composer and food and exercise catalogs.