A terminal client for Hacker News.
- 📰 Story browser — Top, New, Best, Ask HN, Show HN with tab switching
- 💬 Comment threads — navigate with
j/k, fold/unfold, lazy-load reply trees - 🌐 Translation — translate a title with
t, all visible titles withT, or a selected comment - 🔄 Soft refresh — refresh stories or comments without restarting
- 🎨 Themes — hn, mocha, dracula, tokyo, nord, gruvbox
- ⚡ Progressive loading — visible range loads first, more fetched as you scroll
Homebrew (macOS / Linux):
$ brew install heartleo/tap/hnwinget (Windows):
$ winget install heartleo.hncurl (macOS / Linux):
$ curl -fsSL https://raw.githubusercontent.com/heartleo/hn-cli/main/install.sh | shPrebuilt binaries — download from GitHub Releases:
| Platform | Archive |
|---|---|
| Linux x86_64 | hn_<version>_linux_x86_64.tar.gz |
| Linux arm64 | hn_<version>_linux_arm64.tar.gz |
| macOS x86_64 | hn_<version>_darwin_x86_64.tar.gz |
| macOS arm64 | hn_<version>_darwin_arm64.tar.gz |
| Windows x86_64 | hn_<version>_windows_x86_64.zip |
| Windows arm64 | hn_<version>_windows_arm64.zip |
Go install (requires Go 1.25+):
$ go install github.com/heartleo/hn-cli/cmd/hn@latestBuild from source:
$ git clone https://github.com/heartleo/hn-cli
$ cd hn
$ go build -o hn ./cmd/hn$ hn # top stories
$ hn new # new stories
$ hn best # best storiesOpens the interactive TUI. Defaults to Top stories; switch tabs with ←/→.
$ hn # top stories (default)
$ hn top
$ hn new
$ hn best
$ hn ask
$ hn showPress Enter on any story to open its comment thread.
- navigate with
↑/↓ork/j - press
Enterto expand or collapse a reply tree - press
Spaceto fold or unfold the selected comment - press
C/Eto fold or unfold all - press
rto jump to the root comment - press
Rto soft refresh - press
Escto go back
Translates via any OpenAI-compatible chat completions API. See Configuration to set up an API key.
t translate selected story title (toggle cached translation)
T translate all visible titles in one batch request
t translate selected comment (in comment view)
$ hn theme # show current
$ hn theme nord # set globallyAvailable: hn · mocha · dracula · tokyo · nord · gruvbox
| Key | Action |
|---|---|
Enter |
Open comment thread |
o |
Open in browser |
t |
Translate selected title |
T |
Translate all visible titles |
← / → |
Switch tab |
r |
Refresh |
? |
Toggle help |
q / Ctrl+C |
Quit |
| Key | Action |
|---|---|
j / ↓ |
Next comment |
k / ↑ |
Previous comment |
gg |
Back to top |
r |
Jump to root comment |
Enter |
Expand / collapse replies |
Space |
Fold / unfold selected comment |
C / E |
Fold / unfold all |
t |
Translate selected comment |
R |
Soft refresh |
o |
Open story in browser |
Esc |
Back to list |
? |
Toggle help |
Q / Ctrl+C |
Quit |
hn reads ~/.config/hn/config.json. A .env file in the working directory is also loaded automatically; environment variables take precedence over the config file.
| Variable | Default | Description |
|---|---|---|
HN_TRANSLATE_API_URL |
https://api.openai.com/v1 |
API base URL |
HN_TRANSLATE_API_KEY |
— | API key |
HN_TRANSLATE_MODEL |
gpt-4o-mini |
Model name |
HN_TRANSLATE_LANG |
Chinese |
Target language |
Example .env:
HN_TRANSLATE_API_KEY=sk-...
HN_TRANSLATE_LANG=Chinese| Variable | Description |
|---|---|
HN_THEME |
Override theme without editing config |
Example ~/.config/hn/config.json:
{
"theme": "mocha",
"translate": {
"api_url": "https://api.openai.com/v1",
"api_key": "sk-...",
"model": "gpt-4o-mini",
"language": "Chinese"
}
}

