# PRD for RSS Reader PWA (PRD)
## Product Overview
### Product Name
Shayon's News
### Product Description
Shayon's News is a Progressive Web Application (PWA) designed to aggregate and deduplicate news items from user-provided RSS feeds. It uses OpenAI's GPT-4o-mini model to generate concise AI-powered summaries and is accessible across devices on the same local network. Logs for activities and errors are user-accessible, designed for clarity, and presented interactively.
### Wireframe
<iframe style="border: 1px solid rgba(0, 0, 0, 0.1);" width="800" height="450" src="https://embed.figma.com/design/uQjp8xLxxYqZrkPf0dh2eJ/RSS-Reader-App?node-id=0-1&embed-host=share" allowfullscreen></iframe>
## Functional Requirements
### Core Features
#### 1. RSS Feed Aggregation
- Add feeds manually by URL or via OPML upload.
- Automatically refresh all feeds every hour, simultaneously.
- Show a loading animation during refresh.
- OPML uploads:
- Validate feed URLs before adding.
- Add feeds not already present in the app.
- Post-action feedback:
- Inform users which feeds were successfully added.
- Provide detailed error messages for feeds that failed to add (e.g., invalid URL, unreachable source).
#### 2. News Deduplication
- Deduplicate stories using semantic similarity analysis with OpenAI GPT-4o-mini.
- Combine URL matching and similarity scoring for effective deduplication.
- Exclude sponsored posts and ads automatically.
#### 3. AI-Powered Summarization
- Summarize news articles into 2–5 lines.
- Fetch full content when required for summaries.
#### 4. Dynamic Loading
- Initially load 25 news items on the homepage.
- Use lazy loading to fetch additional items as the user scrolls.
#### 5. Dark Mode Support
- Automatically detect the device's display mode and adapt the UI accordingly.
#### 6. Logs
- Interactive logs for activities, errors, and system events, accessible within the app.
- Retain logs for 30 days on the server (no export option).
## Design Requirements
### Logging Mechanism
#### 1. Log Categories
- **Activity Logs**:
- Feed refresh events with timestamps.
- Deduplication and summarization events.
- **Error Logs**:
- Feed parsing errors (e.g., invalid URLs, unreachable sources).
- GPT API errors (e.g., timeouts, rate limits).
- Network errors during content fetching.
- **System Logs**:
- Feed cleanup actions.
- Debug information for advanced troubleshooting.
#### 2. Retention
- Logs will be stored in a local SQLite database and retained for 30 days.
#### 3. Presentation
- Logs are displayed in a timeline-like interface with clear categorization and color coding:
- **Activity Logs**: Neutral tones (gray/blue).
- **Error Logs**: Warning (yellow) or critical errors (red).
- **System Logs**: Background debugging in light gray.
### Animations and Transitions
#### 1. Lazy Loading
- Fade-in effect for new articles as they load.
- Show a spinner at the bottom of the list during fetching.
#### 2. Feed Refresh
- Display a spinning loader next to the refresh button.
- Temporarily disable UI interactions (e.g., refresh button) until the refresh completes.
#### 3. Error States
- For inline errors (e.g., failed summarization), briefly display a notification bar with a close button.
- For critical errors, show a modal with retry/dismiss options.
### Error Notifications
#### 1. Non-Critical Errors
```
- Notification Bar:
[SF Symbol: Alert] Summarization failed for an article. Original content displayed.
[Dismiss]
- Displayed temporarily (5–10 seconds).
- Users can manually dismiss it.
```
#### 2. Critical Errors
```
- Modal with detailed feedback:
[SF Symbol: Exclamation] Feed Parsing Error
Unable to fetch articles from <Feed Name>. Check the URL or your connection.
[Retry Feed] [Dismiss]
```
## Wireframes
### Homepage
```
+-----------------------------------------------------------+
| Shayon's News |
+-----------------------------------------------------------+
| [SF Symbol: Arrow.2.Circlepath] Refresh Feeds |
| [SF Symbol: Moon] |
+-----------------------------------------------------------+
| [News Item 1] |
| Summary: … |
| Source: [Feed Name] Status: [Unread/Read] |
+-----------------------------------------------------------+
| [News Item 2] |
| Summary: … |
| Source: [Feed Name] Status: [Unread/Read] |
+-----------------------------------------------------------+
| * Lazy loading will fetch additional items as |
| the user scrolls down the page. |
+-----------------------------------------------------------+
```
### Feed Management
```
+-----------------------------------------------------------+
| Manage Feeds |
+-----------------------------------------------------------+
| [SF Symbol: Plus.Circle] Add Feed URL: |
| [_____________________] [Add Feed] |
+-----------------------------------------------------------+
| [SF Symbol: Arrow.Up.Doc] Import OPML: |
| [Choose File] |
+-----------------------------------------------------------+
| [SF Symbol: List.Dash] Current Feeds: |
| 1. Feed Name 1 [SF Symbol: Trash] |
| 2. Feed Name 2 [SF Symbol: Trash] |
+-----------------------------------------------------------+
| [Back to Home] |
+-----------------------------------------------------------+
```
### Logs
```
+-----------------------------------------------------------+
| Logs |
+-----------------------------------------------------------+
| [SF Symbol: Clock] Feed Refresh |
| - 02-Dec-2024 10:00 AM |
| - Sources Updated: 12 |
+-----------------------------------------------------------+
| [SF Symbol: Doc] Deduplication |
| - 02-Dec-2024 10:01 AM |
| - Removed 5 duplicates |
+-----------------------------------------------------------+
| [SF Symbol: Exclamation] Error Logs |
| - 02-Dec-2024 10:05 AM |
| - GPT API Timeout: Retrying… |
+-----------------------------------------------------------+
| [Back to Home] [Clear Logs] |
+-----------------------------------------------------------+
```