BikeControl (SwiftControl)
使用 Zwift Click、Zwift Play、Shimano Di2,或任何藍牙控制器搭配 MyWhoosh、Rouvy、Zwift 等。可於 iOS、Android、Windows 與 macOS 免費試用。
AI 翻譯
尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
在專案資料夾中執行 /nomorevibe verify,即可驗證所有權並自行管理介紹。
一分鐘完成驗證Split index fitness platform
翻譯準備中
取自儲存庫 README
正在載入完整 README。 以下為已儲存的摘錄。
Premium analytics platform for hybrid athletes. Objective fitness scoring that updates after every workout.
Split Index = 50% Endurance + 50% Strength
• Next.js 16 (App Router, TypeScript)
• Tailwind CSS 4 + Framer Motion
• Supabase (Auth, PostgreSQL, RLS)
• Stripe (Subscriptions)
• OpenAI (AI Coach)
• Recharts (Analytics)
Copy .env.example to .env.local and fill in your keys:檢視完整 README ↗Premium analytics platform for hybrid athletes. Objective fitness scoring that updates after every workout.
Split Index = 50% Endurance + 50% Strength
cd split-index
npm install
Copy .env.example to .env.local and fill in your keys:
cp .env.example .env.local
Create a project at supabase.com
Run the migrations in filename order — supabase db push does this for you, or paste each into the SQL
editor in turn. Several later migrations ALTER tables that earlier ones create, so the order is load-bearing.
| # | File | What it adds |
|---|---|---|
| 001 | 001_initial_schema.sql | Core schema: profiles, activities, gym exercises, workout scores, the handle_new_user signup trigger |
| 002 | 002_scoring_reference_and_leaderboards.sql | Sports reference, strength scores, leaderboards |
| 002b | 002b_apply_missing.sql | Backfill for databases created between 001 and 002 |
| 003 | 003_integrations.sql | OAuth connections and import jobs |
| 004 | 004_split_weighting.sql | User-configurable Split Index endurance/strength weights |
| 005 | 005_session_templates.sql | Session templates + file activity source for GPX/TCX import |
| 006 | 006_fix_handle_new_user_trigger.sql | Signup trigger fix |
| 007 | 007_signup_trigger_bulletproof.sql | Signup trigger hardening — see the onboarding troubleshooting below |
| 008 | 008_timezone.sql | Per-user timezone |
| 009 | 009_gym_set_details.sql | Per-set weight/reps breakdown (set_details) |
| 010 | 010_avatars_storage.sql | Avatar storage bucket and policies |
| 011 | 011_predicted_benchmarks.sql | Memory-based cardio benchmark predictions |
| 012 | 012_public_read_strength_scores.sql | Public read on strength reference scores |
| 013 | 013_predicted_benchmark_quality.sql | Prediction confidence/quality |
| 014 | 014_personalized_hr.sql | resting_hr for personalised Karvonen zones |
| 015 | 015_interval_fartlek_scoring.sql | Interval and fartlek segment fields |
| 016 | 016_date_of_birth.sql | Date of birth (age-graded scoring, HR max) |
| 017 | 017_pricing_skus_and_motivation.sql | Pricing SKUs and motivation copy |
| 018 | 018_race_prediction_riegel_k.sql | Per-user Riegel exponent on predictions |
| 019 | 019_latest_strength_scores_per_exercise.sql | Latest strength score per exercise |
| 020 | 020_friend_duels.sql | Friend duels |
| 021 | 021_outdoor_cycling.sql | Outdoor cycling support |
| 022 | 022_outdoor_cycling_sports_row.sql | Outdoor cycling sports reference row |
| 023 | 023_duel_speed_strength_metrics.sql | Duel speed/strength metrics |
| 024 | 024_squads.sql | Squads |
| 025 | 025_hybrid_athlete_reports.sql | Hybrid athlete reports |
| 026 | 026_native_billing_source.sql | Native (App Store / Play) billing source |
| 027 | 027_gps_tracking.sql | Background GPS run tracking, is_partial_track |
| 028 | 028_exercise_attachment.sql | Exercise attachment/implement |
| 029 | 029_planned_races.sql | Planned races |
| 030 | 030_planned_race_elevation_source.sql | Race elevation source |
| 031 | 031_social_activity_feed.sql | Social activity feed |
| 032 | 032_share_activities_default_true.sql | Default activity sharing to on |
| 033 | 033_training_goals.sql | Training goals |
| 034 | 034_training_goal_target_date.sql | Goal target dates (tapering, feasibility) |
| 035 | 035_training_goal_custom_distance.sql | Custom goal distances |
| 036 | 036_training_goal_target_reps.sql | Rep-based strength goals |
| 037 | 037_planned_race_known_elevation_source.sql | Known race elevation profiles |
| 038 | 038_training_goal_progress.sql | Daily goal-progress snapshots for trend estimates |
| 039 | 039_hpe_athlete_profile.sql | Hybrid Plan Engine: diagnostic runs, findings, plans, sessions |
| 040 | 040_hpe_monitoring_and_rollout.sql | HPE monitoring, feature flags (kill switch), adherence and injury reporting |
| 041 | 041_admin_roles_and_fleet_review.sql | admin_users, the fleet-review gate and the rollout audit log |
| 042 | 042_hpe_intake.sql | HPE athlete intake: safety screen answers, goal, availability and preferences |
| 043 | 043_hpe_intake_plan_flexibility.sql | Plan flexibility on the intake |
| 044 | 044_hpe_training_split.sql | Preferred training split |
| 045 | 045_scoring_basis.sql | Explicit scoring basis for athletes who are not male or female |
| 046 | 046_hpe_safety_capped_outcome.sql | The health screen caps plans instead of refusing them |
| 047 | 047_hpe_intake_overrides.sql | Manual overrides for engine-proposed 1RM and heart rates |
| 048 | 048_hpe_intake_section_regroup.sql | Remaps stored intake progress onto the regrouped sections |
| 049 | 049_private_account_visibility.sql | "Private account" switch and the activity-visibility predicate behind it |
Skipping the tail of this list breaks the social feed. 031 adds
profiles.share_activities_with_friends and the activities policy that lets a friend's workout be read at
all; 049 hardens both. Without them the Settings privacy switch reports it cannot load and the feed stays
permanently empty, because RLS returns zero rows rather than an error. Run the whole list.
After 041: the Hybrid Plan Engine ships disabled at 0% rollout and grants no admin roles. admin_users has no
INSERT policy by design, so the first operator has to be granted directly:
insert into admin_users (user_id, role, note)
values ((select id from auth.users where email = '[email protected]'), 'operator', 'Initial grant');
That account can then open /admin/hpe-fleet and work the rollout from there. SUPABASE_SERVICE_ROLE_KEY must be
set in the deployed environment or the fleet view fails closed and 404s for everyone.
Enable Email and Google OAuth in Authentication → Providers
Add your site URL to redirect allowlist: http://localhost:3000/auth/callback
Onboarding “Could not save your profile”
If onboarding fails at the final step, the database is usually missing migrations or the signup trigger:
001_initial_schema.sql then 002_scoring_reference_and_leaderboards.sql (in order).001 creates the profiles table and handle_new_user trigger (auto-creates a profile row on OAuth signup).002 adds a client-side INSERT policy on profiles so upserts work when the trigger did not run (e.g. user signed up before migrations were applied).In development, the onboarding error message includes the Supabase error text to make this obvious (e.g. relation "profiles" does not exist or RLS violations). The app also calls /api/profile/ensure before saving, which creates a missing profile row via the service role when SUPABASE_SERVICE_ROLE_KEY is set.
Signup returns “Something went wrong on our side” (HTTP 500)
Two common causes after migrations are applied:
handle_new_user fails during INSERT INTO auth.users (rolls back signup). Run supabase/diagnostics/signup_full_diagnostic.sql in the SQL Editor; section D3 prints the exact Postgres error. Fix: re-run 007_signup_trigger_bulletproof.sql.gomail or Error sending confirmation email. Fix SMTP (host, port, TLS, sender domain) or temporarily disable Confirm email under Authentication → Providers → Email to isolate.Before retrying with the same email, delete any stuck row from auth.users (see section F in the diagnostic SQL). Add https://splitindex.co.uk/auth/callback to Authentication → URL Configuration → Redirect URLs.
Required in .env.local for checkout to work:
STRIPE_SECRET_KEY — secret key from Stripe Dashboard → Developers → API keys (use sk_test_… locally)STRIPE_PRICE_ID — recurring price ID for the £5/month Premium product (starts with price_…)NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY — publishable key (for future client-side Stripe.js)STRIPE_WEBHOOK_SECRET — signing secret from your webhook endpoint (production)NEXT_PUBLIC_APP_URL — e.g. http://localhost:3000 (used for checkout success/cancel redirects)Setup steps:
STRIPE_PRICE_ID in .env.localSTRIPE_SECRET_KEYhttps://your-domain.com/api/stripe/webhookcustomer.subscription.created, updated, deletedIf Stripe is not configured, /settings/billing shows a friendly error instead of crashing.
Manual premium for testing (skip Stripe)
In the Supabase SQL editor, grant Premium to your account:
UPDATE profiles
SET subscription_tier = 'premium',
subscription_status = 'active'
WHERE user_id = (SELECT id FROM auth.users WHERE email = '[email protected]');
Use 'trialing' instead of 'active' if you want to mimic a trial. Premium gating requires subscription_tier = 'premium' and subscription_status in ('active', 'trialing').
npm run dev
src/
├── app/ # Next.js App Router pages & API routes
│ ├── api/activities/ # Workout logging & scoring
│ ├── api/stripe/ # Checkout & webhooks
│ ├── dashboard/ # Main dashboard
│ ├── activities/ # Workout forms
│ ├── analytics/ # Charts & insights
│ ├── social/ # Leaderboards & challenges
│ ├── profile/ # User profile & stats
│ └── settings/ # Account & billing
├── components/ # Reusable UI components
├── lib/
│ ├── scoring/ # Core scoring engine
│ ├── supabase/ # Database clients
│ ├── openai/ # AI Coach
│ └── stripe/ # Payments
└── types/ # TypeScript definitions
supabase/migrations/ # PostgreSQL schema + RLS
All tables live in Postgres (Supabase) with Row Level Security enabled. Users are Supabase auth.users; every user-owned table references it with ON DELETE CASCADE and owner-based RLS policies (auth.uid()).
Core (001_initial_schema.sql)
profiles — one per user (auto-created on signup), onboarding data, subscription state, and denormalized current index columns for fast leaderboardsactivities + gym_exercises — every logged workout; composite index on (user_id, started_at)workout_scores — per-activity sport index and breakdownsplit_index_history — the overall Split Index over timepersonal_records, goals, body_metrics (bodyweight history), recovery_snapshotsai_feedback — AI Coach output per activityfriends (friend requests: pending/accepted/blocked), challenges + challenge_participants, achievements + user_achievements, notifications, workout_draftsScoring reference & leaderboards (002_scoring_reference_and_leaderboards.sql)
sports — reference table for the 8 supported sports (name, endurance/strength category, metadata); public readstrength_scores — per-exercise strength scoring (estimated 1RM, relative strength, volume load)reference_values — scoring-engine benchmark standards (e.g. 5k paces, big-3 1RM/bodyweight ratios) per sport × gender × experience; seeded, public readsleep_logs — nightly sleep hours, quality, bed/wake timesleaderboard_entries — precomputed weekly/monthly/all-time rankings (refreshed by a scheduled job with the service role); public readcurrent_split_index (and endurance/strength) to profiles, kept in sync by trigger on split_index_history, plus missing indexes and tightened RLS for friend requestsRun the migrations in numeric order on a fresh project; 002 is purely additive on top of 001.
Re-running migrations (e.g. type "sport_category" already exists)
Migrations are not idempotent — do not paste the same file twice. If you see 42710: type "sport_category" already exists, migration 002 was already applied (at least partially). Run the verification queries below in the Supabase SQL editor, then:
002, run 003_integrations.sql only if you need integrations.supabase/migrations/002b_apply_missing.sql in the SQL editor instead (idempotent remainder of 002).integration_provider already exists) → skip 003; objects already exist.-- Enums (001: sport_type; 002: sport_category, leaderboard_period; 003: integration_*)
SELECT typname FROM pg_type
WHERE typname IN ('sport_type','sport_category','leaderboard_period','integration_provider','import_job_status','sync_status')
AND typtype = 'e' ORDER BY typname;
-- Key tables
SELECT table_name FROM information_schema.tables
WHERE table_schema = 'public'
AND table_name IN ('profiles','sports','goals','strength_scores','reference_values','sleep_logs','leaderboard_entries','integration_connections','import_jobs')
ORDER BY table_name;
-- 002 profile columns (leaderboard denormalization)
SELECT column_name FROM information_schema.columns
WHERE table_schema = 'public' AND table_name = 'profiles'
AND column_name IN ('current_split_index','current_endurance_index','current_strength_index','index_updated_at');
Located in src/lib/scoring/engine.ts. Key formulas:
0.5 × endurance + 0.5 × strengthFour ways in, no partner APIs:
/gym/log, /cardio/log, /activities/new), or logged in one tap from a Hybrid Plan prescription (/hybrid-plan, /gym/log?hpeSession=). source = 'manual'./cardio/gps-run), with live heart rate from a Bluetooth strap or, on iOS, AirPods Pro via a HealthKit workout session. source = 'gps'.HealthImportPlugin.swift → POST /api/health/import): workouts, HRV, resting heart rate, sleep and bodyweight from the phone's health store, which every wearable writes into. source = 'apple_health'. Foreground sync on launch and resume; see docs/logging-effort/./cardio/import → POST /api/activities/import for the preview, then POST /api/activities): GPX, TCX or FIT, dated within the last 90 days, with the route and per-sample streams where the file carries a track. source = 'file', idempotent on the file's hash.There is no Strava or Garmin OAuth. docs/logging-effort/revert-log.md lists every piece and how to undo it.
For production cron jobs, set CRON_SECRET and configure Vercel cron:
# Leaderboard rank refresh (weekly / monthly / all-time)
GET /api/cron/leaderboard
Authorization: Bearer $CRON_SECRET
# Hybrid Plan weekly reports
GET /api/cron/hybrid-reports
Authorization: Bearer $CRON_SECRET
Data export (Premium): GET /api/export/activities?format=csv or ?format=json
Central flags live in src/lib/premium/features.ts (canAccess, PREMIUM_FEATURES).
| Feature | Free | Premium |
|---|---|---|
| Full logging (manual, CSV, GPX/TCX) | ✓ | ✓ |
| Current Split Index | ✓ | ✓ |
| Per-workout cardio index | ✓ | ✓ |
| Dashboard 7-day history | ✓ | ✓ |
| Rules-based coach snippet | ✓ | ✓ |
| Country leaderboard | ✓ | ✓ |
| DOTS / GL / ExRx tiers | — | ✓ |
| Cardio HR accountability (TRIMP, EF, decoupling) | — | ✓ |
| GPT AI Coach (4 sections) | — | ✓ |
| 90-day trends & projections | — | ✓ |
| Period comparison analytics | — | ✓ |
| Global leaderboards & rank percentile | — | ✓ |
| Data export | — | ✓ |
| OAuth integrations & auto-sync | — | ✓ |
See src/lib/premium/features.ts for the canonical gate list. Highlights:
14-day free trial included.