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

EndpointPurpose
kbird.ai/booksLibrary landing page
kbird.ai/books/wildflowerBook detail page
kbird.ai/books/tallyBook detail page
kbird.ai/audio/:book/:chapter.mp3Direct audio streaming
kbird.ai/api/statsDownload 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

ComponentFree TierPaid (if needed)
R2 Storage10 GB$0.015/GB/month
R2 Requests1M/month$0.36/M requests
Worker Requests100K/day$5/10M requests
D1500K 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

  1. Create R2 buckets
  2. Upload audiobook files
  3. Deploy enhanced Worker
  4. Build landing pages