A native desktop application for browsing Hacker News with a clean, modern interface. Built with Rust and egui.
- Browse top stories from different Hacker News sections:
- Hot Stories (front page)
- New Stories
- Show HN
- Ask HN
- Jobs
- Best Stories
- View comments in a threaded, Reddit-like format with auto-folding and adjustable font size
- Search and filter stories by title, domain, or author
- Automatically loads more content when scrolling to the bottom
- Color-coded stories based on score
- Dark and light mode support
- Offline capability with local caching
- Favorite stories for later reading
- Open articles in your default browser
- Rust (1.70.0 or newer)
- Cargo package manager
-
Clone the repository:
git clone <repository-url> cd hacker_news_reader
-
Build the application:
-
Run the application:
The compiled binary will be available at target/release/hacker_news_reader
.
- Tabs: Click the tabs at the top to switch between different Hacker News sections (Hot, New, Show, Ask, Jobs, Best).
- Stories: Click on a story title to open it in your default web browser.
- Comments: Click on the comments count to view the comments for a story.
- Back: Use the back button or press Backspace to return to the story list from comments view.
- Refresh: Click the refresh button to reload the current section. Hold Shift while clicking to bypass the cache.
- Theme: Toggle between dark and light themes using the theme button.
- Favorites: Click the hamburger menu (☰) to show or hide your favorite stories.
- Arrow Keys: Use arrow keys to scroll.
- Space / Page Down: Scroll down a page.
- Page Up: Scroll up a page.
- Home: Scroll to the top.
- End: Scroll to the bottom.
- Backspace: Return to the story list from the comments view.
- C: When viewing comments, collapse all top-level comments.
- Shift+C: When viewing comments, expand all comments.
- + (Plus): Increase comment font size when in comments view.
- - (Minus): Decrease comment font size when in comments view.
- Ctrl+F: Show search interface to filter stories.
- Escape: Close search interface.
- 1-6 Number Keys: Switch between tabs (1=Hot, 2=New, 3=Show, 4=Ask, 5=Jobs, 6=Best).
The story list displays up to 150 stories per section (5 pages of 30 stories each). Each story shows:
- Story number
- Title (color-coded by score)
- Source domain
- Author
- Score
- Time posted
- Comments count
The comments view shows a threaded display of comments. Features include:
- Auto-folding of comments when first loaded for better overview
- Collapsible comment threads
- Adjustable font size with + and - keys or buttons
- Author highlighting
- Nested replies
- Comment age display
- HTML formatting preserved from original comments
To save a story to your favorites:
- Click the star icon next to a story.
- Access your favorites by clicking the hamburger menu (☰) in the upper left.
Favorites are stored locally in a SQLite database.
The application follows a simple architecture with three main components:
-
UI Layer (
main.rs
): Contains the main application structure (HackerNewsReaderApp
) and handles rendering with egui. -
Data Models (
models.rs
): Defines the core data structures:HackerNewsItem
: Represents a story/postHackerNewsComment
: Represents a comment with nested children
-
Hacker News Client (
hn_client.rs
): Handles HTTP requests to fetch Hacker News content and parses HTML responses using the scraper library.
MIT License - see the LICENSE file for details.