Skip to content

Design Mode: Sports Decision Training Platform

April 26, 2026

This case study covers the Design Mode session for a sports cognitive training platform. The platform was subsequently deployed to GCP using Deploy Mode — that session is covered in a separate case study.


At a glance

ProjectDecision-training platform for ice hockey players
ModeDesign Mode (later deployed via Deploy Mode)
StackNext.js, Supabase, Stripe, OpenAI, n8n
Core mechanicsTimed scenario quizzes, AI coaching, 30-day programs, Player DNA, gamification
BillingStripe subscriptions
OutputSystem design, data model, agent prompts, billing flow, deploy plan

The brief

A sports coaching company needed a premium web application where ice hockey players could train their decision-making and hockey sense. The product had several interconnected requirements:

  • Adaptive scenario training — timed, scenario-based quizzes under time pressure, with instant coaching feedback after each decision.
  • AI coaching — a GPT-powered coach that gives personalised feedback based on the player’s performance history.
  • 30-day structured programs — predefined training arcs that combine in-app scenarios with real-game application tasks and post-game check-ins.
  • Player DNA profile — a cognitive profile that evolves as the player trains, showing strengths, weaknesses and peer benchmarks.
  • Gamification — streaks, badges, leaderboards.
  • SaaS billing — Free Trial, Monthly, Annual tiers via Stripe.
  • Admin CMS — for coaches to add, edit and categorise the scenario library.

The architectural decision

One Next.js application. One Supabase project. Three external integrations.

The plan evaluated splitting the AI coaching service, the training engine and the CMS into separate services. The decision against microservices was explicit:

The team size and traffic profile do not justify the operational overhead of separate services. A monolithic Next.js application with server-side API routes handles all business logic. Supabase provides database, auth, storage and Row Level Security — eliminating the need for a separate auth service or a custom storage layer.

Architecture:

Next.js Application
├── Landing / Marketing pages
├── Training Engine → scenario quiz, timer, answer capture
├── AI Coach Chat → GPT API + player history context
├── 30-Day Programs → structured arc + post-game check-ins
├── Player DNA Dashboard → cognitive profile + peer benchmarks
├── Gamification layer → streaks, badges, leaderboard
└── Admin CMS → scenario library management
Next.js API Routes (server-side)
├── → Supabase (DB, Auth, Storage, RLS)
├── → OpenAI GPT API (AI coach)
├── → Stripe (subscription billing)
└── → n8n (background workflow automation)

Key design decisions

Adaptive difficulty

The training engine adjusts scenario difficulty based on rolling performance. The plan defined a simple but explicit algorithm: track correct/incorrect ratio over the last 10 scenarios per category. If above 80% correct, increase difficulty tier. If below 50%, decrease. No ML model — a deterministic rule that is inspectable and adjustable by coaches.

AI coach context window

The GPT coach has access to the player’s last 30 scenarios, category performance breakdown, current training program and Player DNA summary. The context is assembled server-side before the GPT call — not passed raw from the client.

This prevents prompt injection from the client and keeps the context size bounded regardless of how long the player has been on the platform.

Player DNA

Not a score — a multi-dimensional profile across cognitive categories (spatial awareness, pattern recognition, pressure decision-making, positioning). Each dimension is computed from performance on scenarios tagged to that category. Peer benchmarks are computed from anonymised aggregate data across all players at the same subscription tier.

Supabase Row Level Security

All data access in the frontend goes through Supabase’s RLS policies. Players can only read their own scenarios, results and profile. Coaches can read their assigned players. Admins can read everything. No custom auth middleware required — RLS handles it at the database layer.

n8n for background workflows

Post-game check-in reminders, streak notifications, program completion emails and leaderboard recalculation run via n8n workflows triggered by Supabase webhooks. This keeps background logic out of the Next.js application and allows coaches to modify workflow behaviour without touching code.


Technology stack

LayerChoiceRationale
Frontend + APINext.jsSSR for landing/marketing SEO; server API routes for business logic; React for training UI
Database + Auth + StorageSupabaseManaged PostgreSQL, built-in auth, RLS, storage — eliminates three separate services
AI CoachingOpenAI GPT-4Strong reasoning, function calling for structured coaching output
BillingStripeStandard SaaS billing, subscription management, webhook events
Background workflowsn8nVisual workflow editor, Supabase webhook integration, no-code modifiable by coaches
DeploymentGoogle Cloud RunContainerised Next.js, auto-scaling, managed SSL

Milestones

  • M1 — Authentication + Supabase setup + subscription gating (Free/Monthly/Annual).
  • M2 — Scenario training engine: quiz rendering, timer, answer capture, immediate feedback.
  • M3 — AI Coach: GPT integration, context assembly, coaching output rendering.
  • M4 — 30-Day Programs: arc definition, daily task assignment, post-game check-ins via n8n.
  • M5 — Player DNA: profile computation, dashboard, peer benchmarks.
  • M6 — Gamification: streaks, badges, leaderboard.
  • M7 — Admin CMS: scenario CRUD, category management, difficulty tagging.
  • M8 — Production hardening + Stripe webhook validation + monitoring.

Risks identified in the plan

RiskMitigation
GPT latency in coaching feedbackStream the response; show typing indicator. Target <3s first token.
Scenario library too small at launchLaunch with 50 curated scenarios across 5 categories. Coach CMS enables continuous growth.
Stripe webhook reliabilityIdempotent webhook handlers; replay failed events from Stripe dashboard.
Supabase RLS misconfigurationWrite integration tests for each RLS policy before launch.
Player retention after Free Trial30-day program is the retention hook — players commit to a program, not just the app.

Honest limitations

  • The AI coach quality depends on scenario tagging quality. Poorly tagged scenarios produce generic coaching feedback.
  • Peer benchmarks are only meaningful once there is a user base. At launch, the comparison pool is too small to be statistically significant.
  • The adaptive difficulty algorithm is deterministic and simple. It does not model fatigue, time-of-day effects or scenario variety. A more sophisticated model would require training data from real player sessions.
  • n8n introduces an external dependency for background workflows. If n8n goes down, reminders and notifications stop — training and billing are unaffected.

Browse the full case study library →