
π Sports & Fitness Β· State Machine
The states of a gym membership: trial, active, frozen, expiring, renewed, lapsed and cancelled.
Drawing diagramβ¦
Gym membership state machine: a lead takes a free trial, then buys a plan (active). An active member can freeze for up to 30 days and unfreeze. Near the end date the membership becomes expiring; renewal makes it active again, otherwise it lapses. Lapsed members can rejoin. Members can cancel with a refund policy.
stateDiagram-v2 [*] --> Trial Trial --> Active: buys plan Trial --> [*]: does not join Active --> Frozen: freeze request Frozen --> Active: unfreeze Active --> Expiring: 15 days left Expiring --> Active: renewed Expiring --> Lapsed: not renewed Lapsed --> Active: rejoins Active --> Cancelled: cancels Cancelled --> [*] Lapsed --> [*]
How live scores reach millions of fans within a second: official scorers, the data feed, stream processing, caching and push notifications.
Where each part of a fitness tracking product runs: the wearable, the phone app that syncs it, and the cloud services for workouts, goals and coaching.
A platform to run an amateur or professional league: team registration, fixtures, match scoring, standings and fan apps.
How a fan books tickets for a big match: queue, seat selection with a temporary hold, payment and a mobile ticket with QR code.
A timeline for organising a multi-team tournament: registrations, league stage, knockouts, final and the work around it.
A schema for a sports league: teams, players, squads per season, matches, match events and player statistics.