How saadings/podcastr works
Project type and purpose
• This is a full-stack SaaS web application (“AI Podcast Platform”) built with Next.js 13’s App Router.
• It lets authenticated users create, discover, and listen to AI-generated podcasts (text-to-speech + AI thumbnail generation) and persists data in a serverless Convex backend.
Main components
a. Frontend (Next.js App)
• App Router (src/app): handles routing, server components, and client components.
• React UI Components (src/components/ui, Carousel, PodcastCard, etc.)
• Context & Hooks (src/providers/*, src/hooks/*) for audio playback and Convex/Clerk integration
• Static Assets (public/*) served via Next’s built-in static file hosting / CDN
b. Authentication Service (Clerk)
• Clerk’s hosted auth UI (sign-in/sign-up)
• Clerk API for issuing JWTs and session management
c. Backend (Convex)
• Convex Server Functions (convex/*.ts) for handling business logic (podcast creation, user management, stats)
• Convex REST/HTTP endpoints (convex/http.ts)
• Schema & DataModel (convex/schema.ts, convex/_generated/dataModel.*)
• Convex Database (serverless NoSQL)
d. External AI Services (OpenAI)
• Text-to-speech API calls (convex/openAi.ts or direct fetch from frontend)
• Image generation API calls for thumbnails
e. Browser / Client
• Users interact via web browser on desktop/mobile
Relationships and Data Flow
1. User (Browser) → Next.js Frontend:
• Navigation between pages (discover, profile, create podcast)
• Click “Create Podcast” → fills form → triggers client-side hook (useGeneratePodcast)
2. Next.js → Convex Backend:
• Convex client (ConvexClerkProvider) issues queries/mutations to fetch podcasts, user profiles, etc.
• Convex HTTP functions invoked for custom endpoints
3. Convex Backend → Convex DB:
• Read/write podcast records, user records, listening stats
4. Convex Backend → OpenAI Services:
• Pass text prompt for TTS / image generation → receive audio blobs, images → store or proxy back to frontend
5. Next.js → Clerk Auth:
• Redirects to Clerk’s sign-in/sign-up flows → returns session tokens → stored client-side
6. Next.js → Static Assets:
• Serves mp3 assets and images from public/ via built-in asset pipeline
Architectural patterns & design principles
• Separation of concerns: UI layer (Next.js pages & components) vs business logic layer (Convex functions) vs persistence (Convex DB) vs external services (OpenAI, Clerk).
• Server components (data-fetching at server-side) vs client components (hooks, providers for interactive UI).
• Provider pattern: AudioProvider for playback state, ConvexClerkProvider for auth & data access.
• Atomic UI component structure (ui/ folder) for reusability.