Cloudflare Audiobook Self-Distribution Infrastructure
Architecture
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β User Request ββββββΆβ Cloudflare ββββββΆβ R2 Storage β
β (kbird.ai) β β Worker β β (MP3 files) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β
βΌ
βββββββββββββββββββ
β Analytics β
β (D1/Analytics) β
βββββββββββββββββββ
Components
1. R2 Buckets (Object Storage)
- audiobooks-bucket: Store all MP3 files
- covers-bucket: Audiobook cover art
- segments-bucket: Individual chapter segments (optional)
2. Cloudflare Worker
- Serve files with proper MIME types
- Handle range requests (streaming/scrubbing)
- Rate limiting / abuse protection
- Download tracking
- CORS headers for embeddable players
3. D1 Database (SQLite)
- Track downloads per book/chapter
- User email collection (optional)
- Referral tracking
4. Routes
| Endpoint | Purpose |
|---|
kbird.ai/books | Library landing page |
kbird.ai/books/wildflower | Book detail page |
kbird.ai/books/tally | Book detail page |
kbird.ai/audio/:book/:chapter.mp3 | Direct audio streaming |
kbird.ai/api/stats | Download stats |
Implementation Plan
Phase 1: R2 Setup + Basic Worker
- Create R2 buckets
- Upload WILDFLOWER + TALLY files
- Worker with basic file serving
- Range request support
Phase 2: Landing Pages
- Book detail pages
- Embedded audio player
- Download buttons (all formats)
Phase 3: Analytics
- D1 database
- Download tracking
- Dashboard
Phase 4: Advanced Features
- Email capture for updates
- Referral program
- RSS feeds for podcast apps
Cost Estimate
| Component | Free Tier | Paid (if needed) |
|---|
| R2 Storage | 10 GB | $0.015/GB/month |
| R2 Requests | 1M/month | $0.36/M requests |
| Worker Requests | 100K/day | $5/10M requests |
| D1 | 500K rows | $5/25M rows |
For ~5GB of audiobooks with moderate traffic: FREE
File Naming Convention
wildflower/
βββ wildflower_hybrid_ch01.mp3
βββ wildflower_cinematic_ch01.mp3
βββ wildflower_immersive_ch01.mp3
βββ wildflower_complete_hybrid.mp3 (all chapters)
tally/
βββ tally_hybrid_ch01.mp3
βββ tally_hybrid_ch02.mp3
βββ tally_complete.mp3
Security Considerations
- No authentication needed (public distribution)
- Rate limiting to prevent abuse
- Signed URLs for premium content (future)
Next Steps
- Create R2 buckets
- Upload audiobook files
- Deploy enhanced Worker
- Build landing pages