Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions IMPLEMENTATION_PLAN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Implementation Plan - Podcast Generator

## Phase 0: Git Setup
- [x] Check if the current directory is an initialized git repository.
- [x] If it is, create and checkout a new feature branch named `podcast-generator`.

## Phase 1: Project Initialization
- [x] Initialize a new Next.js application using `create-next-app` with TypeScript, Tailwind CSS, and App Router.
- [x] Install necessary backend dependencies: `rss-parser`, `@google/genai` (for Gemini), `@google-cloud/text-to-speech`.
- [x] Install utility dependencies: `uuid`, `clsx`, `tailwind-merge`.
- [x] Create a `.env.local` file and add placeholders for `GEMINI_API_KEY` and `GOOGLE_APPLICATION_CREDENTIALS` (content/path).
- [x] Verify the project builds and runs locally (`npm run dev`).

## Phase 2: Core Frontend UI
- [x] Create a global Context (`FeedContext`) to manage the list of RSS feeds and generated podcasts state.
- [x] Create a `Hero` component with a placeholder or generated image of a robot news anchor.
- [x] Create a `FeedInput` component allows users to type a URL and add it to the state.
- [x] Create a `FeedList` component to display active feeds with a "Remove" button.
- [x] Create a `PodcastPlayer` component that wraps the standard HTML5 audio element and displays podcast details.
- [x] Assemble the `page.tsx` with the Hero, Feed management section, and a "Generate Podcast" button (initially disabled if no feeds).

## Phase 3: Backend Services - RSS & Gemini
- [x] Create a Next.js API route handler at `app/api/generate/route.ts`.
- [x] Implement the `fetchFeeds` function: Use `rss-parser` to fetch user-provided URLs, merge items, sort by date, and slice the top 3 unique articles.
- [x] Implement the `summarizeArticle` function: Use `@google/genai` to send article content to the Gemini `gemini-2.5-flash` model with the specific prompt defined in specs.
- [x] Create an "Intro" and "Outro" script generator (can be simple static text or AI-enhanced).

## Phase 4: Backend Services - Audio & Stitching
- [x] Implement the `generateAudio` function: Use `@google-cloud/text-to-speech` to convert text segments (Intro, Summaries, Outro) into MP3 binary buffers.
- [x] Implement the `stitchAudio` function: Concatenate the resulting audio buffers into a single buffer.
- [x] Implement file saving: Write the final buffer to `public/podcasts/[uuid].mp3`.
- [x] Ensure the `public/podcasts` directory exists or create it dynamically.

## Phase 5: Integration & Polish
- [x] Connect the Frontend "Generate" button to the `/api/generate` endpoint.
- [x] Implement a loading state in the UI (spinner or progress bar) while the API is processing.
- [x] Handle API responses: On success, update the `PodcastContext` with the new podcast URL and show the Player.
- [x] Implement error handling: Display toast notifications or alerts if RSS fetching or AI generation fails.
- [x] Style the application using Tailwind CSS to match the "modern & clean" aesthetic.

## Phase 6: Completion & Version Control
- [ ] Verify application functionality: Add feeds, generate podcast, play audio.
- [ ] Create a `README.md` file explaining the application functions, how to interact with them, the architecture, file breakdown and how to run and test it locally.
- [ ] Add all changes to the repository (`git add .`).
- [ ] Commit the changes (`git commit -m "Complete implementation of Podcast Generator"`).
- [ ] Push the feature branch to the remote repository, creating a branch with the same name in the remote repository, using the Gemini CLI github MCP server.
- [ ] Open a pull request for the feature branch using the Gemini CLI github MCP server, leave it open for review, don't merge it.
41 changes: 41 additions & 0 deletions podcast-generator/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# env files (can opt-in for committing if needed)
.env*

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
55 changes: 55 additions & 0 deletions podcast-generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# AI News Podcast Generator

This application allows users to generate personalized daily news podcasts from their favorite RSS feeds using AI summarization and natural-sounding text-to-speech.

## Features

- **RSS Feed Management**: Add and remove multiple RSS feeds.
- **AI Summarization**: Uses Google Gemini (`gemini-2.5-flash`) to summarize the top stories.
- **Audio Generation**: Uses Google Cloud Text-to-Speech (Chirp) to create a seamless audio experience.
- **Playback**: Built-in audio player to listen to your generated podcasts.

## Architecture

- **Frontend**: Next.js 14+ (App Router), Tailwind CSS, React Context.
- **Backend**: Next.js API Routes (`/api/generate`).
- **AI**: Google Gemini API & Google Cloud TTS.

## Prerequisites

- Node.js 18+
- Google Gemini API Key
- Google Cloud Project with Text-to-Speech API enabled and credentials JSON.

## Setup

1. Clone the repository.
2. Install dependencies:
```bash
cd podcast-generator
npm install
```
3. Configure Environment Variables:
- Create `.env.local` in `podcast-generator/`.
- Add:
```env
GEMINI_API_KEY=your_key
GOOGLE_APPLICATION_CREDENTIALS=path/to/credentials.json
```
4. Run Development Server:
```bash
npm run dev
```
5. Open [http://localhost:3000](http://localhost:3000).

## Usage

1. Paste an RSS feed URL (e.g., `https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml`) into the input field.
2. Click "Add". Add more feeds if desired.
3. Click "Generate Podcast".
4. Wait for the AI to process and generate the audio (this may take 10-20 seconds).
5. Listen to your custom news update!

## Testing

Currently, the project supports manual testing via the UI. Ensure you have valid API keys to test the full generation pipeline.
18 changes: 18 additions & 0 deletions podcast-generator/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { defineConfig, globalIgnores } from "eslint/config";
import nextVitals from "eslint-config-next/core-web-vitals";
import nextTs from "eslint-config-next/typescript";

const eslintConfig = defineConfig([
...nextVitals,
...nextTs,
// Override default ignores of eslint-config-next.
globalIgnores([
// Default ignores of eslint-config-next:
".next/**",
"out/**",
"build/**",
"next-env.d.ts",
]),
]);

export default eslintConfig;
7 changes: 7 additions & 0 deletions podcast-generator/next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
/* config options here */
};

export default nextConfig;
Loading
Loading