Hacker News Terminal Client Documentation
Welcome to the official, detailed documentation for hn-client. A blazing-fast, keyboard-driven Hacker News TUI (Terminal User Interface) built in Go using Bubble Tea.
hn-client works on macOS, Linux, and Windows terminal environments. Having a terminal browser (like w3m or lynx) installed is optional but highly recommended for the best experience.
Installation & Compilation
You can compile and install hn-client directly from source using the Go toolchain.
1. Install Go
Ensure you have Go version 1.21 or higher installed on your machine. Check with:
go version 2. Clone and Compile
Clone the repository and run the build command:
git clone https://github.com/aeon022/hn-client.git
cd hn-client
go build -o hn-client main.go 3. Automated Setup Script
For convenience, you can execute the setup script which builds the binary and links it to your local path:
chmod +x setup.sh
./setup.sh Configuration File
When you start the application for the first time, a configuration file is automatically created in your home directory at ~/.hn-config.json.
Here is an example of the structure of this file:
{
"username": "hacker_user",
"show_dead": false,
"use_gui_browser": false,
"cookie": "user_auth_cookie_string",
"theme": "dracula"
} Configurable Fields:
username: Your Hacker News handle, used to check for reply notifications.show_dead: Boolean to show/hide dead or flagged stories.use_gui_browser: Iftrue, links will bypass terminal browsers and open in your system's GUI browser (Safari, Chrome, Firefox).cookie: Saved HN session cookie. Used for submitting stories and replies directly inside the TUI.theme: Selected styling layout (orange,dracula,nord,monokai).
Keybindings Reference
The TUI is separated into two main views: the **List View** (stories) and the **Detail View** (story description + comment tree).
1. Navigation & General Keys (Available in all views)
| Key | Action | Description |
|---|---|---|
| ? | Help Menu | Toggle the overlay help screen mapping all keys. |
| t | Theme Toggle | Cycle active color palette (Dracula, Nord, Monokai, Orange). |
| b | Browser Toggle | Switch between GUI and Terminal browser modes. |
| Ctrl+C | Quit | Safely close the application. |
2. Story List View Keys
| Key | Action | Description |
|---|---|---|
| j / k | Navigation | Move the cursor up and down through the stories feed list. |
| Tab / Shift+Tab | Next / Prev Feed | Cycle through feeds (Top, New, Best, Ask, Show, Mine, Bookmarks). |
| 1 - 7 | Direct Feed Select | Jump directly to feed: 1:Top, 2:New, 3:Best, 4:Ask, 5:Show, 6:Mine, 7:Bookmarks. |
| n / p | Page Navigation | Fetch the Next (n) or Previous (p) page of 30 stories. |
| / | Filter search | Filter stories instantly by typing title or author queries. |
| x | Clear search | Clear the active search filter query. |
| Enter | Open Details | Open comments tree and full article content. |
| o | Open Original Link | Open the external URL of the story in the selected browser. |
| s | Offline Bookmark | Download and save the selected story + all comments offline. |
| U | User Profile | Show the author's Hacker News profile info card in a popup. |
| w | Write Submission | Create a new post on HN using the external text editor. |
3. Detail / Comments View Keys
| Key | Action | Description |
|---|---|---|
| j / k | Comment Cursor | Navigate through the comment tree (selected comment gets double border). |
| Esc / q | Back | Return to the Story List feed view. |
| c | Fold / Collapse | Toggle collapse of the selected comment thread and all its replies. |
| u | Extract Links | Extract all URLs from text and comments into a popup selection menu. |
| r | Quick Reply | Write and submit a reply in the footer textinput. |
| e | Vim Reply | Write a formatted reply using external editor (e.g. Vim). |
| s | Offline Bookmark | Save story and current comments tree offline. |
| U | User Profile | View the selected comment author's profile card. |
Offline Bookmarks System
The bookmarks system allows you to store stories and their complete comments tree locally for reading on planes, trains, or offline commutes.
~/.hn-bookmarks.json. Do not edit this file manually unless you are familiar with JSON syntax, as it may cause loading failures.
How to Bookmark:
- From the **Story List**, hover over any story and press s. The client will fetch the comments tree in the background and save it.
- Or, inside the **Detail View**, press s to save the currently loaded story and comments instantly.
Reading Bookmarks:
Press 7 or cycle feeds to the Bookmarks tab. You will see a list of your saved stories sorted by the time they were saved. Pressing Enter opens the comments offline.
Comment Link Extractor
Copypasting URLs out of terminal emulators is often painful. The link extractor solves this completely.
Usage:
- Inside any story **Detail View**, press u.
- The TUI will scan the main article text and all comments, extracting any strings matching
http://orhttps://. - An overlay modal will display all extracted links.
- Use j/k to select a link, and press Enter to open it in your browser.
- Press Esc or u to close the overlay.
User Profiles Popovers
Quickly look up metadata about Hacker News authors without leaving the terminal view.
Usage:
- Press U (Shift + U) over a selected story or comment.
- The client will fetch the profile information for the item's author from the HN API.
- A popover box displays the **Username**, **Registration Date**, **Karma Score**, and the **About bio** text.
- The bio description is automatically stripped of HTML tags and word-wrapped to fit the overlay container.
Vim and Terminal Browser Integration
Writing long responses inside terminal inputs can be restrictive. hn-client offers full external editor support.
1. Quick Replies vs. External Vim Replies:
- Quick Reply (r): Opens a simple text input in the TUI footer. Great for short, one-line responses.
- External Reply (e): Suspends the Bubble Tea TUI session and spawns your system's default text editor (usually
VimorNeovim, configured via your$EDITORenvironment variable) with a temporary Markdown file.
2. Creating Submissions (w):
Pressing w in list view spawns a template containing YAML frontmatter:
---
Title: Show HN: My Awesome Go Project
URL: https://github.com/my/project
---
Optional text body here... Write your title, link, and text, save and quit. The TUI will resume, read the file, and submit it to Hacker News.
CLI Markdown Publisher
In addition to the interactive TUI, hn-client can be executed directly from the CLI to publish drafts or posts saved in Markdown files.
Usage:
hn-client publish post_draft.md The Markdown file must contain standard YAML frontmatter defining the Title and either a URL (for links) or a text body:
---
Title: Show HN: A fast terminal client in Go
URL: https://github.com/gweiher/hn-client
---
This client is built with Bubble Tea...