## Major Features - Apple Watch companion app (6 phases complete) - WatchConnectivity iPhone ↔ Watch - HealthKit integration (HR, calories) - SwiftUI premium UI - 9 complication types - Always-On Display support - Paywall screen with RevenueCat integration - Privacy Policy screen - App rebranding: tabatago → TabataFit - Bundle ID: com.millianlmx.tabatafit ## Changes - New: ios/TabataFit Watch App/ (complete Watch app) - New: app/paywall.tsx (subscription UI) - New: app/privacy.tsx (privacy policy) - New: src/features/watch/ (Watch sync hooks) - New: admin-web/ (admin dashboard) - Updated: app.json, package.json (branding) - Updated: profile.tsx (paywall + privacy links) - Updated: i18n translations (EN/FR/DE/ES) - New: app icon 1024x1024 ## Watch App Files - TabataFitWatchApp.swift (entry point) - ContentView.swift (premium UI) - HealthKitManager.swift (HR + calories) - WatchSessionManager.swift (communication) - Complications/ (WidgetKit) - UserDefaults+Shared.swift (data sharing)
4.3 KiB
4.3 KiB
Supabase Music Storage Setup
This guide walks you through setting up the Supabase Storage bucket for music tracks in TabataFit.
Overview
TabataFit loads background music from Supabase Storage based on workout musicVibe values. The music service organizes tracks by vibe folders.
Step 1: Create the Storage Bucket
- Go to your Supabase Dashboard → Storage
- Click New bucket
- Name:
music - Enable Public access (tracks are streamed to authenticated users)
- Click Create bucket
Step 2: Set Up Folder Structure
Create folders for each music vibe:
music/
├── electronic/
├── hip-hop/
├── pop/
├── rock/
└── chill/
Via Dashboard:
- Open the
musicbucket - Click New folder for each vibe
- Name folders exactly as the
MusicVibetype values
Via SQL (optional):
-- Storage folders are virtual in Supabase
-- Just upload files with path prefixes like "electronic/track.mp3"
Step 3: Upload Music Tracks
Supported Formats
- MP3 (recommended)
- M4A (AAC)
- OGG (if needed)
File Naming Convention
Name files with artist and title for best results:
Artist Name - Track Title.mp3
Examples:
Neon Dreams - Energy Pulse.mp3
Urban Flow - Street Heat.mp3
The Popstars - Summer Energy.mp3
Upload via Dashboard:
- Open a vibe folder (e.g.,
electronic/) - Click Upload files
- Select your audio files
- Ensure the path shows
music/electronic/
Upload via CLI:
# Install Supabase CLI if not already installed
npm install -g supabase
# Login
supabase login
# Link your project
supabase link --project-ref your-project-ref
# Upload tracks
supabase storage upload music/electronic/ "path/to/your/tracks/*.mp3"
Step 4: Configure Storage Policies
RLS Policy for Authenticated Users
Go to Supabase Dashboard → Storage → Policies → music bucket
Add these policies:
1. Select Policy (Read Access)
CREATE POLICY "Allow authenticated users to read music"
ON storage.objects FOR SELECT
TO authenticated
USING (bucket_id = 'music');
2. Insert Policy (Admin Upload Only)
CREATE POLICY "Allow admin uploads"
ON storage.objects FOR INSERT
TO authenticated
WITH CHECK (
bucket_id = 'music'
AND (auth.jwt() ->> 'role') = 'admin'
);
Via Dashboard UI:
- Go to Storage → Policies
- Under
musicbucket, click New policy - Select For SELECT (get)
- Allowed operation: Authenticated
- Policy definition:
true(or custom check)
Step 5: Test the Setup
- Start your Expo app:
npx expo start - Start a workout with music enabled
- Check console logs for:
[Music] Loaded X tracks for vibe: electronic
Troubleshooting
No tracks loading:
- Check Supabase credentials in
.env - Verify folder names match
MusicVibetype exactly - Check Storage RLS policies allow read access
Tracks not playing:
- Ensure files are accessible (try signed URL in browser)
- Check audio format is supported by expo-av
- Verify CORS settings in Supabase
CORS errors: Add to Supabase Dashboard → Settings → API → CORS:
app://*
http://localhost:8081
Step 6: Environment Variables
Ensure your .env file has:
EXPO_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
EXPO_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
Music Vibes Reference
The app supports these vibe categories:
| Vibe | Description | Typical BPM |
|---|---|---|
electronic |
EDM, House, Techno | 128-140 |
hip-hop |
Rap, Trap, Beats | 85-110 |
pop |
Pop hits, Dance-pop | 100-130 |
rock |
Rock, Alternative | 120-160 |
chill |
Lo-fi, Ambient, Downtempo | 60-90 |
Best Practices
- Track Duration: 3-5 minutes ideal for Tabata workouts
- File Size: Keep under 10MB for faster loading
- Bitrate: 128-192kbps MP3 for good quality/size balance
- Loudness: Normalize tracks to similar levels (-14 LUFS)
- Metadata: Include ID3 tags for artist/title info
Alternative: Local Development
If Supabase is not configured, the app uses mock tracks automatically. To force mock data, temporarily set invalid Supabase credentials.
Next Steps
- Upload initial track library (5-10 tracks per vibe)
- Test on physical device
- Consider CDN for production scale
- Implement track favoriting/personal playlists