diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..10a3913a --- /dev/null +++ b/.gitignore @@ -0,0 +1,45 @@ +# 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 +node_modules + +/src/generated/prisma +*.db diff --git a/IMPLEMENTATION_PLAN.md b/IMPLEMENTATION_PLAN.md new file mode 100644 index 00000000..d8ba5319 --- /dev/null +++ b/IMPLEMENTATION_PLAN.md @@ -0,0 +1,50 @@ +# 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: Environment & Project Setup +- [x] Initialize a new Next.js project with TypeScript, Tailwind CSS, and App Router. +- [x] Install backend dependencies: `prisma`, `@prisma/client` (or `better-sqlite3`), `rss-parser`, `fluent-ffmpeg`, `@google/generative-ai` (Gemini SDK), `@google-cloud/text-to-speech`. +- [x] Install frontend dependencies: `lucide-react` (for icons), `axios` or use `fetch`. +- [x] Configure Environment Variables (`.env.local`): `GOOGLE_AI_API_KEY`, `GOOGLE_APPLICATION_CREDENTIALS`, `DATABASE_URL`. +- [x] Verify `ffmpeg` installation on the local machine. + +## Phase 2: Database & Data Access +- [x] Initialize Prisma with SQLite provider (`npx prisma init --datasource-provider sqlite`). +- [x] Define `Feed` model in `prisma/schema.prisma` (id, url, title, createdAt). +- [x] Define `Podcast` model in `prisma/schema.prisma` (id, title, filePath, duration, createdAt, summary). +- [x] Run migration to create the SQLite database (`npx prisma migrate dev --name init`). +- [x] Create a `db.ts` lib file to export the singleton Prisma client instance. + +## Phase 3: Backend Services (Core Logic) +- [x] **RSS Service**: Create `lib/services/rss.ts`. Implement `fetchLatestArticles(feeds)` using `rss-parser`. Filter articles from the last 24 hours. +- [x] **AI Service (Summarization)**: Create `lib/services/gemini.ts`. Implement `generatePodcastScript(articles)` using the Gemini API. Construct the prompt as specified in the Tech Spec. +- [x] **TTS Service (Synthesis)**: Create `lib/services/tts.ts`. Implement `synthesizeSpeech(text)` using Google Cloud TTS (Chirp model). Handle text chunking if necessary. +- [x] **Audio Service (Processing)**: Create `lib/services/audio.ts`. Implement `concatAudioSegments(segments, outputPath)` using `fluent-ffmpeg` to merge Intro + Body + Outro. + +## Phase 4: API Routes +- [x] **Feed Endpoints**: Create `app/api/feeds/route.ts` and `app/api/feeds/[id]/route.ts`. Implement GET (list), POST (add & validate), DELETE (remove). +- [x] **Podcast Endpoints**: Create `app/api/podcasts/route.ts`. Implement GET (list history). +- [x] **Generation Endpoint**: Create `app/api/podcasts/generate/route.ts`. Implement POST. This should orchestrate the full pipeline: Fetch RSS -> Summarize -> TTS -> Concat -> Save to DB -> Return Result. + +## Phase 5: Frontend - UI Components +- [x] **Layout & Hero**: Update `app/page.tsx` with a responsive layout. Add the Hero section with the "Robot agent reading news" image (placeholder or generated). +- [x] **Feed Manager Component**: Create `components/FeedManager.tsx`. Implement a form to add URLs and a list to display/delete current feeds. Connect to `/api/feeds`. +- [x] **Podcast History & Player**: Create `components/PodcastPlayer.tsx`. Display a list of generated podcasts. When selected, play the audio file using the standard `