blog-backup/PODCAST_ARCHITECTURE.md
OpenClaw Bot 9720390e1a Add podcast feature with TTS, RSS feed, and web player
- Multi-provider TTS service (OpenAI, Piper, macOS say)
- Supabase Storage integration for audio files
- RSS 2.0 feed with iTunes extensions for podcast distribution
- Web audio player at /podcast page
- Integration with daily digest workflow
- Manual TTS generation script
- Complete documentation in PODCAST_SETUP.md
2026-02-23 20:15:27 -06:00

2.8 KiB

Podcast Architecture & Implementation Plan

Overview

Convert Daily Digest blog posts into a podcast format with automated TTS generation, RSS feed for distribution, and Supabase Storage for audio file hosting.

Architecture

1. Database Schema Updates

Add audio_url and audio_duration fields to the blog_messages table.

2. TTS Generation

Option A: Piper TTS (Recommended - Free)

  • Local execution, no API costs
  • High quality neural voices
  • Fast processing
  • No rate limits

Option B: OpenAI TTS (Paid)

  • Premium quality voices
  • Simple API integration
  • ~$2-4/month for daily 5-min content

3. Audio Storage

  • Provider: Supabase Storage
  • Bucket: podcast-audio
  • Cost: Free tier includes 1GB storage
  • Access: Public read via signed URLs

4. RSS Feed Generation

  • Endpoint: /api/podcast/rss
  • Format: RSS 2.0 with iTunes extensions
  • Compatible with: Apple Podcasts, Spotify, Google Podcasts
  • Auto-updates: Pulls from blog_messages table

5. Integration Points

  1. Daily Digest Workflow (/api/digest POST):

    • After saving post, trigger async TTS generation
    • Upload audio to Supabase Storage
    • Update database with audio_url
  2. RSS Feed (/api/podcast/rss):

    • Returns XML RSS feed
    • Includes all posts with audio_url
  3. Podcast Page (/podcast):

    • Web player for each episode
    • Subscribe links
    • Episode list

Implementation Steps

Phase 1: Database & Storage Setup

  1. Create podcast-audio bucket in Supabase
  2. Add columns to blog_messages table

Phase 2: TTS Service

  1. Create src/lib/tts.ts - TTS abstraction
  2. Create src/lib/storage.ts - Supabase storage helpers
  3. Create src/scripts/generate-tts.ts - TTS generation script

Phase 3: API Endpoints

  1. Create src/app/api/podcast/rss/route.ts - RSS feed
  2. Update src/app/api/digest/route.ts - Add TTS trigger

Phase 4: UI

  1. Create src/app/podcast/page.tsx - Podcast page
  2. Update post display to show audio player

Phase 5: Documentation

  1. Create PODCAST_SETUP.md - Setup instructions
  2. Update README with podcast features

Cost Estimate

  • Piper TTS: $0 (local processing)
  • OpenAI TTS: ~$2-4/month
  • Supabase Storage: $0 (within free tier 1GB)
  • RSS Hosting: $0 (generated by Next.js API)
  • Total: $0 (Piper) or $2-4/month (OpenAI)

File Structure

src/
├── app/
│   ├── api/
│   │   ├── digest/route.ts (updated)
│   │   └── podcast/
│   │       └── rss/route.ts (new)
│   ├── podcast/
│   │   └── page.tsx (new)
│   └── page.tsx (updated - add audio player)
├── lib/
│   ├── tts.ts (new)
│   ├── storage.ts (new)
│   └── podcast.ts (new)
└── scripts/
    └── generate-tts.ts (new)