raidio/
├── backend/ # Node.js/Express API server
├── frontend/ # Web test harness (React/Vite)
└── mobile/ # iOS/Android app (Expo/React Native)
- Node.js (v18+)
- Supabase Account
- Spotify Developer Account
- OpenAI API Key
- ElevenLabs API Key
- Xcode (for iOS Simulator)
- Create a new Supabase Project at supabase.com
- Go to SQL Editor and run the contents of
backend/src/db/schema.sql - Go to Storage and create a new public bucket named
segments - Get your Project URL and Service Role Key from Project Settings → API
- Create an app at developer.spotify.com
- Add Redirect URIs:
http://localhost:3000/auth/callback(for web testing)airadio://auth(for mobile app)
- Get your Client ID and Client Secret
Edit backend/.env:
PORT=3000
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_KEY=eyJ...your-service-key
SPOTIFY_CLIENT_ID=your-spotify-client-id
SPOTIFY_CLIENT_SECRET=your-spotify-client-secret
SPOTIFY_REDIRECT_URI=http://localhost:3000/auth/callback
OPENAI_API_KEY=sk-...your-openai-key
ELEVENLABS_API_KEY=...your-elevenlabs-keycd backend
npm install
npm run devServer will start on http://localhost:3000
cd frontend
npm install
npm run devOpen http://localhost:5173 and test:
- Login with Spotify
- Refresh playback status
- Generate AI segments
cd mobile
npm install
npx expo startPress i to launch iOS Simulator.
Testing Flow:
- Tap "Login with Spotify"
- Complete authentication in Safari
- Deep link back to app
- Play music on Spotify (desktop/mobile)
- Tap "Refresh Status"
- Tap "Trigger AI Break" → Music pauses → AI plays → Music resumes
GET /auth/login- Initiates Spotify OAuthGET /auth/callback- OAuth callback handlerPOST /auth/swap- Token swap for iOS SDKPOST /auth/refresh- Refresh tokens
GET /playback/now- Current playback statePOST /playback/pause- Pause SpotifyPOST /playback/resume- Resume Spotify
GET /user/prefs- Get user preferencesPOST /user/prefs- Update preferences
POST /segment/next- Generate AI segmentGET /segment/history- Get segment history
- Auth: Mobile app uses
?mobile=trueflag → Backend redirects toairadio://deep link - Playback: Currently uses backend API (can be upgraded to native Spotify SDK)
- AI Segments: Generated on backend → Audio stored in Supabase Storage → Played via
expo-av
- Fetch news based on user preferences
- Summarize with OpenAI (GPT-3.5)
- Check vector similarity (avoid duplicates)
- Generate TTS with ElevenLabs
- Upload MP3 to Supabase Storage
- Store metadata + embedding in Postgres
- Make sure backend is running on
localhost:3000 - iOS Simulator can access
localhostdirectly
- Get your Mac's IP:
ifconfig | grep "inet " - Update
mobile/config.tsto use your IP (e.g.,192.168.1.100:3000)
- Make sure
app.jsonhas"scheme": "airadio" - Rebuild the app after changing config
- Integrate native Spotify iOS SDK for zero-latency playback
- Add user preferences UI in mobile app
- Implement segment history view
- Add news source selection
- Deploy backend to production (Railway, Fly.io, etc.)