A live streaming radio application that plays music from Google Drive with real-time features including synchronized playback, chat, and listener tracking.
- Synchronized Streaming: All listeners hear the same music at the same time
- Real-time Updates: Live "now playing" info, listener count, and chat
- Google Drive Integration: Stream music directly from your Google Drive
- Admin Panel: Manage playlists, skip songs, and view statistics
- Play History: Track what's been played
- Lightweight: HTML + HTMX + Tailwind frontend
- Runtime: Bun
- Server: Hono
- Database: Convex (reactive/real-time)
- Frontend: HTML, HTMX, Tailwind CSS
- Storage: Google Drive API
- Bun installed (see bun.sh)
- Google Cloud project with Drive API enabled
- OAuth 2.0 credentials from Google Cloud Console
-
Clone and install dependencies:
cd radio bun install -
Set up Google Drive:
See docs/GOOGLE_DRIVE_SETUP.md for detailed instructions.
Quick setup:
bun setup:gdrive
Follow the interactive prompts to authenticate with Google Drive and get your credentials.
Then add the credentials to
.env:cp .env.example .env # Edit .env and add your Google Drive credentials -
Set up Convex:
npx convex dev
This will:
- Create a Convex account (if needed)
- Initialize your backend
- Generate
.env.localwith your deployment URL
-
Set up admin account:
a. Add your email to
.env:ADMIN_EMAIL=[email protected]
b. Start the dev server:
bun dev
c. Create account at http://localhost:3000/admin-auth.html
d. Grant admin privileges:
bun admin:grant
e. Sign in at http://localhost:3000/admin-auth.html
-
Configure frontend:
Open
public/app.js,public/admin.html, andpublic/admin-auth.htmland replace:const convexUrl = "REPLACE_WITH_YOUR_CONVEX_URL";
with your actual Convex deployment URL from
.env.local. -
Access the app:
- Radio player: http://localhost:3000
- Admin panel: http://localhost:3000/admin.html
- Admin login: http://localhost:3000/admin-auth.html
- Upload music files to a Google Drive folder
- Get the folder ID from the URL:
https://drive.google.com/drive/folders/FOLDER_ID_HERE - Go to
/admin.html - Paste the folder ID and click "Sync Folder"
- Your songs will be imported to the library
From the admin panel:
- Click "Play" on any song to start streaming
- All listeners will automatically start hearing the stream
- Use "Skip Current Song" to move to the next track
- Go to http://localhost:3000
- Enter a username
- You'll see:
- Now playing info
- Live listener count
- Chat with other listeners
- Play history
radio/
├── convex/ # Convex backend
│ ├── schema.ts # Database schema
│ ├── radio.ts # Radio functions
│ ├── chat.ts # Chat functions
│ └── listeners.ts # Listener tracking
├── server/ # Hono streaming server
│ ├── index.ts # Main server
│ ├── stream.ts # Audio streaming
│ └── drive.ts # Google Drive API
├── public/ # Frontend
│ ├── index.html # Main player
│ ├── admin.html # Admin panel
│ └── app.js # Convex client
└── scripts/ # Utilities
└── setup-google-drive.ts
The app uses a hybrid architecture:
- Convex handles all real-time state (now playing, chat, listeners, history)
- Hono/Bun server streams audio from Google Drive
- HTML frontend connects to Convex for reactive updates
All listeners stay synchronized because:
- Server stores a
startedAttimestamp in Convex - Clients calculate their position:
(Date.now() - startedAt) / 1000 - Everyone plays from the same position in the same song
Create a .env file (see .env.example):
GOOGLE_CLIENT_ID=your-client-id
GOOGLE_CLIENT_SECRET=your-client-secret
GOOGLE_REDIRECT_URI=http://localhost:3000/auth/callback
GOOGLE_CREDENTIALS={"access_token":"...","refresh_token":"..."}
PORT=3000Convex auto-generates .env.local:
CONVEX_DEPLOYMENT=https://your-deployment.convex.cloudbun dev # Start dev servers
bun setup:gdrive # Configure Google Drive
bun admin:grant # Grant admin privileges
npx convex dev # Convex dev mode
bun start # Production server
npx convex deploy # Deploy Convex backend-
Deploy Convex backend:
npx convex deploy
-
Deploy Hono server to your hosting provider (Vercel, Fly.io, etc.)
-
Update environment variables in production
-
Update Convex URLs in
public/app.jsandpublic/admin.html
- Auto-play algorithm (shuffle, playlists, moods)
- Song metadata extraction from ID3 tags
- Playlist management
- Voting/skip requests
- Multiple radio channels
- Audio visualization
- DJ mode with manual control
- CLAUDE.md - Complete technical reference for developers and Claude Code
- docs/GOOGLE_DRIVE_SETUP.md - Google Drive API setup guide
- docs/ - Additional documentation
ISC
Feel free to submit issues and enhancement requests!