hn

April 27, 2026 Β· View on GitHub

A terminal client for Hacker News.

Go version CI Release Downloads License

demo

Features

  • πŸ“° 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 with T, 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

Install

Homebrew (macOS / Linux):

$ brew install heartleo/tap/hn

winget (Windows):

$ winget install heartleo.hn

curl (macOS / Linux):

$ curl -fsSL https://raw.githubusercontent.com/heartleo/hn-cli/main/install.sh | sh

Prebuilt binaries β€” download from GitHub Releases:

PlatformArchive
Linux x86_64hn_<version>_linux_x86_64.tar.gz
Linux arm64hn_<version>_linux_arm64.tar.gz
macOS x86_64hn_<version>_darwin_x86_64.tar.gz
macOS arm64hn_<version>_darwin_arm64.tar.gz
Windows x86_64hn_<version>_windows_x86_64.zip
Windows arm64hn_<version>_windows_arm64.zip

Go install (requires Go 1.25+):

$ go install github.com/heartleo/hn-cli/cmd/hn@latest

Build from source:

$ git clone https://github.com/heartleo/hn-cli
$ cd hn
$ go build -o hn ./cmd/hn

Quick Start

$ hn        # top stories
$ hn new    # new stories
$ hn best   # best stories

Commands

Browse

browse demo

Opens the interactive TUI. Defaults to Top stories; switch tabs with ←/β†’.

$ hn        # top stories (default)
$ hn top
$ hn new
$ hn best
$ hn ask
$ hn show

Comments

comments demo

Press Enter on any story to open its comment thread.

  • navigate with ↑/↓ or k/j
  • press Enter to expand or collapse a reply tree
  • press Space to fold or unfold the selected comment
  • press C / E to fold or unfold all
  • press r to jump to the root comment
  • press R to soft refresh
  • press Esc to go back

Translation

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)

theme

$ hn theme          # show current
$ hn theme nord     # set globally

Available: hn Β· mocha Β· dracula Β· tokyo Β· nord Β· gruvbox

Keys

Story List

KeyAction
EnterOpen comment thread
oOpen in browser
tTranslate selected title
TTranslate all visible titles
← / β†’Switch tab
rRefresh
?Toggle help
q / Ctrl+CQuit

Comment Thread

KeyAction
j / ↓Next comment
k / ↑Previous comment
ggBack to top
rJump to root comment
EnterExpand / collapse replies
SpaceFold / unfold selected comment
C / EFold / unfold all
tTranslate selected comment
RSoft refresh
oOpen story in browser
EscBack to list
?Toggle help
Q / Ctrl+CQuit

Configuration

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.

Translation

VariableDefaultDescription
HN_TRANSLATE_API_URLhttps://api.openai.com/v1API base URL
HN_TRANSLATE_API_KEYβ€”API key
HN_TRANSLATE_MODELgpt-4o-miniModel name
HN_TRANSLATE_LANGChineseTarget language

Example .env:

HN_TRANSLATE_API_KEY=sk-...
HN_TRANSLATE_LANG=Chinese

Theme

VariableDescription
HN_THEMEOverride 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"
  }
}

Star History

Star History Chart