# Epic 3: Web Application MVP & Podcast Consumption **Goal:** To set up the frontend project in its dedicated repository and develop and deploy the Next.js frontend application MVP, enabling users to consume the "BMad Daily Digest." This includes initial project setup (AI-assisted UI kickstart from `bmad-daily-digest-ui` scaffold), pages for listing and detailing episodes, an about page, and deployment. ## User Stories **Story 3.1: Frontend Project Repository & Initial UI Setup (AI-Assisted)** * **User Story Statement:** As a Developer, I need to establish the `bmad-daily-digest-frontend` Git repository with a new Next.js (TypeScript, Node.js 22) project, using the provided `bmad-daily-digest-ui` V0 scaffold as the base. This setup must include all foundational tooling (ESLint, Prettier, Jest with React Testing Library, a basic CI stub), and an initial AWS CDK application structure, ensuring the "80s retro CRT terminal" aesthetic (with Tailwind CSS and shadcn/ui) is operational, so that a high-quality, styled, and standardized frontend development environment is ready. * **Acceptance Criteria (ACs):** 1. A new, private Git repository `bmad-daily-digest-frontend` **must** be created on GitHub. 2. The `bmad-daily-digest-ui` V0 scaffold project files **must** be used as the initial codebase in this repository. 3. `package.json` **must** be updated (project name, version, description). 4. Project dependencies **must** be installable. 5. TypeScript (`tsconfig.json`), Next.js (`next.config.mjs`), Tailwind (`tailwind.config.ts`), ESLint, Prettier, Jest configurations from the scaffold **must** be verified and operational. 6. The application **must** build successfully (`npm run build`) with the scaffolded UI. 7. A basic CI pipeline stub (GitHub Actions) for lint, format check, test, build **must** be created. 8. A standard `.gitignore` and an updated `README.md` **must** be present. 9. An initial AWS CDK application structure **must** be created within a `cdk/` directory in this repository, ready for defining frontend-specific infrastructure (S3, CloudFront in Story 3.6). **Story 3.2: Frontend API Service Layer for Backend Communication** * **User Story Statement:** As a Frontend Developer, I need a dedicated and well-typed API service layer (e.g., `lib/api-client.ts`) within the Next.js frontend application to manage all HTTP communication with the "BMad Daily Digest" backend API (for fetching episode lists and specific episode details), so that UI components can cleanly and securely consume backend data with robust error handling. * **Acceptance Criteria (ACs):** 1. A TypeScript module `lib/api-client.ts` (or similar) **must** encapsulate backend API interactions. 2. Functions **must** exist for: `getEpisodes(): Promise` and `getEpisodeDetails(episodeId: string): Promise`. 3. `axios` (or native `Workspace` with a wrapper if preferred for frontend) **must** be used for HTTP requests. 4. Backend API base URL (`NEXT_PUBLIC_BACKEND_API_URL`) and Frontend Read API Key (`NEXT_PUBLIC_FRONTEND_API_KEY`) **must** be configurable via public environment variables and used in requests. 5. TypeScript interfaces (`EpisodeListItem`, `EpisodeDetail`, `SourceHNPostDetail` from `lib/types.ts`) for API response data **must** be defined/used, matching backend API. 6. API functions **must** correctly parse JSON responses and transform data into defined interfaces. 7. Error handling (network errors, non-2xx responses from backend) **must** be implemented, providing clear error information/objects. 8. Unit tests (Jest) **must** mock the HTTP client and verify API calls, data parsing/transformation, and error handling. All tests **must** pass. **Story 3.3: Episode List Page Implementation** * **User Story Statement:** As a Busy Tech Executive, I want to view a responsive "Episode List Page" (based on `app/(pages)/episodes/page.tsx` from the scaffold) that clearly displays all available "BMad Daily Digest" episodes in reverse chronological order, showing the episode number, publication date, and podcast title for each, using themed components like `episode-card.tsx`, so that I can quickly find and select an episode. * **Acceptance Criteria (ACs):** 1. The existing `app/(pages)/episodes/page.tsx` (or equivalent main list page from scaffold) **must** be updated. 2. It **must** use the API service layer (Story 3.2) to fetch episodes. 3. A themed loading state (e.g., using `loading-state.tsx`) **must** be shown. 4. A themed error message (e.g., using `error-state.tsx`) **must** be shown if fetching fails. 5. A "No episodes available yet" message **must** be shown for an empty list. 6. Episodes **must** be listed in reverse chronological order. 7. Each list item, potentially using a modified `episode-card.tsx` component, **must** display "Episode [EpisodeNumber]: [PublicationDate] - [PodcastGeneratedTitle]". 8. Each item **must** link to the Episode Detail Page for that episode using its `episodeId`. 9. Styling **must** adhere to the "80s retro CRT terminal" aesthetic. 10. The page **must** be responsive. 11. Unit/integration tests (Jest with RTL) **must** cover all states, data display, order, and navigation. All tests **must** pass. **Story 3.4: Episode Detail Page Implementation** * **User Story Statement:** As a Busy Tech Executive, after selecting an episode, I want to navigate to a responsive "Episode Detail Page" (based on `app/(pages)/episodes/[episodeId]/page.tsx`/page.tsx] from the scaffold) that features an embedded HTML5 audio player, displays the episode title/date/number, a list of the Hacker News stories covered (using components like `story-item.tsx`), and provides clear links to the original articles and HN discussions, so I can listen and explore sources. * **Acceptance Criteria (ACs):** 1. The dynamic route page `app/(pages)/episodes/[episodeId]/page.tsx` **must** be implemented. 2. It **must** accept `episodeId` from the URL. 3. It **must** use the API service layer (Story 3.2) to fetch episode details. 4. Loading and error states **must** be handled and displayed with themed components. 5. If data found, **must** display: `podcastGeneratedTitle`, `publicationDate`, `episodeNumber`. 6. An embedded HTML5 audio player (`